Skip to content

c4-tests

c4-tests #757

Workflow file for this run

name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: true
name: Foundry
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Format
run: |
forge fmt --check
id: fmt
- name: Contract sizes
run: |
forge --version
forge build --sizes --skip CryticTester
id: build
- name: Test
run: |
forge test -vvv
id: test
env:
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
slither:
strategy:
fail-fast: true
name: Slither
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Slither
uses: crytic/slither-action@v0.3.1
id: slither
with:
fail-on: low
solhint:
strategy:
fail-fast: true
name: Solhint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: npm install
- name: Run solhint
run: npm run solhint
invariants:
needs: [test, slither, solhint]
strategy:
matrix:
mode: [assertion, property]
name: Echidna
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Crytic-compile
run: |
pip install crytic-compile
- name: Install Slither
run: |
pip install slither-analyzer
- name: Install Echidna
run: |
wget https://github.com/crytic/echidna/releases/download/v2.2.3/echidna-2.2.3-x86_64-linux.tar.gz -O echidna.tar.gz
tar -xvkf echidna.tar.gz
rm echidna.tar.gz
./echidna --version
- name: Echidna ${{ matrix.mode }}
run: |
./script/prepare_crytic.sh
./echidna . --contract CryticTester --config echidna.yaml --test-mode ${{ matrix.mode }} --corpus-dir corpus --test-limit 10000
abi-coverage:
strategy:
fail-fast: true
name: ABI/Coverage
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install dependencies
run: npm install
- name: Setup git config
run: |
git config --local user.email "dev@size.cash"
git config --local user.name "Size"
- name: Coverage
run: |
./script/update_readme_coverage.sh
git add README.md
git commit -m "Update coverage [skip ci]" || true
- name: ABI
run: |
forge build --build-info
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: abi
path: |
out/Size.sol/Size.json
out/PriceFeed.sol/PriceFeed.json
out/VariablePoolBorrowRateFeed.sol/VariablePoolBorrowRateFeed.json
out/PoolMock.sol/PoolMock.json
out/WETH.sol/WETH.json
out/USDC.sol/USDC.json
out/Errors.sol/Errors.json
out/Events.sol/Events.json
- name: Push
run: |
git push https://${{ env.token }}@github.com/${{ github.event.repository.full_name }}.git
env:
token: ${{ secrets.SIZE_BOT_PAT }}