-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57ffa36
commit b98a470
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Ethernaut cli CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} | ||
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
cache-key: ${{ steps.cache-dependencies.outputs.cache-key }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.x' | ||
cache: 'npm' | ||
- name: Install npm dependencies | ||
run: npm ci | ||
- name: Cache npm dependencies | ||
id: cache-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
**/node_modules | ||
!**/node_modules/.cache | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
|
||
common: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Node.js with cache | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.x' | ||
- run: npm run build --if-present | ||
- run: npm run compile --if-present | ||
- run: cd packages/common && npm t | ||
|
||
# Repeat the pattern for other jobs, like ethernaut-toolbox, ethernaut-ui, etc. | ||
# Make sure to remove redundant npm ci steps and add 'needs: setup' to ensure they run after the setup job | ||
|
||
install-foundry: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
id: foundry-install | ||
- name: Cache Foundry | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.foundry | ||
~/.cargo/bin/foundry | ||
key: ${{ runner.os }}-foundry-${{ github.sha }} | ||
|
||
# For jobs that require Foundry, make them depend on 'install-foundry' and adjust steps accordingly. | ||
# Example for a job requiring Foundry: | ||
|
||
ethernaut-interact: | ||
needs: [setup, install-foundry] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Node.js with cache | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.x' | ||
- run: npm run build --if-present | ||
- run: npm run compile --if-present | ||
- name: Start local chain | ||
run: | | ||
npm run chain & | ||
sleep 5 | ||
- run: cd packages/ethernaut-interact && npm t | ||
|
||
# Adjust other jobs similarly, ensuring they 'need' either setup or both setup and install-foundry as appropriate. |