[feat] refactor according to rules and prepare to release #61
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [main, dev, master] | |
| pull_request: | |
| branches: [main, dev, master] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # Quick checks: format and clippy | |
| quick-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: nightly-2025-05-20 | |
| components: rustfmt, clippy | |
| - name: Check rust version | |
| run: rustc --version --verbose | |
| - name: Check code format | |
| run: cargo fmt --all -- --check | |
| - name: Clippy (x86_64-unknown-linux-gnu) | |
| run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::new_without_default | |
| # Build and test for multiple targets | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| needs: quick-check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust-toolchain: [nightly-2025-05-20, 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@nightly | |
| with: | |
| toolchain: ${{ matrix.rust-toolchain }} | |
| components: rust-src, clippy | |
| targets: ${{ matrix.targets }} | |
| - name: Check rust version | |
| run: rustc --version --verbose | |
| - 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 | |
| # Documentation build and deploy | |
| doc: | |
| runs-on: ubuntu-latest | |
| needs: quick-check | |
| permissions: | |
| contents: write | |
| env: | |
| RUSTDOCFLAGS: "-D rustdoc::broken_intra_doc_links -D missing-docs" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: nightly-2025-05-20 | |
| - name: Build docs | |
| 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 == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| single-commit: true | |
| branch: gh-pages | |
| folder: target/doc |