Skip to content

Commit

Permalink
Install dependencies with Node.js instead of git modules (#734)
Browse files Browse the repository at this point in the history
* build: install deps only with Node.js

build: remove .gitmodules
build: remove lib dir
build: include test/utils in files published
docs: specify recommended installation method on README
chore: update remappings accordingly
ci: install deps with pnpm install and remove "recursive"

* feat: remove re-exported types

* style: add line

* ci: install pnpm and Node.js on each job

* chore: update Slither config

* test: update Precompiles bytecode

* build: include remappings.txt file in the package

* ci: cache the node modules and re use them

* docs: improve README

* build: remove unnecessary remmapings file from package

* ci: rename cached key

ci: restore the node modules in coverage job

* ci: consistent caching keys

chore: fix formatting in CI files
chore: improve wording in CI files
ci: remove redundant "pnpm install" steps

* build: set peer dep version to "4.0.x"

---------

Co-authored-by: Paul Razvan Berg <paul.razvan.berg@gmail.com>
  • Loading branch information
andreivladbrg and PaulRBerg committed Dec 15, 2023
1 parent 02c8774 commit a1e36f7
Show file tree
Hide file tree
Showing 36 changed files with 507 additions and 247 deletions.
53 changes: 31 additions & 22 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,40 @@ 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"

- name: "Show the Foundry config"
run: "forge config"

- name: "Produce an optimized build with --via-ir"
run: "FOUNDRY_PROFILE=optimized forge build"

- name: "Build the test contracts"
run: "FOUNDRY_PROFILE=test-optimized forge build"
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
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 the 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 @@ -137,19 +149,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 the 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 @@ -170,19 +181,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 the 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 @@ -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 the 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 @@ -224,4 +233,4 @@ jobs:
- name: "Add test summary"
run: |
echo "## Fork tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
82 changes: 54 additions & 28 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 All @@ -78,16 +76,17 @@ jobs:

- name: "Generate and prepare the contract artifacts"
run: "./shell/prepare-artifacts.sh"

- 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
Expand All @@ -109,19 +108,29 @@ 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: "Restore the cached build and the 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 +150,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 the 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 +179,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 the 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,19 +208,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 the 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 @@ -233,19 +239,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 the 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 @@ -267,12 +272,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 the 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 +310,20 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
submodules: "recursive"
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: "Run Slither analysis"
uses: "crytic/slither-action@v0.3.0"
Expand Down
24 changes: 0 additions & 24 deletions .gitmodules

This file was deleted.

Loading

0 comments on commit a1e36f7

Please sign in to comment.