From 2790606aadeba22438b073ddebe27dd363f64882 Mon Sep 17 00:00:00 2001 From: Bowen Li Date: Fri, 14 Feb 2025 16:21:27 -0800 Subject: [PATCH] perf: use foundry official docker to run CI and speed up CI --- .github/workflows/foundry.yml | 40 +++++++++-------------------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index 6e1bd6093..eb8a8ad58 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -21,6 +21,8 @@ jobs: test-suite: name: Test runs-on: protocol-x64-16core + container: + image: ghcr.io/foundry-rs/foundry:stable strategy: matrix: suite: [Unit, Integration, Fork] @@ -31,12 +33,6 @@ jobs: with: submodules: recursive - # Install the Foundry toolchain. - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: stable - # Run Forge's formatting checker to ensure consistent code style. - name: "Forge Fmt" run: | @@ -67,6 +63,8 @@ jobs: continuous-fuzzing: name: Test (Intense) runs-on: protocol-x64-16core + container: + image: ghcr.io/foundry-rs/foundry:stable # Only run on push events to dev branch, not on PR events if: github.event_name == 'push' && github.ref == 'refs/heads/dev' strategy: @@ -77,12 +75,6 @@ jobs: with: submodules: recursive - # Install the Foundry toolchain. - - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@v1 - with: - version: stable - # Build the project and display contract sizes. - name: "Forge Build" run: | @@ -104,18 +96,14 @@ jobs: storage-diff: name: Test (Storage) runs-on: protocol-x64-16core + container: + image: ghcr.io/foundry-rs/foundry:stable steps: # Check out repository with all submodules for complete codebase access. - uses: actions/checkout@v4 with: submodules: recursive - # Install the Foundry toolchain. - - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@v1 - with: - version: stable - # Run storage diff check to detect storage layout incompatibilities. - name: "Mainnet Storage Diff" run: | @@ -129,6 +117,8 @@ jobs: run-coverage: name: Coverage runs-on: protocol-x64-16core + container: + image: ghcr.io/foundry-rs/foundry:stable # Only run coverage checks on dev, testnet-holesky, and mainnet branches, or PRs targeting these branches if: | github.ref == 'refs/heads/dev' || @@ -145,12 +135,6 @@ jobs: with: submodules: recursive - # Install the Foundry toolchain. - - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@v1 - with: - version: stable - # Install LCOV for coverage report generation. - name: Install LCOV run: | @@ -209,18 +193,14 @@ jobs: compare-contract-sizes: name: Size Diff runs-on: protocol-x64-16core + container: + image: ghcr.io/foundry-rs/foundry:stable steps: # Check out repository with all submodules for complete codebase access. - uses: actions/checkout@v4 with: submodules: recursive - # Install the Foundry toolchain. - - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@v1 - with: - version: stable - - name: Build contracts on PR branch run: | forge build --json --sizes | jq '.' > pr_sizes.json