123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- name: CI
- on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
- workflow_dispatch:
- env:
- CARGO_UNSTABLE_SPARSE_REGISTRY: true
- CARGO_TERM_COLOR: always
- jobs:
- fmt:
- name: Rustfmt
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: stable
- override: true
- components: rustfmt
- - name: Cache Dependencies
- uses: Swatinem/rust-cache@v2
- - uses: actions-rs/cargo@v1
- with:
- command: fmt
- args: --all -- --check
- check-stable:
- name: Cargo check crate RustSBI (stable)
- runs-on: ubuntu-latest
- needs: fmt
- strategy:
- matrix:
- TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: stable
- override: true
- target: ${{ matrix.TARGET }}
- - name: Cache Dependencies
- uses: Swatinem/rust-cache@v2
- with:
- key: ${{ matrix.TARGET }}
- - name: Check (no default features)
- uses: actions-rs/cargo@v1
- with:
- command: check
- args: --target ${{ matrix.TARGET }} --verbose -p rustsbi
- - name: Check crate rustsbi (machine)
- uses: actions-rs/cargo@v1
- with:
- command: check
- args: --target ${{ matrix.TARGET }} --features "machine" --verbose -p rustsbi
- - name: Check crate rustsbi (forward)
- uses: actions-rs/cargo@v1
- with:
- command: check
- args: --target ${{ matrix.TARGET }} --features "forward" --verbose -p rustsbi
- - name: Check crate rustsbi (machine + forward)
- uses: actions-rs/cargo@v1
- with:
- command: check
- args: --target ${{ matrix.TARGET }} --features "machine, forward" --verbose -p rustsbi
- check-nightly:
- name: Cargo check crate RustSBI (nightly)
- runs-on: ubuntu-latest
- needs: fmt
- strategy:
- matrix:
- TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: nightly
- override: true
- target: ${{ matrix.TARGET }}
- - name: Cache Dependencies
- uses: Swatinem/rust-cache@v2
- with:
- key: ${{ matrix.TARGET }}
- tests:
- name: Run crate RustSBI tests
- needs: fmt
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: stable
- components: clippy
- override: true
- - name: Cache Dependencies
- uses: Swatinem/rust-cache@v2
- - name: Clippy
- uses: actions-rs/cargo@v1
- with:
- command: clippy
- - name: Run tests (no default features)
- uses: actions-rs/cargo@v1
- with:
- command: test
- args: --verbose -p rustsbi
- - name: Run tests (machine)
- uses: actions-rs/cargo@v1
- with:
- command: test
- args: --features "machine" --verbose -p rustsbi
- sbi-spec:
- name: Compile and test sbi-spec
- needs: fmt
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- target:
- [
- riscv32imac-unknown-none-elf,
- riscv64imac-unknown-none-elf,
- x86_64-unknown-none,
- ]
- steps:
- - uses: actions/checkout@v3
- # Cache REF:
- # - https://github.com/actions/cache/blob/main/examples.md#rust---cargo
- # - https://github.com/actions-rs/toolchain/issues/54
- - name: Cache Rust
- uses: actions/cache@v3
- with:
- key: rust-toolchain-${{ matrix.target }}
- path: |
- ~/.rustup/settings.toml
- ~/.rustup/toolchains/stable-*
- ~/.rustup/update-hashes/stable-*
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- target/
- - name: Setup Rust
- run: |
- rustup toolchain install stable --profile minimal
- rustup component add rustfmt clippy
- rustup target add ${{ matrix.target }}
- - name: Check format
- run: cargo fmt --all --check
- - name: Check clippy
- run: cargo clippy -- -D warnings
- - name: Check build
- run: cargo build
- - name: Check test
- run: cargo test
|