Skip to content

Commit

Permalink
Add github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
evercoinx committed Aug 29, 2024
1 parent ad73c22 commit f425179
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI
on:
workflow_dispatch:
push:
branches:
- "**"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["20.15.x"]
python-version: ["3.12"]
solidity-version: ["0.8.7"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true
cache: pip

- name: Install node dependencies
run: npm ci

- name: Install python dependencies
run: |
pip install -U pip setuptools
pip install -q -r requirements.txt
- name: Configure solidity compiler
run: |
solc-select install ${{ matrix.solidity-version }}
solc-select use ${{ matrix.solidity-version }}
- name: Clean artifacts
run: npm run clean

- name: Compile contracts
run: npm run compile

- name: Lint code
run: npm run lint

- name: Check contracts with linter
run: npm run check

# - name: Analyze contracts with static analyzer
# run: npm run analyze:ci

- name: Run unit tests
run: npm run test:ci

- name: Save contract artifacts
uses: actions/upload-artifact@v4
with:
name: contracts
path: |
artifacts/contracts/
!artifacts/contracts/**/*.dbg.json
!artifacts/contracts/interfaces/
!artifacts/contracts/lib/
!artifacts/contracts/mocks/
!artifacts/contracts/state-transfer/
!artifacts/contracts/tunnel/
retention-days: 30
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"check": "hardhat check",
"test": "hardhat test --bail",
"test:ci": "hardhat test --parallel",
"analyze": "slitherin . --separated",
"analyze": "slitherin . --slither",
"analyze:ci": "slitherin --separated . --skip-clean --ignore-compile",
"clean": "hardhat clean",
"node": "hardat node",
"deploy:main": "cross-env NODE_ENV=main hardhat run ./scripts/deploy.ts --network mainnet",
"deploy:test": "cross-env NODE_ENV=test hardhat run ./scripts/deploy.ts --network testnet",
Expand Down

0 comments on commit f425179

Please sign in to comment.