ZIR-303: Optimize bootstrap, add CI for generated files #593
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: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# this is needed to gain access via OIDC to the S3 bucket for caching | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Full history is required by license-check.py | |
fetch-depth: 0 | |
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9 | |
- name: Install cargo-sort | |
uses: risc0/cargo-install@v1 | |
with: | |
crate: cargo-sort | |
version: "1.0" | |
- run: cargo fmt --all -- --check | |
- run: cargo fmt --manifest-path zirgen/bootstrap/Cargo.toml -- --check | |
- run: cargo sort --workspace --check | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- run: python license-check.py | |
check-generated-zirgen: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
circuit: [fib, calculator] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/bazel-cache | |
- uses: ./.github/actions/bazelisk | |
- name: ${{ matrix.circuit }} generated files up to date | |
run: cargo bootstrap --check ${{ matrix.circuit }} | |
bazel: | |
runs-on: [self-hosted, prod, cpu, "${{ matrix.os }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Linux, macOS] | |
include: | |
- os: Linux | |
config: --config=ci | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/bazelisk | |
- name: Build & test | |
env: | |
CONFIG: ${{ matrix.config }} | |
run: bazelisk test //... $CONFIG | |
test: | |
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.arch }}", "${{ matrix.device }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: Linux | |
arch: X64 | |
feature: default | |
device: cpu | |
- os: Linux | |
arch: X64 | |
feature: cuda | |
device: nvidia_rtx_a5000 | |
- os: macOS | |
arch: ARM64 | |
feature: default | |
device: apple_m2_pro | |
env: | |
FEATURE: ${{ matrix.feature }} | |
RISC0_BUILD_LOCKED: 1 | |
RUST_BACKTRACE: full | |
steps: | |
- uses: actions/checkout@v3 | |
- if: matrix.feature == 'cuda' | |
uses: ./.github/actions/cuda | |
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9 | |
- uses: risc0/risc0/.github/actions/sccache@1a373c71585766e4f6985b96c48389daaf69d528 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- run: | | |
curl -L https://risczero.com/install | bash | |
echo "$HOME/.risc0/bin" >> $GITHUB_PATH | |
shell: bash | |
- run: rzup install rust | |
- run: cargo test --locked -F $FEATURE | |
- run: cargo check --benches | |
- run: cargo check --manifest-path zirgen/bootstrap/Cargo.toml | |
- run: sccache --show-stats | |
doc: | |
runs-on: [self-hosted, prod, Linux, cpu] | |
env: | |
RUST_BACKTRACE: full | |
RISC0_BUILD_LOCKED: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: risc0/risc0/.github/actions/rustup@4ab1f0bba1b0515819221bebc59f95aad0a6a3a9 | |
- uses: risc0/risc0/.github/actions/sccache@1a373c71585766e4f6985b96c48389daaf69d528 | |
- run: | | |
curl -L https://risczero.com/install | bash | |
echo "$HOME/.risc0/bin" >> $GITHUB_PATH | |
shell: bash | |
- run: rzup install rust | |
- run: cargo doc --no-deps --workspace | |
- run: sccache --show-stats | |
# see: https://github.com/orgs/community/discussions/26822 | |
main-status-check: | |
if: always() | |
needs: | |
- check | |
- bazel | |
- test | |
- doc | |
- check-generated-zirgen | |
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 |