Skip to content

Feat/governance

Feat/governance #606

Workflow file for this run

name: "CI"
env:
FOUNDRY_PROFILE: "ci"
on:
workflow_dispatch:
pull_request:
branches:
- "main"
- "feature/**"
- "feat/**"
- "develop"
push:
branches:
- "main"
- "develop"
jobs:
slither:
name: Slither
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "onbjerg/foundry-toolchain@v1"
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Build the contracts"
run: |
forge build --skip test --skip script --build-info
- name: Run Slither
uses: crytic/[email protected]
id: slither
with:
ignore-compile: true
sarif: results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
check_storage_layout:
name: Check storage layout
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
contract:
- contracts/legacy/ReserveSpenderMultiSig.sol:ReserveSpenderMultiSig
- contracts/legacy/StableToken.sol:StableToken
- contracts/legacy/Exchange.sol:Exchange
- contracts/legacy/GrandaMento.sol:GrandaMento
- contracts/swap/Broker.sol:Broker
- contracts/swap/BiPoolManager.sol:BiPoolManager
- contracts/swap/Reserve.sol:Reserve
- contracts/oracles/BreakerBox.sol:BreakerBox
- contracts/oracles/SortedOracles.sol:SortedOracles
- contracts/tokens/StableTokenV2.sol:StableTokenV2
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: Check storage layout
uses: Rubilmax/[email protected]
with:
contract: ${{ matrix.contract }}
get_echidna_test_names:
name: Get Echidna test names
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Generate matrix with all test names from the test/echidna directory
id: set-matrix
run: |
echo "::set-output name=matrix::$(ls test/echidna | sed 's/.sol//' | jq -R -s -c 'split("\n")[:-1]')"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run_echidna_tests:
needs: get_echidna_test_names
name: Run echidna tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
contract: ${{ fromJson(needs.get_echidna_test_names.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Build for echidna"
run: yarn forge:build:slither
- name: "Run Echidna"
uses: crytic/echidna-action@v2
with:
files: test/echidna/${{ matrix.contract }}.sol
solc-version: 0.5.17
contract: ${{ matrix.contract }}
config: echidna.yaml
test-mode: assertion
ci:
name: Lint & Test
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"
- name: "Install Foundry"
uses: "onbjerg/foundry-toolchain@v1"
with:
version: "nightly-d369d2486f85576eec4ca41d277391dfdae21ba7"
- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "yarn"
node-version: "16"
- name: "Install the Node.js dependencies"
run: "yarn install --immutable"
- name: "Lint the contracts"
run: "yarn lint:check"
- name: "Add lint summary"
run: |
echo "## Lint" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Show the Foundry config"
run: "forge config"
- name: "Run the tests"
run: "forge test"
- name: "Build the contracts"
run: |
forge --version
forge build --sizes
- name: "Add test summary"
run: |
echo "## Tests" >> $GITHUB_STEP_SUMMARY