CI #2535
This file contains hidden or 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: | |
workflow_dispatch: | |
# Trigger after nightly runs to rebuild the cache | |
workflow_run: | |
workflows: [Nightly tests with the code coverage] | |
types: [completed] | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# https://doc.rust-lang.org/cargo/reference/profiles.html#release | |
RUSTFLAGS: -Coverflow-checks=y -Cdebug-assertions=y | |
# https://doc.rust-lang.org/cargo/reference/profiles.html#incremental | |
CARGO_INCREMENTAL: 1 | |
# https://nexte.st/book/pre-built-binaries.html#using-nextest-in-github-actions | |
CARGO_TERM_COLOR: always | |
# 30 MB of stack for Keccak tests | |
RUST_MIN_STACK: 31457280 | |
CARGO_EXTRA_ARGS: '--workspace' | |
jobs: | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
rust_toolchain_version: ${{ steps.rust.outputs.version }} | |
default_rust_version: ${{ fromJson(steps.rust.outputs.version)[0] }} | |
ocaml_version: ${{ steps.ocaml.outputs.version }} | |
node: ${{ steps.node.outputs.version }} | |
os: ${{ steps.os.outputs.version }} | |
default_os: ${{ fromJson(steps.os.outputs.version)[0] }} | |
steps: | |
- id: rust | |
run: echo 'version=["1.81", "1.82"]' >> "$GITHUB_OUTPUT" | |
# FIXME: currently not available for 5.0.0. | |
# It might be related to boxroot dependency, and we would need to bump | |
# up the ocaml-rs dependency | |
- id: ocaml | |
run: echo 'version=["4.14.2"]' >> "$GITHUB_OUTPUT" | |
- id: node | |
run: echo 'version=["20"]' >> "$GITHUB_OUTPUT" | |
- id: os | |
run: echo 'version=["ubuntu-latest", "ubuntu-24.04-arm"]' >> "$GITHUB_OUTPUT" | |
refresh-cache: | |
needs: ['define-matrix'] | |
strategy: | |
matrix: | |
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }} | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
# if 'workflow_run' | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'workflow_run' }} | |
- uses: ./.github/actions/toolchain-shared | |
if: ${{ github.event_name == 'workflow_run' }} | |
with: | |
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | |
- name: start-fresh | |
if: ${{ github.event_name == 'workflow_run' }} | |
shell: bash | |
run: cargo clean | |
# else | |
- name: skip-refresh | |
if: ${{ github.event_name != 'workflow_run' }} | |
shell: bash | |
run: echo 'no need to refresh' | |
doc-and-spec: | |
needs: ['define-matrix', 'refresh-cache'] | |
strategy: | |
matrix: | |
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }} | |
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} | |
node: ${{ fromJSON(needs.define-matrix.outputs.node) }} | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Use shared Rust toolchain setting up steps | |
uses: ./.github/actions/toolchain-shared | |
with: | |
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | |
- name: Use shared OCaml setting up steps | |
uses: ./.github/actions/ocaml-shared | |
with: | |
ocaml_version: ${{ matrix.ocaml_version }} | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-spec | |
- name: Install markdownlint | |
run: | | |
# FIXME: 0.39.0 makes the CI fail | |
npm install -g [email protected] | |
# | |
# Doc & Spec | |
# | |
- name: Build the kimchi specification | |
run: | | |
cd book/specifications/kimchi | |
make build | |
- name: Build the polynomial commitment specification | |
run: | | |
cd book/specifications/poly-commitment | |
make build | |
- name: Check that up-to-date specification is checked in | |
run: | | |
git diff --exit-code ":(exclude)rust-toolchain.toml" | |
- name: Doc tests | |
run: | | |
eval $(opam env) | |
make test-doc | |
- name: generate docs | |
run: | | |
eval $(opam env) | |
make generate-doc | |
# | |
# MD Book | |
# | |
- name: Build the mdbook | |
run: | | |
cd book | |
make deps | |
make build | |
# | |
# Deploy Book on push to master | |
# | |
- name: Rerun doc generation with different args and copy into book directory | |
if: >- | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version && | |
matrix.os == needs.define-matrix.outputs.default_os | |
run: | | |
eval $(opam env) | |
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all-features --no-deps --workspace --exclude xtask | |
cp -r ./target/doc ./book/book/html/rustdoc | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e | |
if: >- | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/master' && | |
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version && | |
matrix.os == needs.define-matrix.outputs.default_os | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./book/book/html | |
lint: | |
needs: ['define-matrix', 'refresh-cache'] | |
strategy: | |
matrix: | |
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }} | |
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} | |
node: ${{ fromJSON(needs.define-matrix.outputs.node) }} | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Use shared Rust toolchain setting up steps | |
uses: ./.github/actions/toolchain-shared | |
with: | |
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | |
- name: Use shared OCaml setting up steps | |
uses: ./.github/actions/ocaml-shared | |
with: | |
ocaml_version: ${{ matrix.ocaml_version }} | |
# | |
# Coding guidelines | |
# | |
- name: Lint (clippy) | |
run: | | |
eval $(opam env) | |
make lint | |
build: | |
needs: ['define-matrix', 'refresh-cache'] | |
strategy: | |
matrix: | |
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }} | |
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} | |
node: ${{ fromJSON(needs.define-matrix.outputs.node) }} | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Use shared Rust toolchain setting up steps | |
uses: ./.github/actions/toolchain-shared | |
with: | |
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | |
- name: Use shared OCaml setting up steps | |
uses: ./.github/actions/ocaml-shared | |
with: | |
ocaml_version: ${{ matrix.ocaml_version }} | |
# | |
# Build | |
# | |
- name: Ensure that everything builds | |
run: | | |
eval $(opam env) | |
make | |
tests: | |
needs: ['define-matrix', 'refresh-cache'] | |
strategy: | |
matrix: | |
rust_toolchain_version: ${{ fromJSON(needs.define-matrix.outputs.rust_toolchain_version) }} | |
ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} | |
node: ${{ fromJSON(needs.define-matrix.outputs.node) }} | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Use shared Rust toolchain setting up steps | |
uses: ./.github/actions/toolchain-shared | |
with: | |
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | |
components: llvm-tools-preview | |
- name: Use shared OCaml setting up steps | |
uses: ./.github/actions/ocaml-shared | |
with: | |
ocaml_version: ${{ matrix.ocaml_version }} | |
# | |
# Tests | |
# | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected], [email protected] | |
- name: Build the MIPS binaries | |
uses: ./.github/actions/build-mips | |
- name: Run non-heavy tests without the code coverage | |
run: | | |
eval $(opam env) | |
make nextest |