Skip to content

Commit

Permalink
CI Build speed optimizations (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy authored Jul 19, 2024
1 parent f974f09 commit 413089e
Showing 1 changed file with 75 additions and 85 deletions.
160 changes: 75 additions & 85 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,41 @@ jobs:
uses: foundry-rs/[email protected]

- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: actions/checkout@v3

- uses: pnpm/action-setup@v3

- uses: Swatinem/rust-cache@v2
- name: Run cargo build
run: |
cargo build
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Make
- name: Submodule init
run: |
make
- name: Install pnpm dependencies for ccip contracts and come out
run: |
cd tests/ccip-contracts/
pnpm install
cd contracts/
pnpm install
cd ../../../
- name: Run cargo build
run: |
cargo build
git submodule update --init --recursive
- uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: |
cargo test _by_loading_contract_directly
- uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: |
cargo test -- --nocapture
Expand All @@ -96,6 +91,15 @@ jobs:
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2
- name: Run cargo build
run: |
cargo build
- name: Submodule init
run: |
git submodule update --init --recursive
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
Expand All @@ -107,55 +111,54 @@ jobs:
with:
version: 8

- name: Make
run: |
make
- name: Install pnpm dependencies for ccip contracts and come out
run: |
cd tests/ccip-contracts/
pnpm install
cd contracts/
pnpm install
cd ../../../
# Verify report.md

- name: Generate report-workflow.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/report-workflow.md --src src/ ./tests/contract-playground/ --skip-update-check
- uses: Swatinem/rust-cache@v2
- name: Generate report-workflow.m
run: |
cargo run -- -o ./reports/report-workflow.md --src src/ ./tests/contract-playground/ --skip-update-check
- name: Check report.md vs report-workflow.md
run: |
cat ./reports/report-workflow.md
diff ./reports/report.md ./reports/report-workflow.md
# Verify uniswap_profile.md

- name: Generate uniswap_profile-workflow.md
env:
FOUNDRY_PROFILE: uniswap
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/uniswap_profile-workflow.md ./tests/contract-playground/ --skip-update-check
FOUNDRY_PROFILE: uniswap
run: |
cargo run -- -o ./reports/uniswap_profile-workflow.md ./tests/contract-playground/ --skip-update-check
- name: Check uniswap_profile.md vs uniswap_profile-workflow.md
run: |
cat reports/uniswap_profile-workflow.md
diff reports/uniswap_profile.md reports/uniswap_profile-workflow.md
# Install javascript dependencies

- uses: bahmutov/npm-install@v1
with:
useLockFile: false
working-directory: tests/2024-05-Sablier/v2-core

- uses: bahmutov/npm-install@v1
with:
useLockFile: false
working-directory: tests/2024-07-templegold/

- uses: bahmutov/npm-install@v1
with:
useLockFile: false
working-directory: tests/prb-math/

# Verify sablier.md


- name: Generate sablier.md
env:
FOUNDRY_PROFILE: uniswap
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/sablier.md ./tests/2024-05-Sablier --skip-update-check
run: |
cargo run -- -o ./reports/sablier.md ./tests/2024-05-Sablier --skip-update-check
- name: Check sablier.md vs sablier-aderyn-toml-nested-root.md
run: |
Expand All @@ -164,11 +167,10 @@ jobs:
# Verify adhoc-sol-files-workflow-report.md


- name: Generate adhoc-sol-files-workflow-report.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/adhoc-sol-files-report-workflow.md ./tests/adhoc-sol-files --skip-update-check
run: |
cargo run -- -o ./reports/adhoc-sol-files-report-workflow.md ./tests/adhoc-sol-files --skip-update-check
- name: Check adhoc-sol-files-report.md vs adhoc-sol-files-report-workflow.md
run: |
Expand All @@ -177,11 +179,10 @@ jobs:
# Verify foundry-nft-f23.md


- name: Generate nft-workflow-report.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/nft-workflow-report.md --src src/ ./tests/foundry-nft-f23 --skip-update-check
run: |
cargo run -- -o ./reports/nft-workflow-report.md --src src/ ./tests/foundry-nft-f23 --skip-update-check
- name: Check nft-workflow-report.md vs nft-report.md
run: |
Expand All @@ -190,12 +191,10 @@ jobs:
# Verify ccip-functions-report.md

- name: Generate ccip-functions-report-workflow.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o reports/ccip-functions-report-workflow.md tests/ccip-contracts/contracts --src src/v0.8/functions/ -x "tests/,test/,mocks/" --skip-update-check
run: |
cargo run -- -o reports/ccip-functions-report-workflow.md tests/ccip-contracts/contracts --src src/v0.8/functions/ -x "tests/,test/,mocks/" --skip-update-check
- name: Check ccip-functions-report-workflow.md vs ccip-functions-report.md
run: |
Expand All @@ -204,24 +203,20 @@ jobs:
# Verify prb-math-report.md (new solidity features)

- name: Generate ccip-functions-report-workflow.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- ./tests/prb-math -o ./reports/prb-math-report-workflow.md --skip-update-check
run: |
cargo run -- ./tests/prb-math -o ./reports/prb-math-report-workflow.md --skip-update-check
- name: Check prb-math-report.md vs prb-math-report-workflow.md
run: |
cat ./reports/prb-math-report-workflow.md
diff ./reports/prb-math-report.md ./reports/prb-math-report-workflow.md

- name: Generate 2024-07-templegold-report-workflow.md
uses: actions-rs/cargo@v1
with:
command: run
args: -- ./tests/2024-07-templegold/protocol -o ./reports/2024-07-templegold-report-workflow.md --skip-update-check
run: |
cargo run -- ./tests/2024-07-templegold/protocol -o ./reports/2024-07-templegold-report-workflow.md --skip-update-check
- name: Check 2024-07-templegold-report.md vs 2024-07-templegold-report-workflow.md
run: |
Expand All @@ -230,12 +225,10 @@ jobs:
# Verify report.json

- name: Generate report-workflow.json
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/report-workflow.json -i src/ -x lib/ ./tests/contract-playground/ --skip-update-check
run: |
cargo run -- -o ./reports/report-workflow.json -i src/ -x lib/ ./tests/contract-playground/ --skip-update-check
- name: Check report.json vs report-workflow.json
run: |
Expand All @@ -244,11 +237,10 @@ jobs:
# Verify adhoc sol files (Highs Only) report.json


- name: Generate report-workflow.json
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/adhoc-sol-files-highs-only-report-workflow.json ./tests/adhoc-sol-files --skip-update-check --highs-only
run: |
cargo run -- -o ./reports/adhoc-sol-files-highs-only-report-workflow.json ./tests/adhoc-sol-files --skip-update-check --highs-only
- name: Check report.json vs report-workflow.json
run: |
Expand All @@ -258,10 +250,8 @@ jobs:
# Verify sarif report

- name: Generate sarif report
uses: actions-rs/cargo@v1
with:
command: run
args: -- -o ./reports/ci-report.sarif ./tests/contract-playground/ --skip-update-check
run: |
cargo run -- -o ./reports/ci-report.sarif ./tests/contract-playground/ --skip-update-check
- name: Check sarif report
run: |
Expand Down

0 comments on commit 413089e

Please sign in to comment.