Skip to content

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
env:
# Etherscan API keys.
ARBISCAN_API_KEY: ${{ secrets.ARBISCAN_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} # Mainnet.
OPTIMISTIC_ETHERSCAN_API_KEY: ${{ secrets.OPTIMISTIC_ETHERSCAN_API_KEY }}
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
# Other.
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
ARBITRUM_ONE_RPC_URL: ${{ secrets.ARBITRUM_ONE_RPC_URL }}
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
FOUNDRY_PROFILE: ci
INFURA_ID: ${{ secrets.INFURA_ID }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn install --network-concurrency 1
- run: yarn build
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn install --network-concurrency 1
- name: Run tests
run: yarn test
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn install
- name: Run coverage
run: yarn coverage
- name: Merge directories
run: |
sudo apt update && sudo apt install -y lcov
lcov \
--add-tracefile ./contracts-periphery/lcov.info \
--add-tracefile ./umbra-js/coverage/lcov.info \
--output-file lcov.info \
--rc lcov_branch_coverage=1
# To ignore coverage for certain directories modify the paths in this step as needed.
# Alternatively, to include coverage in all directories, comment out this step.
- name: Filter directories
run: |
lcov --remove ./lcov.info 'contracts-periphery/test/*' 'contracts-periphery/script/*' \
--output-file lcov.info \
--rc lcov_branch_coverage=1
# This step posts a detailed coverage report as a comment and deletes previous comments on
# each push. The below step is used to fail coverage if the specified coverage threshold is
# not met. The below step can post a comment (when it's `github-token` is specified) but it's
# not as useful, and this action cannot fail CI based on a minimum coverage threshold, which
# is why we use both in this way.
- name: Post coverage report
if: github.event_name == 'pull_request' # This action fails when ran outside of a pull request.
uses: romeovs/[email protected]
with:
delete-old-comments: true
lcov-file: ./lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }} # Adds a coverage summary comment to the PR.
- name: Verify minimum coverage
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: ./lcov.info
minimum-coverage: 70 # Set coverage threshold.
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Install scopelint
uses: engineerd/[email protected]
with:
name: scopelint
repo: ScopeLift/scopelint
fromGitHubReleases: true
version: latest
pathInArchive: scopelint-x86_64-linux/scopelint
urlTemplate: https://github.com/ScopeLift/scopelint/releases/download/{{version}}/scopelint-x86_64-linux.tar.xz
token: ${{ secrets.GITHUB_TOKEN }}
- run: yarn install
- name: Run yarn lint
run: yarn lint
- name: Run scopelint
run: |
cd contracts-periphery
scopelint --version
scopelint check