123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- name: Rust
- on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
- workflow_dispatch:
- env:
- CARGO_UNSTABLE_SPARSE_REGISTRY: true
- CARGO_TERM_COLOR: always
- jobs:
- fmt:
- name: Rustfmt all packages
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- components: rustfmt
- - name: Cache Dependencies
- uses: Swatinem/rust-cache@v2
- - name: Rustfmt Check
- uses: actions-rust-lang/rustfmt@v1
- build-rustsbi:
- name: Build rustsbi
- runs-on: ubuntu-latest
- needs: fmt
- strategy:
- matrix:
- TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
- TOOLCHAIN: [stable, nightly]
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- target: ${{ matrix.TARGET }}
- toolchain: ${{ matrix.TOOLCHAIN }}
- - uses: Swatinem/rust-cache@v2
- with:
- key: ${{ matrix.TARGET }}
- - name: Build (no default features)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose
- - name: Build (machine)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose --features "machine"
- - name: Build (forward)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose --features "forward"
- - name: Build (machine + forward)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose --features "machine, forward"
- test-rustsbi:
- name: Test rustsbi
- needs: fmt
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- toolchain: stable
- - uses: Swatinem/rust-cache@v2
- - name: Run tests (no default features)
- run: |
- cargo test -p rustsbi --verbose
- - name: Run tests (machine)
- run: |
- cargo test -p rustsbi --verbose --features "machine"
- # Don't run tests with rustsbi `forward` features on here: it requires RISC-V targets to build.
- test-sbi-spec:
- name: Test sbi-spec
- needs: fmt
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- toolchain: stable
- - uses: Swatinem/rust-cache@v2
- # - name: Check clippy
- # run: cargo clippy -- -D warnings
- - name: Run tests
- run: cargo test -p sbi-spec --verbose
-
- build-sbi-rt:
- name: Build sbi-rt
- needs: fmt
- runs-on: ubuntu-latest
- strategy:
- matrix:
- TARGET: [riscv64imac-unknown-none-elf, riscv32imac-unknown-none-elf]
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- target: ${{ matrix.TARGET }}
- toolchain: stable
- - uses: Swatinem/rust-cache@v2
- - name: Build
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose -p sbi-rt
- build-sbi-testing:
- name: Build sbi-testing
- needs: fmt
- runs-on: ubuntu-latest
- strategy:
- matrix:
- TARGET: [riscv64imac-unknown-none-elf] #, riscv32imac-unknown-none-elf]
- steps:
- - uses: actions/checkout@v4
- - uses: actions-rust-lang/setup-rust-toolchain@v1
- with:
- target: ${{ matrix.TARGET }}
- toolchain: nightly
- - uses: Swatinem/rust-cache@v2
- - name: Build (no default features)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose -p sbi-testing
- - name: Build (log)
- run: |
- cargo build --target ${{ matrix.TARGET }} --verbose -p sbi-testing --features "log"
- # sbi-testing:
- # name: Run rust-clippy analyzing
- # runs-on: ubuntu-latest
- # permissions:
- # security-events: write
- # steps:
- # - name: Checkout code
- # uses: actions/checkout@v4
- # - name: Check format
- # run: cargo fmt --check
- # - name: Install clippy-sarif
- # uses: actions-rs/[email protected]
- # with:
- # crate: clippy-sarif
- # version: latest
- # - name: Install sarif-fmt
- # uses: actions-rs/[email protected]
- # with:
- # crate: sarif-fmt
- # version: latest
- # - name: Run rust-clippy
- # run:
- # cargo clippy
- # --all-featuers
- # --package fast-trap
- # --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
- # continue-on-error: true
- # - name: Upload analysis results to GitHub
- # uses: github/codeql-action/upload-sarif@v2
- # with:
- # sarif_file: rust-clippy-results.sarif
- # wait-for-processing: true
|