feat(code): Make peer
crate no_std
compatible
#2633
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: Rust | |
on: | |
push: | |
branches: main | |
paths: | |
- code/** | |
- specs/quint/** | |
- .github/workflows/rust.yml | |
pull_request: | |
paths: | |
- code/** | |
- specs/quint/** | |
- .github/workflows/rust.yml | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_TERM_COLOR: always | |
CARGO_PROFILE_DEV_DEBUG: 1 | |
CARGO_PROFILE_RELEASE_DEBUG: 1 | |
RUST_BACKTRACE: short | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: code | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install Quint | |
run: npm install -g @informalsystems/quint | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache-workspaces: "code" | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@cargo-nextest | |
- name: Run tests | |
run: | | |
cargo nextest run \ | |
--workspace \ | |
--all-features \ | |
--no-fail-fast \ | |
--failure-output final \ | |
--exclude informalsystems-malachitebft-starknet-test \ | |
--exclude informalsystems-malachitebft-discovery-test | |
integration: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: code | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install Quint | |
run: npm install -g @informalsystems/quint | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache-workspaces: "code" | |
- name: Install cargo-maelstrom | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-maelstrom | |
- name: Disable apparmor container restrictions | |
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
- name: Run integration tests | |
run: | | |
cargo maelstrom \ | |
--slots 16 \ | |
--include 'package.match(informalsystems-malachitebft-starknet-test) || package.match(informalsystems-malachitebft-discovery-test)' | |
no_std: | |
name: no_std compatibility | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: code | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache-workspaces: "code" | |
target: thumbv7m-none-eabi | |
- name: Check no_std compatability | |
run: cargo build --target thumbv7m-none-eabi -p informalsystems-malachitebft-peer | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: clippy | |
cache-workspaces: "code" | |
- name: Run clippy | |
uses: actions-rs/clippy@master | |
with: | |
token: ${{secrets.GITHUB_TOKEN}} | |
args: --all-features --all-targets --manifest-path code/Cargo.toml | |
fmt: | |
name: Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: rustfmt | |
cache-workspaces: "code" | |
- name: Check formatting | |
uses: actions-rust-lang/rustfmt@v1 | |
with: | |
manifest-path: code/Cargo.toml | |
msrv: | |
name: MSRV | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: code | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
cache-workspaces: "code" | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install cargo-msrv | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-msrv | |
- name: Check MSRV | |
run: cargo msrv verify --manifest-path crates/engine/Cargo.toml --output-format minimal -- cargo check --all-features | |
standalone: | |
name: Standalone | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: code | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
cache-workspaces: "code" | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: Check each crate with and without default features | |
run: cargo hack check --workspace --each-feature --no-dev-deps |