Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 45 additions & 17 deletions .github/workflows/rust-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,69 @@ on:
branches:
- main

env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_TERM_COLOR: always

jobs:
rust_ci:
name: Build & Test
lint:
name: Format & Clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Rust fmt
run: cargo fmt --all -- --check
- name: Rust clippy
run: cargo clippy --workspace --all-targets -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest

# Regenerate Cairo reference data when Cairo/SDK files changed or on push to main (rebase)
- name: Check for Cairo/SDK changes
id: cairo-check
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v3
with:
filters: |
changed:
- 'packages/**'
- 'sdk/**'
- 'Scarb.toml'
- 'Scarb.lock'
- uses: actions/setup-node@v4
if: github.event_name == 'push' || steps.cairo-check.outputs.changed == 'true'
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: sdk/package-lock.json

- name: Install Scarb
if: github.event_name == 'push' || steps.cairo-check.outputs.changed == 'true'
uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.15.0"

- name: Install snforge
if: github.event_name == 'push' || steps.cairo-check.outputs.changed == 'true'
uses: foundry-rs/setup-snfoundry@v3

- name: Rust fmt
run: cargo fmt --all -- --check

- name: Rust clippy
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Rust build
run: cargo build --workspace --all-targets

- name: Generate Cairo reference data
if: github.event_name == 'push' || steps.cairo-check.outputs.changed == 'true'
run: |
cd sdk
npm run generate:cairo-refs
Expand All @@ -55,7 +83,7 @@ jobs:
- name: Install starknet-devnet via asdf
uses: asdf-vm/actions/install@v3
with:
tool_versions: starknet-devnet 0.7.1
tool_versions: starknet-devnet 0.7.2

- name: Rust test
run: cargo test --workspace --all-targets
run: cargo nextest run --workspace --all-targets