diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..c27cc8b --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,44 @@ +name: Check + +on: [push, pull_request] + +env: + RUST_BACKTRACE: 1 + +jobs: + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + + - name: Check format + run: cargo fmt --all --check + + check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust-toolchain: + - nightly + - nightly-2025-05-20 + - nightly-2025-12-12 + - stable + env: + RUSTC_BOOTSTRAP: "${{ matrix.rust-toolchain == 'stable' && '1' || '' }}" + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust-toolchain }} + components: clippy + + - uses: taiki-e/install-action@cargo-hack + - name: Clippy + run: cargo hack clippy --feature-powerset -- -D warnings + - name: Test + run: cargo hack test --feature-powerset -- --nocapture diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f4209e7..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - ci: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust-toolchain: - - nightly - - nightly-2025-05-20 - - nightly-2025-12-12 - - stable - env: - RUSTC_BOOTSTRAP: "${{ matrix.rust-toolchain == 'stable' && '1' || '' }}" - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: ${{ matrix.rust-toolchain }} - components: rust-src, clippy, rustfmt - - name: Check rust version - run: rustc --version --verbose - - name: Check code format - run: cargo fmt --all --check - - - uses: taiki-e/install-action@cargo-hack - - name: Clippy - run: cargo hack clippy --feature-powerset - - name: Unit test - run: cargo hack test --feature-powerset -- --nocapture - - doc: - runs-on: ubuntu-latest - strategy: - fail-fast: false - 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 - continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }} - run: | - cargo doc --no-deps --all-features - printf '' $(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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..35c6007 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,48 @@ +name: Docs + +on: [push, pull_request] + +concurrency: + group: pages + cancel-in-progress: false + +env: + RUST_BACKTRACE: 1 + RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@nightly + + - name: Build docs + run: cargo doc --all-features --no-deps + + - name: Add redirect + run: printf '' $(cargo tree | head -1 | cut -d' ' -f1) > target/doc/index.html + + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v4 + with: + path: target/doc + + deploy: + runs-on: ubuntu-latest + needs: build + if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 0ee809b..b66d671 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Crates.io](https://img.shields.io/crates/v/axio)](https://crates.io/crates/axio) [![Docs.rs](https://docs.rs/axio/badge.svg)](https://docs.rs/axio) -[![CI](https://github.com/arceos-org/axio/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/arceos-org/axio/actions/workflows/ci.yml) +[![CI](https://github.com/arceos-org/axio/actions/workflows/check.yml/badge.svg?branch=main)](https://github.com/arceos-org/axio/actions/workflows/check.yml) [`std::io`][1]-like I/O traits for `no_std` environment.