[feat] refactor according to rules and prepare to release #88
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] | |
| pull_request: | |
| branches: [main, dev] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # Quick check job - runs format and lint checks | |
| quick-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: rustfmt, clippy | |
| - name: Check rust version | |
| run: rustc --version --verbose | |
| - name: Check code format | |
| run: cargo fmt --all -- --check | |
| - name: Clippy (default target) | |
| run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::new_without_default | |
| # Build and test job - runs on multiple platforms | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| needs: quick-check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - 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: | |
| components: rust-src, clippy | |
| targets: ${{ matrix.target }} | |
| - name: Clippy | |
| run: cargo clippy --target ${{ matrix.target }} --all-features -- -D warnings -A clippy::new_without_default | |
| - name: Build | |
| run: cargo build --target ${{ matrix.target }} --all-features | |
| - name: Unit test | |
| if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} | |
| run: cargo test --target ${{ matrix.target }} --all-features -- --nocapture | |
| # Documentation job | |
| doc: | |
| runs-on: ubuntu-latest | |
| needs: quick-check | |
| 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@nightly | |
| - 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 == env.default-branch }} | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| single-commit: true | |
| branch: gh-pages | |
| folder: target/doc |