Skip to content

Allow users to pin the Foundry version #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
| `ignore-compile` | If set to true, the Slither action will not attempt to compile the project. False by default. See [Advanced compilation](#advanced-compilation).
| `fail-on` | Cause the action to fail if Slither finds any issue of this severity or higher. See [action fail behavior](#action-fail-behavior).
| `node-version` | The version of `node` to use. If this field is not set, the latest version will be used.
| `foundry-version`| The version of Foundry to use. If this field is not set, the latest nightly version will be used.
| `sarif` | If provided, the path of the SARIF file to produce, relative to the repo root (see [Github Code Scanning integration](#github-code-scanning-integration)).
| `slither-args` | Extra arguments to pass to Slither.
| `slither-config` | The path to the Slither configuration file. By default, `./slither.config.json` is used if present. See [Configuration file](https://github.com/crytic/slither/wiki/Usage#configuration-file).
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ inputs:
description: 'The version of solc to use. Should be autodetected, but may be specified manually.'
node-version:
description: 'The version of node to use.'
foundry-version:
description: 'The version of Foundry to use.'
target:
description: 'The path of the project that Slither should analyze, relative to the repo root.'
default: .
Expand Down
10 changes: 8 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SLITHERCONF="$(get INPUT_SLITHER-CONFIG)"
SLITHERPLUGINS="$(get INPUT_SLITHER-PLUGINS)"
STDOUTFILE="/tmp/slither-stdout"
IGNORECOMPILE="$(get INPUT_IGNORE-COMPILE)"
FOUNDRYVER="$(get INPUT_FOUNDRY-VERSION)"

# #19 - an user may set SOLC_VERSION in the workflow and cause problems here.
# Make sure it's unset. If you need to use a different solc version, override
Expand Down Expand Up @@ -152,7 +153,12 @@ install_node()
install_foundry()
{
if [[ -d "$TARGET" ]] && [[ -f "$TARGET/foundry.toml" ]]; then
echo "[-] Foundry target detected, installing foundry nightly"
if [[ -z "$FOUNDRYVER" ]]; then
FOUNDRYVER="nightly"
echo "[-] FOUNDRYVER was not set, using the nightly version."
fi

echo "[-] Foundry target detected, installing foundry $FOUNDRYVER"

wget -q -O foundryup https://raw.githubusercontent.com/foundry-rs/foundry/7b452656f722fc560f0414db3ce24a1f2972a8b7/foundryup/foundryup
if [ ! "e7628766329e2873484d5d633c750b5019eec77ae506c11a0ef13b440cc3e7c2 foundryup" = "$(sha256sum foundryup)" ]; then
Expand All @@ -163,7 +169,7 @@ install_foundry()
export FOUNDRY_DIR="/opt/foundry"
export PATH="$FOUNDRY_DIR/bin:$PATH"
mkdir -p "$FOUNDRY_DIR/bin" "$FOUNDRY_DIR/share/man/man1"
bash foundryup
bash foundryup -- -v "$FOUNDRYVER"
rm foundryup
fi
}
Expand Down