build: refactor shell scripts #26
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: "CI" | |
# The workflow will run on push or pull request events but only for the main branch | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
env: | |
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | |
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} | |
FOUNDRY_PROFILE: "ci" | |
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} | |
MNEMONIC: ${{ secrets.MNEMONIC }} | |
jobs: | |
lint: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v3" | |
with: | |
submodules: "recursive" | |
- name: "Install Foundry" | |
uses: "foundry-rs/foundry-toolchain@v1" | |
- name: "Lint the code" | |
run: | | |
forge --version | |
forge fmt --check | |
compile: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v3" | |
with: | |
submodules: "recursive" | |
- name: "Install Foundry" | |
uses: "foundry-rs/foundry-toolchain@v1" | |
- name: "Compile the contracts" | |
run: | | |
forge build --sizes | |
test: | |
strategy: | |
fail-fast: true | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v3" | |
with: | |
submodules: "recursive" | |
- name: "Install Foundry" | |
uses: "foundry-rs/foundry-toolchain@v1" | |
- name: "Test the contracts" | |
run: | | |
forge test -vvv | |
slither-analyze: | |
runs-on: "ubuntu-latest" | |
permissions: | |
security-events: "write" | |
steps: | |
- name: "Check out the repo" | |
uses: "actions/checkout@v3" | |
with: | |
submodules: "recursive" | |
- name: "Run Slither" | |
uses: "crytic/slither-action@v0.3.0" | |
id: "slither" | |
with: | |
fail-on: "none" | |
sarif: "results.sarif" | |
slither-args: "--exclude naming-convention" | |
target: "contracts/" | |
- name: "Upload SARIF file" | |
uses: "github/codeql-action/upload-sarif@v2" | |
with: | |
sarif_file: ${{ steps.slither.outputs.sarif }} |