CI: enforce format with cargo fmt
#15
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/CD | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- "*" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.73 | |
override: true | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: actions/cache@v4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Cargo fmt | |
run: cargo fmt --check | |
- name: Get Stone submodule version | |
id: get-stone-version | |
run: | | |
echo "stone_version=$(cat .git/modules/dependencies/stone-prover/HEAD)" >> $GITHUB_OUTPUT | |
- name: Cache Stone prover and verifier | |
id: cache-stone | |
uses: actions/cache@v4 | |
with: | |
path: dependencies/stone | |
key: stone-${{ runner.os }}-${{ steps.get-stone-version.outputs.stone_version }} | |
- name: Build Stone | |
if: steps.cache-stone.outputs.cache-hit != 'true' | |
run: | | |
bash -x scripts/install-stone.sh --install-dir ./dependencies/stone | |
- name: Set Stone in PATH | |
run: | | |
echo "$(pwd)/dependencies/stone" >> $GITHUB_PATH | |
- name: Build | |
run: | | |
cargo build --verbose | |
- name: Lint with Clippy | |
run: | | |
cargo clippy -- -D warnings | |
- name: Run tests | |
run: | | |
cargo test --verbose | |
- name: Set release artifacts | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
dependencies/stone/cpu_air_prover | |
dependencies/stone/cpu_air_verifier |