From 349778bbc6048bbea7e6ac0ae711126922bfe1f5 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 9 Aug 2024 16:16:24 +0200 Subject: [PATCH] add missing step id to action (#14088) * add missing step id * do not fail if Slither fails * try with not failing generation --- .github/workflows/solidity-foundry-artifacts.yml | 1 + contracts/scripts/ci/generate_slither_report.sh | 14 ++++++-------- contracts/scripts/ci/generate_uml.sh | 2 +- contracts/scripts/ci/select_solc_version.sh | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/solidity-foundry-artifacts.yml b/.github/workflows/solidity-foundry-artifacts.yml index e489033d675..50a77e2846b 100644 --- a/.github/workflows/solidity-foundry-artifacts.yml +++ b/.github/workflows/solidity-foundry-artifacts.yml @@ -118,6 +118,7 @@ jobs: fetch-depth: 0 - name: Extract Foundry version + id: extract-foundry-version uses: ./.github/actions/detect-solidity-foundry-version with: working-directory: contracts diff --git a/contracts/scripts/ci/generate_slither_report.sh b/contracts/scripts/ci/generate_slither_report.sh index 7fe31d40efc..bc876ae1182 100755 --- a/contracts/scripts/ci/generate_slither_report.sh +++ b/contracts/scripts/ci/generate_slither_report.sh @@ -44,15 +44,13 @@ run_slither() { >&2 echo "::error::Failed to select Solc version for $FILE" return 1 fi - set -e SLITHER_OUTPUT_FILE="$TARGET_DIR/$(basename "${FILE%.sol}")-slither-report.md" - - output=$(slither --config-file "$CONFIG_FILE" "$FILE" --checklist --markdown-root "$REPO_URL" --fail-none $SLITHER_EXTRA_PARAMS) - if [ $? -ne 0 ]; then - >&2 echo "::error::Slither failed for $FILE" - exit 1 + if ! output=$(slither --config-file "$CONFIG_FILE" "$FILE" --checklist --markdown-root "$REPO_URL" --fail-none $SLITHER_EXTRA_PARAMS); then + >&2 echo "::warning::Slither failed for $FILE" + return 0 fi + set -e output=$(echo "$output" | sed '/\*\*THIS CHECKLIST IS NOT COMPLETE\*\*. Use `--show-ignored-findings` to show all the results./d' | sed '/Summary/d') echo "# Summary for $FILE" > "$SLITHER_OUTPUT_FILE" @@ -80,8 +78,8 @@ set +e process_files "$SOURCE_DIR" "$TARGET_DIR" "${FILES[@]}" if [[ $? -ne 0 ]]; then - >&2 echo "::error::Failed to generate Slither reports" - exit 1 + >&2 echo "::warning::Failed to generate some Slither reports" + exit 0 fi echo "Slither reports saved in $TARGET_DIR folder" diff --git a/contracts/scripts/ci/generate_uml.sh b/contracts/scripts/ci/generate_uml.sh index 65745c93bbe..c71d0a1ac7d 100755 --- a/contracts/scripts/ci/generate_uml.sh +++ b/contracts/scripts/ci/generate_uml.sh @@ -88,7 +88,7 @@ process_selected_files() { MATCHES=($(find "$SOURCE_DIR" -type f -path "*/$FILE")) if [[ ${#MATCHES[@]} -gt 1 ]]; then - >&2 echo "Error: Multiple matches found for $FILE:" + >&2 echo "::error:: Multiple matches found for $FILE:" for MATCH in "${MATCHES[@]}"; do >&2 echo " $MATCH" done diff --git a/contracts/scripts/ci/select_solc_version.sh b/contracts/scripts/ci/select_solc_version.sh index 3f7d7864ab7..cfa13de0f60 100755 --- a/contracts/scripts/ci/select_solc_version.sh +++ b/contracts/scripts/ci/select_solc_version.sh @@ -66,7 +66,7 @@ set +e SOLCVER=$(extract_pragma "$FILE") if [[ $? -ne 0 ]]; then - echo "Error: Failed to extract the Solidity version from $FILE." + >&2 echo "::error:: Failed to extract the Solidity version from $FILE." return 1 fi