mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-09 00:00:12 +02:00
ci: Refactor ci style (#3613)
This commit is contained in:
+155
-158
@@ -18,33 +18,33 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
workspace: [".", examples]
|
workspace: [".", examples]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@beta
|
- uses: dtolnay/rust-toolchain@beta
|
||||||
with:
|
with:
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
workspaces: ${{ matrix.workspace }}
|
workspaces: ${{ matrix.workspace }}
|
||||||
- name: Check
|
- name: Check
|
||||||
run: cargo clippy --locked --manifest-path ${{ matrix.workspace }}/Cargo.toml --workspace --all-targets --all-features -- -D warnings
|
run: cargo clippy --locked --manifest-path ${{ matrix.workspace }}/Cargo.toml --workspace --all-targets --all-features -- -D warnings
|
||||||
- name: rustfmt
|
- name: rustfmt
|
||||||
run: cargo fmt --all --check --manifest-path ${{ matrix.workspace }}/Cargo.toml
|
run: cargo fmt --all --check --manifest-path ${{ matrix.workspace }}/Cargo.toml
|
||||||
|
|
||||||
check-docs:
|
check-docs:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: cargo doc -p axum-core
|
- name: cargo doc -p axum-core
|
||||||
run: cargo doc --package axum-core --all-features --no-deps
|
run: cargo doc --package axum-core --all-features --no-deps
|
||||||
- name: cargo doc -p axum
|
- name: cargo doc -p axum
|
||||||
run: cargo doc --package axum --all-features --no-deps
|
run: cargo doc --package axum --all-features --no-deps
|
||||||
- name: cargo doc -p axum-extra
|
- name: cargo doc -p axum-extra
|
||||||
run: cargo doc --package axum-extra --all-features --no-deps
|
run: cargo doc --package axum-extra --all-features --no-deps
|
||||||
env:
|
env:
|
||||||
RUSTDOCFLAGS: "-D rustdoc::all -A rustdoc::private-doc-tests"
|
RUSTDOCFLAGS: "-D rustdoc::all -A rustdoc::private-doc-tests"
|
||||||
|
|
||||||
@@ -54,31 +54,31 @@ jobs:
|
|||||||
# Fail the build if there are any warnings
|
# Fail the build if there are any warnings
|
||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- uses: taiki-e/install-action@cargo-hack
|
- uses: taiki-e/install-action@cargo-hack
|
||||||
- name: cargo hack check
|
- name: cargo hack check
|
||||||
run: cargo hack check --each-feature --no-dev-deps --all
|
run: cargo hack check --each-feature --no-dev-deps --all
|
||||||
|
|
||||||
external-types:
|
external-types:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: nightly-2025-10-18
|
toolchain: nightly-2025-10-18
|
||||||
- name: Install cargo-check-external-types
|
- name: Install cargo-check-external-types
|
||||||
uses: taiki-e/cache-cargo-install-action@v2
|
uses: taiki-e/cache-cargo-install-action@v2
|
||||||
with:
|
with:
|
||||||
tool: [email protected]
|
tool: [email protected]
|
||||||
- uses: taiki-e/install-action@cargo-hack
|
- uses: taiki-e/install-action@cargo-hack
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- run: cargo hack --no-private --exclude axum-macros check-external-types --all-features
|
- run: cargo hack --no-private --exclude axum-macros check-external-types --all-features
|
||||||
|
|
||||||
test-versions:
|
test-versions:
|
||||||
needs: check
|
needs: check
|
||||||
@@ -88,35 +88,35 @@ jobs:
|
|||||||
rust: [stable, beta]
|
rust: [stable, beta]
|
||||||
workspace: [".", examples]
|
workspace: [".", examples]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
workspaces: ${{ matrix.workspace }}
|
workspaces: ${{ matrix.workspace }}
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --locked --workspace --all-features --all-targets --manifest-path ${{ matrix.workspace }}/Cargo.toml
|
run: cargo test --locked --workspace --all-features --all-targets --manifest-path ${{ matrix.workspace }}/Cargo.toml
|
||||||
|
|
||||||
# some examples don't support our MSRV so we only test axum itself on our MSRV
|
# some examples don't support our MSRV so we only test axum itself on our MSRV
|
||||||
test-nightly:
|
test-nightly:
|
||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- name: Get rust-toolchain version
|
- name: Get rust-toolchain version
|
||||||
id: rust-toolchain
|
id: rust-toolchain
|
||||||
run: echo "version=$(cat axum-macros/rust-toolchain)" >> $GITHUB_OUTPUT
|
run: echo "version=$(cat axum-macros/rust-toolchain)" >> $GITHUB_OUTPUT
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ steps.rust-toolchain.outputs.version }}
|
toolchain: ${{ steps.rust-toolchain.outputs.version }}
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: Run nightly tests
|
- name: Run nightly tests
|
||||||
working-directory: axum-macros
|
working-directory: axum-macros
|
||||||
run: cargo test
|
run: cargo test
|
||||||
|
|
||||||
# some examples don't support our MSRV (such as async-graphql)
|
# some examples don't support our MSRV (such as async-graphql)
|
||||||
# so we only test axum itself on our MSRV
|
# so we only test axum itself on our MSRV
|
||||||
@@ -124,55 +124,55 @@ jobs:
|
|||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ env.MSRV }}
|
toolchain: ${{ env.MSRV }}
|
||||||
- name: "install Rust nightly"
|
- name: "install Rust nightly"
|
||||||
uses: dtolnay/rust-toolchain@nightly
|
uses: dtolnay/rust-toolchain@nightly
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: Select minimal version
|
- name: Select minimal version
|
||||||
run: cargo +nightly update -Z minimal-versions
|
run: cargo +nightly update -Z minimal-versions
|
||||||
- name: Fix up Cargo.lock - crc32fast
|
- name: Fix up Cargo.lock - crc32fast
|
||||||
run: cargo +nightly update -p crc32fast --precise 1.1.1
|
run: cargo +nightly update -p crc32fast --precise 1.1.1
|
||||||
- name: Fix up Cargo.lock - version_check
|
- name: Fix up Cargo.lock - version_check
|
||||||
run : cargo +nightly update -p [email protected] --precise 0.1.4
|
run : cargo +nightly update -p [email protected] --precise 0.1.4
|
||||||
- name: Fix up Cargo.lock - lazy_static
|
- name: Fix up Cargo.lock - lazy_static
|
||||||
run: cargo +nightly update -p lazy_static --precise 1.1.0
|
run: cargo +nightly update -p lazy_static --precise 1.1.0
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: >
|
run: >
|
||||||
cargo +${{ env.MSRV }}
|
cargo +${{ env.MSRV }}
|
||||||
test
|
test
|
||||||
-p axum
|
-p axum
|
||||||
-p axum-extra
|
-p axum-extra
|
||||||
-p axum-core
|
-p axum-core
|
||||||
--all-features
|
--all-features
|
||||||
--locked
|
--locked
|
||||||
# the compiler errors are different on our MSRV which makes
|
# the compiler errors are different on our MSRV which makes
|
||||||
# the trybuild tests in axum-macros fail, so just run the doc
|
# the trybuild tests in axum-macros fail, so just run the doc
|
||||||
# tests
|
# tests
|
||||||
- name: Run axum-macros doc tests
|
- name: Run axum-macros doc tests
|
||||||
run: >
|
run: >
|
||||||
cargo +${{ env.MSRV }}
|
cargo +${{ env.MSRV }}
|
||||||
test
|
test
|
||||||
-p axum-macros
|
-p axum-macros
|
||||||
--doc
|
--doc
|
||||||
--all-features
|
--all-features
|
||||||
--locked
|
--locked
|
||||||
|
|
||||||
test-docs:
|
test-docs:
|
||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: Run doc tests
|
- name: Run doc tests
|
||||||
run: cargo test --locked --all-features --doc
|
run: cargo test --locked --all-features --doc
|
||||||
|
|
||||||
deny-check:
|
deny-check:
|
||||||
name: cargo-deny check
|
name: cargo-deny check
|
||||||
@@ -194,66 +194,63 @@ jobs:
|
|||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
target: armv5te-unknown-linux-musleabi
|
target: armv5te-unknown-linux-musleabi
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: Check
|
- name: Check
|
||||||
env:
|
env:
|
||||||
# Clang has native cross-compilation support
|
# Clang has native cross-compilation support
|
||||||
CC: clang
|
CC: clang
|
||||||
run: >
|
run: >
|
||||||
cargo
|
cargo
|
||||||
check
|
check
|
||||||
--all-targets
|
--all-targets
|
||||||
--all-features
|
--all-features
|
||||||
-p axum
|
-p axum
|
||||||
-p axum-core
|
-p axum-core
|
||||||
-p axum-extra
|
-p axum-extra
|
||||||
-p axum-macros
|
-p axum-macros
|
||||||
--target armv5te-unknown-linux-musleabi
|
--target armv5te-unknown-linux-musleabi
|
||||||
|
|
||||||
wasm32-unknown-unknown:
|
wasm32-unknown-unknown:
|
||||||
needs: check
|
needs: check
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
target: wasm32-unknown-unknown
|
target: wasm32-unknown-unknown
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
workspaces: examples
|
workspaces: examples
|
||||||
- name: Check
|
- name: Check
|
||||||
run: >
|
run: >
|
||||||
cargo
|
cargo
|
||||||
check
|
check
|
||||||
--manifest-path ./examples/simple-router-wasm/Cargo.toml
|
--manifest-path ./examples/simple-router-wasm/Cargo.toml
|
||||||
--target wasm32-unknown-unknown
|
--target wasm32-unknown-unknown
|
||||||
|
|
||||||
dependencies-are-sorted:
|
dependencies-are-sorted:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- name: Install cargo-sort
|
- name: Install cargo-sort
|
||||||
uses: taiki-e/install-action@v2
|
uses: taiki-e/install-action@v2
|
||||||
with:
|
with:
|
||||||
tool: [email protected]
|
tool: [email protected]
|
||||||
- name: Check dependency tables
|
- name: Check dependency tables
|
||||||
run: |
|
run: |
|
||||||
cargo-sort --workspace --grouped --check
|
cargo-sort --workspace --grouped --check
|
||||||
|
|
||||||
typos:
|
typos:
|
||||||
name: Spell Check with Typos
|
name: Spell Check with Typos
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Actions Repository
|
- uses: actions/checkout@v6
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Check the spelling of the files in our repo
|
- name: Check the spelling of the files in our repo
|
||||||
uses: crate-ci/[email protected]
|
uses: crate-ci/[email protected]
|
||||||
|
|||||||
Reference in New Issue
Block a user