|
| 1 | +name: contracts-abi-compat-check |
| 2 | + |
| 3 | +# Default to no token permissions at the workflow level; each job opts into the |
| 4 | +# minimum read scopes it needs. |
| 5 | +permissions: {} |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + |
| 10 | +env: |
| 11 | + ABI_COMPAT_FROM_TAG: v0.11.1 |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + check-changes: |
| 19 | + name: contracts-abi-compat-check/check-changes |
| 20 | + permissions: |
| 21 | + contents: read # Required by actions/checkout to clone the repository |
| 22 | + pull-requests: read # Required by dorny/paths-filter to inspect changed files |
| 23 | + runs-on: ubuntu-latest |
| 24 | + outputs: |
| 25 | + packages: ${{ steps.filter.outputs.changes }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 28 | + with: |
| 29 | + persist-credentials: "false" |
| 30 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 |
| 31 | + id: filter |
| 32 | + with: |
| 33 | + filters: | |
| 34 | + host-contracts: |
| 35 | + - .github/workflows/contracts-abi-compat-check.yml |
| 36 | + - ci/abi-compat/** |
| 37 | + - ci/shared/** |
| 38 | + - host-contracts/** |
| 39 | + gateway-contracts: |
| 40 | + - .github/workflows/contracts-abi-compat-check.yml |
| 41 | + - ci/abi-compat/** |
| 42 | + - ci/shared/** |
| 43 | + - gateway-contracts/** |
| 44 | +
|
| 45 | + check: |
| 46 | + name: contracts-abi-compat-check/${{ matrix.package }} |
| 47 | + needs: check-changes |
| 48 | + if: ${{ needs.check-changes.outputs.packages != '[]' }} |
| 49 | + permissions: |
| 50 | + contents: read # Required by actions/checkout to clone the PR branch and baseline tag |
| 51 | + runs-on: ubuntu-latest |
| 52 | + strategy: |
| 53 | + fail-fast: false |
| 54 | + matrix: |
| 55 | + package: ${{ fromJSON(needs.check-changes.outputs.packages) }} |
| 56 | + include: |
| 57 | + - package: host-contracts |
| 58 | + extra-deps: forge soldeer install |
| 59 | + - package: gateway-contracts |
| 60 | + extra-deps: "" |
| 61 | + steps: |
| 62 | + - name: Checkout PR branch |
| 63 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 64 | + with: |
| 65 | + persist-credentials: "false" |
| 66 | + |
| 67 | + - name: Checkout baseline |
| 68 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 69 | + with: |
| 70 | + ref: ${{ env.ABI_COMPAT_FROM_TAG }} |
| 71 | + path: baseline |
| 72 | + persist-credentials: "false" |
| 73 | + |
| 74 | + - name: Install Bun |
| 75 | + uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 |
| 76 | + |
| 77 | + - name: Install Foundry |
| 78 | + uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de |
| 79 | + |
| 80 | + - name: Install PR dependencies |
| 81 | + working-directory: ${{ matrix.package }} |
| 82 | + run: npm ci |
| 83 | + |
| 84 | + - name: Install baseline dependencies |
| 85 | + working-directory: baseline/${{ matrix.package }} |
| 86 | + run: npm ci |
| 87 | + |
| 88 | + - name: Install Forge dependencies |
| 89 | + if: matrix.extra-deps != '' |
| 90 | + env: |
| 91 | + PACKAGE: ${{ matrix.package }} |
| 92 | + EXTRA_DEPS: ${{ matrix.extra-deps }} |
| 93 | + run: | |
| 94 | + (cd "$PACKAGE" && $EXTRA_DEPS) |
| 95 | + (cd "baseline/$PACKAGE" && $EXTRA_DEPS) |
| 96 | +
|
| 97 | + - name: Setup compilation |
| 98 | + env: |
| 99 | + PACKAGE: ${{ matrix.package }} |
| 100 | + run: | |
| 101 | + (cd "$PACKAGE" && make ensure-addresses) |
| 102 | + (cd "baseline/$PACKAGE" && make ensure-addresses) |
| 103 | + bun ci/shared/merge-address-constants.ts "baseline/$PACKAGE/addresses" "$PACKAGE/addresses" |
| 104 | + cp "$PACKAGE/foundry.toml" "baseline/$PACKAGE/foundry.toml" |
| 105 | +
|
| 106 | + - name: Run ABI compatibility check |
| 107 | + env: |
| 108 | + PACKAGE: ${{ matrix.package }} |
| 109 | + run: bun ci/abi-compat/check.ts "baseline/$PACKAGE" "$PACKAGE" "$PACKAGE" |
0 commit comments