Merge pull request #294 from eonian-core/ssolovyev/aave-strategy-for-bsc #705
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
name: Verify Smart Contracts | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
- development | |
pull_request: | |
branches: | |
- main | |
- staging | |
- development | |
types: | |
- opened | |
- synchronize | |
env: | |
BSC_MAINNET_RPC_URL: ${{ vars.BSC_MAINNET_RPC_URL }} | |
SMART_CONTRACTS_LICENSE_TYPE: "GNU AGPLv3" | |
jobs: | |
lint: | |
name: Lint contracts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Lint code | |
run: |- | |
cd packages/contracts | |
yarn solhint 'src/**/*.sol' -w 0 | |
- name: Check license type | |
run: |- | |
cd packages/contracts | |
yarn lint:license | |
check-vulnerabilities: | |
name: Check vulnerabilities | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Run forge install | |
run: |- | |
cd packages/contracts | |
forge install | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Check for vulnerabilities | |
uses: crytic/slither-action@v0.4.0 | |
id: slither | |
with: | |
fail-on: none | |
target: packages/contracts/src | |
slither-args: --include-paths=src/ --checklist --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/ --exclude-dependencies --exclude-informational --exclude-low --exclude-medium --solc-remaps="@openzeppelin=packages/contracts/node_modules/@openzeppelin solmate=packages/contracts/lib/solmate/src" | |
- name: Create/update checklist as PR comment | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' | |
env: | |
REPORT: ${{ steps.slither.outputs.stdout }} | |
with: | |
script: | | |
const script = require('.github/scripts/comment') | |
const header = '# Slither analysis report' | |
const body = process.env.REPORT | |
await script({ github, context, header, body }) | |
unit-test: | |
name: Unit Test Contracts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-e15e33a07c0920189fc336391f538c3dad53da73 # https://github.com/foundry-rs/foundry/releases/tag/nightly-e15e33a07c0920189fc336391f538c3dad53da73 | |
# Need for hardhat scripts | |
- name: Link packages | |
run: yarn | |
- name: Run tests (foundry) | |
run: |- | |
cd packages/contracts | |
FOUNDRY_FUZZ_RUNS=1000 forge test -vvv --gas-report | |
integration-test: | |
name: Integration Test Contracts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-e15e33a07c0920189fc336391f538c3dad53da73 # https://github.com/foundry-rs/foundry/releases/tag/nightly-e15e33a07c0920189fc336391f538c3dad53da73 | |
# Need for hardhat scripts | |
- name: Link packages | |
run: yarn | |
- name: Run tests | |
env: | |
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} | |
run: |- | |
cd packages/contracts | |
USE_BSC_FORK=true yarn test:hardhat:bsc | |
deploy-test: | |
name: Integration Test Deploy Logic | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-e15e33a07c0920189fc336391f538c3dad53da73 # https://github.com/foundry-rs/foundry/releases/tag/nightly-e15e33a07c0920189fc336391f538c3dad53da73 | |
# Need for hardhat scripts | |
- name: Link packages | |
run: yarn | |
- name: Run tests | |
env: | |
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} | |
run: |- | |
cd packages/contracts | |
yarn test:hardhat:deploy | |