Refactor scripts #534
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: test | |
on: | |
- workflow_dispatch | |
- push | |
env: | |
FOUNDRY_PROFILE: ci | |
FORK_RPC_URL_MAINNET: ${{ secrets.FORK_RPC_URL_MAINNET }} | |
FORK_RPC_URL_OPTIMISM: ${{ secrets.FORK_RPC_URL_OPTIMISM }} | |
FORK_RPC_URL_POLYGON: ${{ secrets.FORK_RPC_URL_POLYGON }} | |
jobs: | |
lint: | |
name: Foundry Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
id: init | |
- name: Run Forge fmt src | |
run: | | |
forge fmt --check ./src | |
id: fmt_src | |
if: ${{ steps.init.conclusion == 'success' }} | |
- name: Run Forge fmt test | |
run: | | |
forge fmt --check ./test | |
id: fmt_test | |
if: ${{ steps.init.conclusion == 'success' }} | |
- name: Run Forge fmt script | |
run: | | |
forge fmt --check ./script | |
id: fmt_deploy | |
if: ${{ steps.init.conclusion == 'success' }} | |
test: | |
name: Foundry Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/cache@v3 | |
with: | |
path: "~/.foundry/cache/rpc" | |
key: "${{ runner.os }}-rpc-cache-v1" | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Run Forge build | |
run: | | |
forge --version | |
forge build --sizes | |
id: build | |
- name: Run Forge tests | |
run: | | |
forge test -vvv | |
id: test | |
coverage: | |
name: Foundry Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/cache@v3 | |
with: | |
path: "~/.foundry/cache/rpc" | |
key: "${{ runner.os }}-rpc-cache-v1" | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Run Forge build | |
run: | | |
forge --version | |
forge build --sizes | |
id: build | |
- name: Run Forge coverage | |
run: | | |
forge coverage -vvv --report lcov --report summary | |
id: coverage | |
- name: Sanitize lcov report | |
run: | | |
sudo apt install lcov | |
lcov --remove ./lcov.info -o ./clean_lcov.info 'test/*' 'script/*' 'src/zkbob/verifiers/*' | |
lcov --list clean_lcov.info | |
- name: Report code coverage | |
uses: zgosalvez/github-actions-report-lcov@v2 | |
with: | |
coverage-files: ./clean_lcov.info | |
artifact-name: solidity-coverage-report | |
working-directory: ./ |