Skip to content

Commit

Permalink
feat(forge-ci): parallelize layout extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed Nov 27, 2024
1 parent a667b0b commit 081a143
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions .github/workflows/forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Check formatting
run: forge fmt --check

extract-storage-layouts:
extract-base-storage-layout-exocore-gateway:
runs-on: ubuntu-latest
needs: build
# A few minutes
Expand All @@ -139,14 +139,30 @@ jobs:
# cache them.
run: |
forge inspect src/core/ExocoreGateway.sol:ExocoreGateway storage-layout > ExocoreGateway.base.json
- name: Copy base branch layout file
run: cp ExocoreGateway.base.json /tmp/
# Now we can generate the layout for the PR level.
- name: Checkout back to PR
uses: actions/checkout@v4
- name: Upload storage layout file as an artifact
uses: actions/upload-artifact@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# Restoring these will help make `forge inspect` faster.
path: ExocoreGateway.base.json
name: storage-layouts-${{ github.event.pull_request.base.sha || github.event.after || github.sha }}

extract-storage-layouts:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
contract: [Bootstrap, ClientChainGateway, RewardVault, Vault, ExocoreGateway, ExoCapsule]
# A few minutes
timeout-minutes: 10
steps:
- name: Restore cached Foundry toolchain
uses: actions/cache/restore@v3
with:
path: ${{ needs.build.outputs.installation-dir }}
key: ${{ needs.build.outputs.cache-key }}
- name: Add Foundry to PATH
run: echo "${{ needs.build.outputs.installation-dir }}" >> "$GITHUB_PATH"
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
Expand All @@ -156,17 +172,11 @@ jobs:
./cache
./broadcast
key: build-${{ github.event.pull_request.head.sha || github.event.after || github.sha }}
- name: Generate storage layout files for the PR
- name: Generate storage layout file for ${{ matrix.contract }}
run: |
for file in Bootstrap ClientChainGateway RewardVault Vault ExocoreGateway ExoCapsule; do
forge inspect src/core/${file}.sol:${file} storage-layout > ${file}.compiled.json;
done
- name: Copy back base branch layout file
run: cp /tmp/ExocoreGateway.base.json ./ExocoreGateway.base.json
- name: Zip storage layout files
run: zip storage-layouts.zip ./*.compiled.json ./ExocoreGateway.base.json
- name: Upload storage layout files as an artifact
forge inspect src/core/${{ matrix.contract }}.sol:${{ matrix.contract }} storage-layout > ${{ matrix.contract }}.compiled.json;
- name: Upload storage layout file as an artifact
uses: actions/upload-artifact@v4
with:
path: storage-layouts.zip
path: ${{ matrix.contract }}.compiled.json
name: storage-layouts-${{ github.event.pull_request.head.sha || github.event.after || github.sha }}

0 comments on commit 081a143

Please sign in to comment.