BM-423: Add CI #6
Workflow file for this run
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 | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RUST_BACKTRACE: "1" | |
jobs: | |
# see: https://github.com/orgs/community/discussions/26822 | |
main-status-check: | |
if: always() | |
needs: | |
- test | |
- lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all job status | |
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- name: checkout dummy commit (submodule bug workaround) | |
run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: install foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: install rust | |
uses: risc0/risc0/.github/actions/[email protected] | |
with: | |
toolchain: '1.81' | |
- name: install cargo-binstall | |
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 | |
with: | |
crate: cargo-binstall | |
version: '=1.10.8' | |
locked: true | |
- name: install r0vm | |
run: cargo binstall -y --force [email protected] | |
- name: install risc0 toolchain | |
run: cargo risczero install --version r0.1.81.0 | |
- name: cargo build | |
run: cargo build | |
- name: forge build | |
run: forge build | |
- name: cargo test | |
run: cargo test | |
- name: forge test | |
run: forge test -vvv | |
env: | |
RISC0_DEV_MODE: "true" | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
with: | |
# Full history is required by license-check.py | |
fetch-depth: 0 | |
submodules: recursive | |
- name: install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: install foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: install rust | |
uses: risc0/risc0/.github/actions/[email protected] | |
with: | |
toolchain: '1.81' | |
- name: install cargo-sort | |
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 | |
with: | |
crate: cargo-sort | |
version: "=1.0.9" | |
locked: true | |
- name: install cargo-binstall | |
uses: baptiste0928/cargo-install@904927dbe77864e0f2281519fe9d5bd097a220b3 | |
with: | |
crate: cargo-binstall | |
version: '=1.10.8' | |
locked: true | |
- name: install dprint | |
run: cargo binstall -y --force [email protected] | |
- name: dprint check | |
run: dprint check | |
- name: cargo Sort | |
run: cargo sort --workspace --check | |
- name: cargo format | |
run: cargo fmt --all -- --check | |
- name: lint guest rust code | |
working-directory: guests/is-even | |
run: cargo fmt --all --check | |
- name: license check | |
run: python license-check.py | |
- name: check for "D0 NOT MERGE" comments | |
run: | | |
[ "$(grep -re 'DO[_ ]\?NOT[_ ]\?MERGE' $(git ls-tree --full-tree --name-only -r HEAD) | tee /dev/fd/2 | wc -l)" -eq "0" ] | |
- name: cargo clippy | |
run: cargo clippy --workspace --all-targets --all-features | |
env: | |
RUSTFLAGS: -Dwarnings | |
RISC0_SKIP_BUILD: true | |
RISC0_SKIP_BUILD_KERNEL: true, | |
- name: forge fmt | |
run: forge fmt --check |