forge-old #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: forge-old | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| compare-bytecode: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry (old) | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: v1.5.1 | |
| - name: Verify forge executable hash | |
| env: | |
| EXPECTED_FORGE_SHA256: a39fc1913b53dde6a35b603756f65d799e13817ef694107ec0d3704c20435cce | |
| run: | | |
| forge_path="$(which forge)" | |
| echo "forge path: $forge_path" | |
| actual="$(sha256sum "$forge_path" | awk '{print $1}')" | |
| echo "actual: $actual" | |
| echo "expected: $EXPECTED_FORGE_SHA256" | |
| [ "$actual" = "$EXPECTED_FORGE_SHA256" ] || { echo "forge hash mismatch"; exit 1; } | |
| - name: Build with Foundry (old) | |
| run: forge build --force | |
| - name: Export bytecode manifest (old) | |
| run: | | |
| mkdir -p compare | |
| find out -name '*.json' -not -path '*/build-info/*' -not -path '*Test.sol/*' -print0 | sort -z | while IFS= read -r -d '' file; do | |
| rel="${file#out/}" | |
| jq -r --arg rel "$rel" '[$rel, (.bytecode.object // ""), (.deployedBytecode.object // "")] | @tsv' "$file" | |
| done > compare/old.tsv | |
| [ -s compare/old.tsv ] || { echo "old manifest is empty"; exit 1; } | |
| - name: Run Forge tests | |
| run: forge test | |
| - name: Install Foundry (latest nightly) | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| version: nightly | |
| - name: Build with Foundry (latest nightly) | |
| run: forge build --force --out out-new --cache-path cache-new | |
| - name: Export bytecode manifest (new) | |
| run: | | |
| find out-new -name '*.json' -not -path '*/build-info/*' -not -path '*Test.sol/*' -print0 | sort -z | while IFS= read -r -d '' file; do | |
| rel="${file#out-new/}" | |
| jq -r --arg rel "$rel" '[$rel, (.bytecode.object // ""), (.deployedBytecode.object // "")] | @tsv' "$file" | |
| done > compare/new.tsv | |
| [ -s compare/new.tsv ] || { echo "new manifest is empty"; exit 1; } | |
| - name: Compare bytecode | |
| run: diff -u compare/old.tsv compare/new.tsv |