Skip to content

Commit

Permalink
chore: Manage Forge dependencies as NPM packages (the Hardhat way) (#592
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alainncls authored Apr 22, 2024
1 parent 70a641d commit 2b104ff
Show file tree
Hide file tree
Showing 67 changed files with 1,446 additions and 1,585 deletions.
126 changes: 121 additions & 5 deletions .github/workflows/smart-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ jobs:
with:
submodules: recursive

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

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

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

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

Expand Down Expand Up @@ -61,6 +89,34 @@ jobs:
with:
submodules: recursive

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

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

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

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

Expand All @@ -83,6 +139,34 @@ jobs:
with:
submodules: recursive

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

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

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

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

Expand All @@ -104,7 +188,7 @@ jobs:
uses: terencetcf/github-actions-lcov-minimum-coverage-checker@v1
with:
coverage-file: lcov.info
minimum-coverage: 96
minimum-coverage: 95

- name: Add coverage summary
run: |
Expand Down Expand Up @@ -164,6 +248,38 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install Pnpm
if: steps.check-changes.outputs.changed == 'true'
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install Node.js
if: steps.check-changes.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Get pnpm store directory
if: steps.check-changes.outputs.changed == 'true'
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
if: steps.check-changes.outputs.changed == 'true'
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
if: steps.check-changes.outputs.changed == 'true'
run: pnpm install --frozen-lockfile
Expand Down Expand Up @@ -197,16 +313,16 @@ jobs:
if: steps.check-changes.outputs.changed == 'true'
run: pnpm run check:upgradeability linea

- name: Create Arbitrum testnet env file
- name: Create Arbitrum Sepolia env file
if: steps.check-changes.outputs.changed == 'true'
run: |
rm .env
cp ./env/.env.arbitrum-goerli .env
cp ./env/.env.arbitrum-sepolia .env
echo INFURA_KEY=${{ secrets.INFURA_KEY }} >> .env
- name: Check contracts upgradeability on Arbitrum testnet
- name: Check contracts upgradeability on Arbitrum Sepolia
if: steps.check-changes.outputs.changed == 'true'
run: pnpm run check:upgradeability arbitrum-goerli
run: pnpm run check:upgradeability arbitrum-sepolia

- name: Create Arbitrum mainnet env file
if: steps.check-changes.outputs.changed == 'true'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ node_modules
lcov.info
coverage

# Hardhat
# Contarcts
cache_hardhat
cache_forge
artifacts
typechain-types

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build
.graphclient
snap
dist
cache_forge

# files
*.env
Expand Down
9 changes: 9 additions & 0 deletions contracts/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.openzeppelin
deployments
env
script
test
.env
foundry.toml
hardhat.config.ts
tsconfig.json
Loading

0 comments on commit 2b104ff

Please sign in to comment.