2021-06-12 20:18:21 +02:00
|
|
|
name: CI
|
|
|
|
|
2022-03-05 12:13:53 +01:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2023-11-23 12:03:03 +01:00
|
|
|
MSRV: '1.66'
|
2022-03-05 12:13:53 +01:00
|
|
|
|
2021-06-12 20:18:21 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-08-07 11:11:29 +02:00
|
|
|
- main
|
2021-06-12 20:18:21 +02:00
|
|
|
pull_request: {}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: taiki-e/install-action@protoc
|
2023-04-15 09:46:43 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@beta
|
2021-06-12 20:18:21 +02:00
|
|
|
with:
|
2021-11-09 12:53:57 +01:00
|
|
|
components: clippy, rustfmt
|
2022-08-09 15:18:10 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-06-12 20:18:21 +02:00
|
|
|
- name: Check
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
2021-06-12 20:18:21 +02:00
|
|
|
- name: rustfmt
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo fmt --all --check
|
2021-06-12 20:18:21 +02:00
|
|
|
|
2021-06-12 21:44:40 +02:00
|
|
|
check-docs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-08 16:41:59 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-06-12 21:44:40 +02:00
|
|
|
- name: cargo doc
|
2021-08-07 11:06:42 +02:00
|
|
|
env:
|
2023-03-23 15:55:56 +01:00
|
|
|
RUSTDOCFLAGS: "-D rustdoc::all -A rustdoc::private-doc-tests"
|
2021-06-12 21:44:40 +02:00
|
|
|
run: cargo doc --all-features --no-deps
|
|
|
|
|
2021-06-12 20:18:21 +02:00
|
|
|
cargo-hack:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: taiki-e/install-action@protoc
|
2023-01-08 16:41:59 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-06-12 20:18:21 +02:00
|
|
|
- name: Install cargo-hack
|
|
|
|
run: |
|
|
|
|
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
|
|
|
|
- name: cargo hack check
|
|
|
|
run: cargo hack check --each-feature --no-dev-deps --all
|
|
|
|
|
2023-02-16 22:41:41 +01:00
|
|
|
cargo-public-api-crates:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
crate: [axum, axum-core, axum-extra, axum-macros]
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2024-06-09 23:33:25 +02:00
|
|
|
# Pinned version due to failing `cargo-public-api-crates`.
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: nightly-2024-06-06
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-02-16 22:41:41 +01:00
|
|
|
- name: Install cargo-public-api-crates
|
|
|
|
run: |
|
|
|
|
cargo install --git https://github.com/davidpdrsn/cargo-public-api-crates
|
2024-06-09 23:33:25 +02:00
|
|
|
- name: Build rustdoc
|
|
|
|
run: |
|
|
|
|
cargo rustdoc --all-features --manifest-path ${{ matrix.crate }}/Cargo.toml -- -Z unstable-options --output-format json
|
2023-02-16 22:41:41 +01:00
|
|
|
- name: cargo public-api-crates check
|
2024-06-09 23:33:25 +02:00
|
|
|
run: cargo public-api-crates --manifest-path ${{ matrix.crate }}/Cargo.toml --skip-build check
|
2023-02-16 22:41:41 +01:00
|
|
|
|
2021-06-12 20:18:21 +02:00
|
|
|
test-versions:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-18 16:28:23 +01:00
|
|
|
rust: [stable, beta]
|
2021-06-12 20:18:21 +02:00
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: taiki-e/install-action@protoc
|
2023-04-15 09:46:43 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2021-06-12 20:18:21 +02:00
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.rust }}
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-06-12 20:18:21 +02:00
|
|
|
- name: Run tests
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo test --workspace --all-features --all-targets
|
2021-06-12 20:18:21 +02:00
|
|
|
|
2023-03-10 12:02:11 +01:00
|
|
|
# some examples doesn't support our MSRV so we only test axum itself on our MSRV
|
2022-11-19 12:45:03 +01:00
|
|
|
test-nightly:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-17 10:55:18 +02:00
|
|
|
- name: Get rust-toolchain version
|
|
|
|
id: rust-toolchain
|
|
|
|
run: echo "version=$(cat axum-macros/rust-toolchain)" >> $GITHUB_OUTPUT
|
2023-04-15 09:46:43 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2022-11-19 12:45:03 +01:00
|
|
|
with:
|
2023-04-17 10:55:18 +02:00
|
|
|
toolchain: ${{ steps.rust-toolchain.outputs.version }}
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-11-19 12:45:03 +01:00
|
|
|
- name: Run nightly tests
|
|
|
|
working-directory: axum-macros
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo test
|
2022-11-19 12:45:03 +01:00
|
|
|
|
2022-06-27 20:44:20 +02:00
|
|
|
# some examples doesn't support our MSRV (such as async-graphql)
|
|
|
|
# so we only test axum itself on our MSRV
|
2021-11-03 10:22:31 +01:00
|
|
|
test-msrv:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-15 09:46:43 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2021-11-03 10:22:31 +01:00
|
|
|
with:
|
2022-06-27 20:44:20 +02:00
|
|
|
toolchain: ${{ env.MSRV }}
|
|
|
|
- name: "install Rust nightly"
|
2023-04-15 09:46:43 +02:00
|
|
|
uses: dtolnay/rust-toolchain@nightly
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Select minimal version
|
|
|
|
run: cargo +nightly update -Z minimal-versions
|
2022-07-28 19:14:31 +02:00
|
|
|
- name: Fix up Cargo.lock
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo +nightly update -p crc32fast --precise 1.1.1
|
2021-11-03 10:22:31 +01:00
|
|
|
- name: Run tests
|
2023-04-15 17:02:47 +02:00
|
|
|
run: >
|
|
|
|
cargo +${{ env.MSRV }}
|
|
|
|
test
|
|
|
|
-p axum
|
|
|
|
-p axum-extra
|
|
|
|
-p axum-core
|
|
|
|
--all-features
|
|
|
|
--locked
|
2022-06-27 20:44:20 +02:00
|
|
|
# the compiler errors are different on our MSRV which makes
|
2022-01-31 22:46:44 +01:00
|
|
|
# the trybuild tests in axum-macros fail, so just run the doc
|
2021-11-11 21:26:08 +01:00
|
|
|
# tests
|
2022-01-31 22:46:44 +01:00
|
|
|
- name: Run axum-macros doc tests
|
2023-04-15 17:02:47 +02:00
|
|
|
run: >
|
|
|
|
cargo +${{ env.MSRV }}
|
|
|
|
test
|
|
|
|
-p axum-macros
|
|
|
|
--doc
|
|
|
|
--all-features
|
|
|
|
--locked
|
2021-11-03 10:22:31 +01:00
|
|
|
|
2021-08-19 09:34:48 +02:00
|
|
|
test-docs:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-08 16:41:59 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-08-19 09:34:48 +02:00
|
|
|
- name: Run doc tests
|
2023-04-15 17:02:47 +02:00
|
|
|
run: cargo test --all-features --doc
|
2021-08-19 09:34:48 +02:00
|
|
|
|
2021-06-12 20:18:21 +02:00
|
|
|
deny-check:
|
|
|
|
name: cargo-deny check
|
|
|
|
runs-on: ubuntu-latest
|
2021-11-03 12:38:48 +01:00
|
|
|
continue-on-error: ${{ matrix.checks == 'advisories' }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
checks:
|
|
|
|
- advisories
|
|
|
|
- bans licenses sources
|
2021-06-12 20:18:21 +02:00
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2021-11-03 12:38:48 +01:00
|
|
|
- uses: EmbarkStudios/cargo-deny-action@v1
|
|
|
|
with:
|
|
|
|
command: check ${{ matrix.checks }}
|
2024-02-22 09:59:05 +01:00
|
|
|
manifest-path: axum/Cargo.toml
|
2021-12-12 15:19:30 +01:00
|
|
|
|
|
|
|
armv5te-unknown-linux-musleabi:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-08 16:41:59 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2021-12-12 15:19:30 +01:00
|
|
|
with:
|
|
|
|
target: armv5te-unknown-linux-musleabi
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-12-12 15:19:30 +01:00
|
|
|
- name: Check
|
|
|
|
env:
|
|
|
|
# Clang has native cross-compilation support
|
|
|
|
CC: clang
|
2023-04-15 17:02:47 +02:00
|
|
|
run: >
|
|
|
|
cargo
|
|
|
|
check
|
|
|
|
--all-targets
|
|
|
|
--all-features
|
|
|
|
-p axum
|
|
|
|
-p axum-core
|
|
|
|
-p axum-extra
|
|
|
|
-p axum-macros
|
|
|
|
--target armv5te-unknown-linux-musleabi
|
2022-06-10 08:59:17 +02:00
|
|
|
|
2022-09-25 17:10:33 +02:00
|
|
|
wasm32-unknown-unknown:
|
|
|
|
needs: check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-08 16:41:59 +01:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-09-25 17:10:33 +02:00
|
|
|
with:
|
|
|
|
target: wasm32-unknown-unknown
|
2023-04-15 17:02:47 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-09-25 17:10:33 +02:00
|
|
|
- name: Check
|
2023-04-15 17:02:47 +02:00
|
|
|
run: >
|
|
|
|
cargo
|
|
|
|
check
|
|
|
|
--manifest-path ./examples/simple-router-wasm/Cargo.toml
|
|
|
|
--target wasm32-unknown-unknown
|
2022-09-25 17:10:33 +02:00
|
|
|
|
2022-07-26 14:03:35 +02:00
|
|
|
dependencies-are-sorted:
|
2022-06-10 08:59:17 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-01-07 09:28:54 +01:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-15 09:46:43 +02:00
|
|
|
- uses: dtolnay/rust-toolchain@beta
|
2022-08-09 15:18:10 +02:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-06-10 08:59:17 +02:00
|
|
|
- name: Install cargo-sort
|
|
|
|
run: |
|
|
|
|
cargo install cargo-sort
|
2023-03-10 12:02:11 +01:00
|
|
|
# Work around cargo-sort not honoring workspace.exclude
|
2022-08-09 16:56:50 +02:00
|
|
|
- name: Remove non-crate folder
|
2023-03-10 12:02:11 +01:00
|
|
|
run: rm -rf examples/async-graphql
|
2022-08-09 16:56:50 +02:00
|
|
|
- name: Check dependency tables
|
2022-06-10 08:59:17 +02:00
|
|
|
run: |
|
|
|
|
cargo sort --workspace --grouped --check
|
2023-08-08 10:40:57 +02:00
|
|
|
|
|
|
|
typos:
|
|
|
|
name: Spell Check with Typos
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout Actions Repository
|
2024-01-07 09:28:54 +01:00
|
|
|
uses: actions/checkout@v4
|
2023-08-08 10:40:57 +02:00
|
|
|
|
|
|
|
- name: Check the spelling of the files in our repo
|
2024-04-16 08:56:01 +02:00
|
|
|
uses: crate-ci/typos@v1.20.8
|