Skip to content

Update unix-domain-socket, listen-multiple-addrs, and testing examples #4078

Update unix-domain-socket, listen-multiple-addrs, and testing examples

Update unix-domain-socket, listen-multiple-addrs, and testing examples #4078

Workflow file for this run

name: CI
env:
CARGO_TERM_COLOR: always
MSRV: '1.66'
on:
push:
branches:
- main
pull_request: {}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@protoc
- uses: dtolnay/rust-toolchain@beta
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: rustfmt
run: cargo fmt --all --check
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo doc
env:
RUSTDOCFLAGS: "-D rustdoc::all -A rustdoc::private-doc-tests"
run: cargo doc --all-features --no-deps
cargo-hack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@protoc
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- 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@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- 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
test-versions:
needs: check
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta]
steps:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@protoc
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --workspace --all-features --all-targets
# 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@v3
- name: Get rust-toolchain version
id: rust-toolchain
run: echo "version=$(cat axum-macros/rust-toolchain)" >> $GITHUB_OUTPUT
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-toolchain.outputs.version }}
- uses: Swatinem/rust-cache@v2
- 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@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: "install Rust nightly"
uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Select minimal version
run: cargo +nightly update -Z minimal-versions
- name: Fix up Cargo.lock
run: cargo +nightly update -p crc32fast --precise 1.1.1
- name: Run tests
run: >
cargo +${{ env.MSRV }}
test
-p axum
-p axum-extra
-p axum-core
--all-features
--all-targets
--locked
# the compiler errors are different on our MSRV which makes
# the trybuild tests in axum-macros fail, so just run the doc
# tests
- name: Run axum-macros doc tests
run: >
cargo +${{ env.MSRV }}
test
-p axum-macros
--doc
--all-features
--locked
test-docs:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run doc tests
run: cargo test --all-features --doc
deny-check:
name: cargo-deny check
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.checks == 'advisories' }}
strategy:
matrix:
checks:
- advisories
- bans licenses sources
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
arguments: --all-features --manifest-path axum/Cargo.toml
armv5te-unknown-linux-musleabi:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: armv5te-unknown-linux-musleabi
- uses: Swatinem/rust-cache@v2
- name: Check
env:
# Clang has native cross-compilation support
CC: clang
run: >
cargo
check
--all-targets
--all-features
-p axum
-p axum-core
-p axum-extra
-p axum-macros
--target armv5te-unknown-linux-musleabi
wasm32-unknown-unknown:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Check
run: >
cargo
check
--manifest-path ./examples/simple-router-wasm/Cargo.toml
--target wasm32-unknown-unknown
dependencies-are-sorted:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@beta
- 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
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
uses: actions/checkout@v3
- name: Check the spelling of the files in our repo
uses: crate-ci/typos@v1.16.2