Skip to content

Commit

Permalink
# This is a combination of 6 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

fetch whole repo

# This is the commit message #2:

add comment

# This is the commit message #3:

fix paths for validation

# This is the commit message #4:

try with functions

# This is the commit message #5:

fix spelling

# This is the commit message #6:

display failed UML generation once
  • Loading branch information
Tofel committed Aug 2, 2024
1 parent a6e3a91 commit 64f0488
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 74 deletions.
63 changes: 6 additions & 57 deletions .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ jobs:
- modified: 'contracts/src/v0.8/**/*.sol'
tests:
# if: needs.changes.outputs.src_changes == 'true'
# TODO remove
if: needs.changes.outputs.src_changes == 'mietek'
if: needs.changes.outputs.src_changes == 'true'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -265,7 +263,10 @@ jobs:
format_errors=0
for file in $FILE_LIST; do
sanitized_file="${file/contracts\//}"
PROFILE=$(echo "$sanitized_file" | awk -F'src/[^/]*/' '{print $2}' | cut -d'/' -f1)
PROFILE=$(echo "$sanitized_file" | awk -F'src/[^/]*/' '{print $2}' | cut -d'/' -f1)
if [ -z "$PROFILE" ]; then
PROFILE="${{ env.FOUNDRY_PROFILE }}"
fi
echo "::debug::Running forge fmt $sanitized_file with FOUNDRY_PROFILE=$PROFILE"
FOUNDRY_PROFILE=$PROFILE forge fmt --check "$sanitized_file" || format_errors=$((format_errors+1))
done
Expand All @@ -286,57 +287,5 @@ jobs:
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Check formatting
continue-on-error: true

solidity-forge-fmt:
strategy:
fail-fast: false
matrix:
product: [ ccip ]
needs: [ changes ]
name: Forge fmt ${{ matrix.product }}
# See https://github.com/foundry-rs/foundry/issues/3827
runs-on: ubuntu-22.04

# The if statements for steps after checkout repo is workaround for
# passing required check for PRs that don't have filtered changes.
steps:
- name: Checkout the repo
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
submodules: recursive

# Only needed because we use the NPM versions of packages
# and not native Foundry. This is to make sure the dependencies
# stay in sync.
- name: Setup NodeJS
if: needs.changes.outputs.changes == 'true'
uses: ./.github/actions/setup-nodejs

- name: Install Foundry
if: needs.changes.outputs.changes == 'true'
uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773 # v1.2.0
with:
version: ${{ env.FOUNDRY_VERSION }}

- name: Run Forge fmt
if: needs.changes.outputs.changes == 'true'
run: |
forge fmt --check
id: fmt
working-directory: contracts
env:
FOUNDRY_PROFILE: ${{ matrix.product }}

- name: Collect Metrics
if: needs.changes.outputs.changes == 'true'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0
with:
id: solidity-forge-fmt
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Foundry Tests ${{ matrix.product }}
this-job-name: Foundry Tests fmt
continue-on-error: true
29 changes: 12 additions & 17 deletions .github/workflows/solidity-hardhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
FOUNDRY_PROFILE: ci
# Has to match the `make foundry` version.
FOUNDRY_VERSION: nightly-de33b6af53005037b463318d2628b5cfcaf39916
PRODUCT: "automation"
PRODUCT: "functions"
BASE_REF: "v2.13.0"

jobs:
Expand Down Expand Up @@ -150,6 +150,7 @@ jobs:
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
submodules: recursive
fetch-depth: 0

