Skip to content

Commit

Permalink
ci: cache build and node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedali8 committed Jan 5, 2024
1 parent 51c3c45 commit 139d561
Showing 1 changed file with 57 additions and 34 deletions.
91 changes: 57 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
Expand All @@ -74,6 +74,17 @@ jobs:
forge --version
forge build --sizes
- name: "Cache the build and the node modules so that they can be re-used by the other jobs"
uses: "actions/cache/save@v3"
with:
key: "build-and-modules-${{ github.sha }}"
path: |
artifacts
cache_hardhat
cache
node_modules
out
- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
Expand All @@ -90,17 +101,20 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
cache: "yarn"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable --inline-builds"
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
artifacts
cache_hardhat
cache
node_modules
out
- name: "Run Hardhat tests"
run: "yarn test"
Expand All @@ -121,17 +135,20 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
cache: "yarn"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable --inline-builds"
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
artifacts
cache_hardhat
cache
node_modules
out
- name: "Show the Foundry config"
run: "forge config"
Expand Down Expand Up @@ -161,17 +178,20 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
cache: "yarn"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable --inline-builds"
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
artifacts
cache_hardhat
cache
node_modules
out
- name: "Generate the TypeChain bindings"
run: "yarn typechain"
Expand All @@ -195,17 +215,20 @@ jobs:
with:
submodules: "recursive"

- name: "Install Foundry and restore the RPC cache, if any"
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
- name: "Restore the cached build and the node modules"
uses: "actions/cache/restore@v3"
with:
cache: "yarn"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "yarn install --immutable --inline-builds"
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
artifacts
cache_hardhat
cache
node_modules
out
- name: "Run coverage with lcov output"
run: "forge coverage --report lcov"
Expand Down

0 comments on commit 139d561

Please sign in to comment.