|
| 1 | +name: forge-old |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + compare-bytecode: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + submodules: recursive |
| 18 | + - name: Install Foundry (old) |
| 19 | + uses: foundry-rs/foundry-toolchain@v1 |
| 20 | + with: |
| 21 | + version: v1.5.1 |
| 22 | + - name: Verify forge executable hash |
| 23 | + env: |
| 24 | + EXPECTED_FORGE_SHA256: a39fc1913b53dde6a35b603756f65d799e13817ef694107ec0d3704c20435cce |
| 25 | + run: | |
| 26 | + forge_path="$(which forge)" |
| 27 | + echo "forge path: $forge_path" |
| 28 | + actual="$(sha256sum "$forge_path" | awk '{print $1}')" |
| 29 | + echo "actual: $actual" |
| 30 | + echo "expected: $EXPECTED_FORGE_SHA256" |
| 31 | + [ "$actual" = "$EXPECTED_FORGE_SHA256" ] || { echo "forge hash mismatch"; exit 1; } |
| 32 | + - name: Build with Foundry (old) |
| 33 | + run: forge build --force |
| 34 | + - name: Export bytecode manifest (old) |
| 35 | + run: | |
| 36 | + mkdir -p compare |
| 37 | + find out -name '*.json' -not -path '*/build-info/*' -not -path '*Test.sol/*' -print0 | sort -z | while IFS= read -r -d '' file; do |
| 38 | + rel="${file#out/}" |
| 39 | + jq -r --arg rel "$rel" '[$rel, (.bytecode.object // ""), (.deployedBytecode.object // "")] | @tsv' "$file" |
| 40 | + done > compare/old.tsv |
| 41 | + [ -s compare/old.tsv ] || { echo "old manifest is empty"; exit 1; } |
| 42 | + - name: Run Forge tests |
| 43 | + run: forge test |
| 44 | + - name: Install Foundry (latest nightly) |
| 45 | + uses: foundry-rs/foundry-toolchain@v1 |
| 46 | + with: |
| 47 | + version: nightly |
| 48 | + - name: Build with Foundry (latest nightly) |
| 49 | + run: forge build --force --out out-new --cache-path cache-new |
| 50 | + - name: Export bytecode manifest (new) |
| 51 | + run: | |
| 52 | + find out-new -name '*.json' -not -path '*/build-info/*' -not -path '*Test.sol/*' -print0 | sort -z | while IFS= read -r -d '' file; do |
| 53 | + rel="${file#out-new/}" |
| 54 | + jq -r --arg rel "$rel" '[$rel, (.bytecode.object // ""), (.deployedBytecode.object // "")] | @tsv' "$file" |
| 55 | + done > compare/new.tsv |
| 56 | + [ -s compare/new.tsv ] || { echo "new manifest is empty"; exit 1; } |
| 57 | + - name: Compare bytecode |
| 58 | + run: diff -u compare/old.tsv compare/new.tsv |
0 commit comments