- name: Copy modified changesets
run: |
Expand Down Expand Up @@ -177,7 +178,8 @@ jobs:
IFS=',' read -r -a modified_files <<< "${{ needs.changes.outputs.files }}"
echo "# Modified contracts:" > contracts/modified_contracts.md
for file in "${modified_files[@]}"; do
status=$(git diff --name-status ${{ env.BASE_REF }}..${{ github.sha }} -- "$file" | awk '{ print $1 }')
# TODO remove this check when AurorNZ/paths-filter is fixed
status=$(git diff --name-status ${{ env.BASE_REF }} ${{ github.sha }} -- "$file" | awk '{ print $1 }')
if [ "$status" == "D" ]; then
echo "File $file was deleted, skipping."
continue
Expand Down Expand Up @@ -367,14 +369,6 @@ jobs:
mv remappings_modified.txt remappings.txt
./contracts/scripts/ci/generate_uml.sh "./" "contracts/uml-diagrams" "$contract_list"
if [ -f "contracts/uml-diagrams/uml_generation_failures.txt" ]; then
echo "# Warning!" >> $GITHUB_STEP_SUMMARY
echo "## Reason: Failed to generate UML diagrams for some contracts" >> $GITHUB_STEP_SUMMARY
echo "### Files:" >> $GITHUB_STEP_SUMMARY
cat contracts/uml-diagrams/uml_generation_failures.txt >> $GITHUB_STEP_SUMMARY
echo "## Action required: Please try generate artifacts for them locally or using a different tool" >> $GITHUB_STEP_SUMMARY
fi
- name: Generate Slither Markdown reports
run: |
Expand All @@ -401,21 +395,22 @@ jobs:
IFS=',' read -r -a modified_files <<< "${{ needs.changes.outputs.files }}"
missing_svgs=()
missing_reports=()
for file in "${modified_files[@]}"; do
status=$(git diff --name-status ${{ env.BASE_REF }}..${{ github.sha }} -- "$file" | awk '{ print $1 }')
for file in "${modified_files[@]}"; do
# TODO remove this check when AurorNZ/paths-filter is fixed
status=$(git diff --name-status ${{ env.BASE_REF }} ${{ github.sha }} -- "$file" | awk '{ print $1 }')
if [ "$status" == "D" ]; then
echo "File $file was deleted, skipping validation"
continue
fi
svg_file="$(basename "${file%.sol}").svg"
if [ ! -f "uml-diagrams/$svg_file" ]; then
if [ ! -f "contracts/uml-diagrams/$svg_file" ]; then
echo "Error: UML diagram for $file not found"
missing_svgs+=("$file")
fi
report_file="$(basename "${file%.sol}")-slither-report.md"
if [ ! -f "slither-reports/$report_file" ]; then
if [ ! -f "contracts/slither-reports/$report_file" ]; then
echo "Error: Slither report for $file not found"
missing_reports+=("$file")
fi
Expand All @@ -428,19 +423,19 @@ jobs:
for file in "${missing_svgs[@]}"; do
echo " $file" >> $GITHUB_STEP_SUMMARY
done
echo "## Action required: Please try generate artifacts for them locally or using a different tool" >> $GITHUB_STEP_SUMMARY
echo "## Action required: Please try to generate artifacts for them locally or using a different tool" >> $GITHUB_STEP_SUMMARY
else
echo "All UML diagrams generated successfully"
fi
if [ ${#missing_reports[@]} -gt 0 ]; then
echo "Error: Missing Slither reports for files: ${missing_reports[@]}"
echo "# Warning!" >> $GITHUB_STEP_SUMMARY
echo "## Reason: Missing Slither reports for files: ${missing_reports[@]}" >> $GITHUB_STEP_SUMMARY
echo "## Reason: Missing Slither reports for files:" >> $GITHUB_STEP_SUMMARY
for file in "${missing_reports[@]}"; do
echo " $file" >> $GITHUB_STEP_SUMMARY
done
echo "## Action required: Please try generate artifacts for them locally" >> $GITHUB_STEP_SUMMARY
echo "## Action required: Please try to generate artifacts for them locally" >> $GITHUB_STEP_SUMMARY
else
echo "All Slither reports generated successfully"
fi
Expand Down

0 comments on commit 64f0488

Please sign in to comment.