axum/.github/workflows/CI.yml

285 lines
7.4 KiB
YAML
Raw Normal View History

2021-06-12 20:18:21 +02:00
name: CI
env:
CARGO_TERM_COLOR: always
MSRV: '1.60'
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:
- uses: actions/checkout@master
2023-01-20 10:34:44 +01:00
- uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
2021-06-12 20:18:21 +02:00
with:
toolchain: beta
override: true
2021-06-12 20:18:21 +02:00
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
2021-06-12 20:18:21 +02:00
- name: Check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --all-features
2021-06-12 20:18:21 +02:00
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
2021-06-12 20:18:21 +02:00
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
2021-10-19 22:25:06 +02:00
- uses: Swatinem/rust-cache@v1
- name: cargo doc
env:
RUSTDOCFLAGS: "-D rustdoc::all -A rustdoc::private-doc-tests"
run: cargo doc --all-features --no-deps
2021-06-12 20:18:21 +02:00
cargo-hack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: arduino/setup-protoc@v1
- uses: dtolnay/rust-toolchain@stable
2021-06-12 20:18:21 +02:00
with:
toolchain: stable
override: true
2021-06-12 20:18:21 +02:00
profile: minimal
2021-10-19 22:25:06 +02:00
- uses: Swatinem/rust-cache@v1
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
cargo-public-api-crates:
runs-on: ubuntu-latest
strategy:
matrix:
crate: [axum, axum-core, axum-extra, axum-macros]
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
override: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Install cargo-public-api-crates
run: |
cargo install --git https://github.com/davidpdrsn/cargo-public-api-crates
- name: cargo public-api-crates check
run: cargo public-api-crates --manifest-path ${{ matrix.crate }}/Cargo.toml check
2021-06-12 20:18:21 +02:00
test-versions:
needs: check
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta]
2021-06-12 20:18:21 +02:00
steps:
- uses: actions/checkout@master
- uses: arduino/setup-protoc@v1
- uses: dtolnay/rust-toolchain@stable
2021-06-12 20:18:21 +02:00
with:
toolchain: ${{ matrix.rust }}
override: true
2021-06-12 20:18:21 +02:00
profile: minimal
2021-10-19 22:25:06 +02:00
- uses: Swatinem/rust-cache@v1
2021-06-12 20:18:21 +02:00
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
2021-06-19 13:44:21 +02:00
args: --all --all-features --all-targets
2021-06-12 20:18:21 +02:00
# some examples doesn't support our MSRV so we only test axum itself on our MSRV
test-nightly:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
# same as `axum-macros/rust-toolchain`
toolchain: nightly-2022-11-18
override: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Run nightly tests
working-directory: axum-macros
run: |
cargo test
# some examples doesn't support our MSRV (such as async-graphql)
# so we only test axum itself on our MSRV
test-msrv:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.MSRV }}
override: true
profile: minimal
- name: "install Rust nightly"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Select minimal versions
uses: actions-rs/cargo@v1
with:
command: update
args: -Z minimal-versions
toolchain: nightly
- name: Fix up Cargo.lock
uses: actions-rs/cargo@v1
with:
command: update
args: -p crc32fast --precise 1.1.1
toolchain: nightly
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: >
-p axum
-p axum-extra
-p axum-core
--all-features
--all-targets
--locked
toolchain: ${{ env.MSRV }}
# 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
# tests
2022-01-31 22:46:44 +01:00
- name: Run axum-macros doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: >
2022-01-31 22:46:44 +01:00
-p axum-macros
--doc
--all-features
--locked
toolchain: ${{ env.MSRV }}
test-docs:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
2021-10-19 22:25:06 +02:00
- uses: Swatinem/rust-cache@v1
- name: Run doc tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --doc
2021-06-12 20:18:21 +02:00
deny-check:
name: cargo-deny check
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.checks == 'advisories' }}
strategy:
matrix:
checks:
- advisories
- bans licenses sources
2021-06-12 20:18:21 +02:00
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
arguments: --all-features --manifest-path axum/Cargo.toml
2021-12-12 15:19:30 +01:00
armv5te-unknown-linux-musleabi:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
2021-12-12 15:19:30 +01:00
with:
toolchain: stable
target: armv5te-unknown-linux-musleabi
override: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Check
uses: actions-rs/cargo@v1
env:
# Clang has native cross-compilation support
CC: clang
with:
command: check
2021-12-28 15:58:48 +01:00
args: >
--all-targets
--all-features
-p axum
-p axum-core
-p axum-extra
2022-01-31 22:46:44 +01:00
-p axum-macros
2021-12-28 15:58:48 +01:00
--target armv5te-unknown-linux-musleabi
wasm32-unknown-unknown:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: >
--manifest-path ./examples/simple-router-wasm/Cargo.toml
--target wasm32-unknown-unknown
2022-07-26 14:03:35 +02:00
dependencies-are-sorted:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: beta
override: true
profile: minimal
- uses: Swatinem/rust-cache@v2
- name: Install cargo-sort
run: |
cargo install cargo-sort
# Work around cargo-sort not honoring workspace.exclude
- name: Remove non-crate folder
run: rm -rf examples/async-graphql
- name: Check dependency tables
run: |
cargo sort --workspace --grouped --check