-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Update CI for unit-test and doc
- Loading branch information
1 parent
9094bde
commit 1ef010e
Showing
3 changed files
with
38 additions
and
64 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,30 @@ | ||
name: CI | ||
name: Build & Check CI | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
clippy: | ||
ci: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust-toolchain: [nightly] | ||
targets: [x86_64-unknown-linux-gnu, x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: dtolnay/rust-toolchain@nightly | ||
with: | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
components: rust-src, clippy, rustfmt | ||
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none | ||
targets: ${{ matrix.targets }} | ||
- name: Check rust version | ||
run: rustc --version --verbose | ||
- name: Clippy for the default target | ||
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | ||
run: make clippy | ||
- name: Clippy for x86_64 | ||
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | ||
run: make clippy ARCH=x86_64 | ||
- name: Clippy for riscv64 | ||
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | ||
run: make clippy ARCH=riscv64 | ||
- name: Clippy for aarch64 | ||
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | ||
run: make clippy ARCH=aarch64 | ||
- name: Check code format | ||
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | ||
run: cargo fmt --all -- --check | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x86_64, riscv64, aarch64] | ||
rust-toolchain: [nightly] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
components: rust-src, llvm-tools | ||
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Build for ${{ matrix.arch }} | ||
run: make build ARCH=${{ matrix.arch }} | ||
- name: Clippy | ||
run: cargo clippy --target ${{ matrix.targets }} --all-features -- -A clippy::new_without_default | ||
- name: Build | ||
run: cargo build --target ${{ matrix.targets }} --all-features | ||
- name: Unit test | ||
if: ${{ matrix.targets == 'x86_64-unknown-linux-gnu' }} | ||
run: cargo test --target ${{ matrix.targets }} -- --nocapture |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
name: Build & Deploy docs | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
doc: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust-toolchain: [nightly] | ||
permissions: | ||
contents: write | ||
env: | ||
default-branch: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: ${{ matrix.rust-toolchain }} | ||
- uses: dtolnay/rust-toolchain@nightly | ||
- name: Build docs | ||
continue-on-error: ${{ github.ref != env.default-branch }} | ||
run: make doc | ||
continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }} | ||
run: | | ||
cargo doc --no-deps --all-features | ||
printf '<meta http-equiv="refresh" content="0;url=%s/index.html">' $(cargo tree | head -1 | cut -d' ' -f1) > target/doc/index.html | ||
- name: Deploy to Github Pages | ||
if: ${{ github.ref == env.default-branch }} | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
single-commit: true | ||
branch: gh-pages | ||
folder: target/doc | ||
folder: target/doc |
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