Skip to content

Commit

Permalink
move to seperate github action
Browse files Browse the repository at this point in the history
compact CI

rename file
  • Loading branch information
duc-nx committed Aug 9, 2024
1 parent 72fe24a commit 9cd444e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 45 deletions.
12 changes: 12 additions & 0 deletions .github/actions/rust-cache/toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Rust toolchain
description: Set up Rust toolchain
runs:
using: composite
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: riscv32i-unknown-none-elf
- uses: Swatinem/rust-cache@v2
54 changes: 9 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,36 @@ on:
branches:
- main

# Define the cache configuration as an anchor
cache-config: &cache-config
uses: actions/[email protected]
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

jobs:
check-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- run: cargo fmt --all --check
- run: cd nova-benches && cargo fmt --check

check-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- *cache-config # Use the cache configuration
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: riscv32i-unknown-none-elf
- run: cargo check --all-features
- run: cargo check --all-features --examples
- run: cargo check -p example --target=riscv32i-unknown-none-elf
- run: cd nova-benches && cargo check --benches
- uses: ./.github/actions/toolchain
- run: cargo fmt --all --check
- run: cargo check --bins --examples --tests --benches --all-targets --all-features

cargo-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- *cache-config
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- uses: ./.github/actions/toolchain
- run: cargo clippy --all-targets --all-features

test:
cargo-test:
needs: check-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- *cache-config
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- run: cargo test -r --all-features
- uses: ./.github/actions/toolchain
- run: cargo test --bins --examples --tests --benches --all-targets --all-features

test-smoke:
needs: check-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- *cache-config
- run: rustup target add riscv32i-unknown-none-elf
- uses: ./.github/actions/toolchain
- run: assets/scripts/smoke.sh examples/src/bin/fib3_profiling.rs
- run: assets/scripts/smoke.sh examples/src/bin/hello.rs

Expand All @@ -79,8 +44,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- *cache-config
- run: rustup target add riscv32i-unknown-none-elf
- uses: ./.github/actions/toolchain
- run: assets/scripts/test_sdk.sh examples/src/bin/hello.rs

detect-unused-crate:
Expand Down

0 comments on commit 9cd444e

Please sign in to comment.