Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install dependencies with Node.js instead of git modules #734

Merged
merged 13 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,24 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
- name: "Show the Foundry config"
run: "forge config"

Expand All @@ -89,9 +101,10 @@ jobs:
key: "foundry-build-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
Expand All @@ -105,19 +118,18 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

Expand All @@ -137,22 +149,21 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
- name: "Run the integration tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/integration/**/*.sol\""

Expand All @@ -170,22 +181,21 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
- name: "Run the invariant tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/invariant/**/*.sol\""

Expand All @@ -202,19 +212,18 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

Expand Down
90 changes: 61 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down Expand Up @@ -82,15 +80,19 @@ jobs:
- name: "Build the test contracts"
run: "FOUNDRY_PROFILE=test-optimized forge build"

- name: "Cache the build so that it can be re-used by the other jobs"
- 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: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Store the contract artifacts in CI"
uses: "actions/upload-artifact@v3"
with:
Expand All @@ -109,19 +111,32 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

Expand All @@ -141,19 +156,18 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

Expand All @@ -171,19 +185,18 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

Expand All @@ -201,22 +214,21 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

- name: "Run the invariant tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/invariant/**/*.sol\""

Expand All @@ -233,22 +245,21 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

- name: "Generate fuzz seed that changes weekly to avoid burning through RPC allowance"
run: |
echo "FOUNDRY_FUZZ_SEED=$(echo $(($EPOCHSECONDS / 604800)))" >> $GITHUB_ENV
Expand All @@ -267,12 +278,21 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build and node modules"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "build-and-modules-${{ github.sha }}"
path: |
cache
node_modules
out
out-optimized

- name: "Generate the coverage report using the unit and the integration tests"
run: "forge coverage --match-path \"test/{unit,integration}/**/*.sol\" --report lcov"

Expand All @@ -296,8 +316,20 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
submodules: "recursive"
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"
Comment on lines +325 to +326
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is now redundant given that we are caching node_modules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the slither-analyze job is going to be removed from ci.yml and we will need the pnpm installin its own file, see #726

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine. In this case, it doesn't really matter what we do here - can you keep my latest commit as is, please?


- name: "Run Slither analysis"
uses: "crytic/[email protected]"
Expand Down
24 changes: 0 additions & 24 deletions .gitmodules

This file was deleted.

Loading