chore(ci): update ci config #2306
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
ci-pass: | |
name: CI is green | |
runs-on: ubuntu-latest | |
needs: | |
- style | |
- test | |
- msrv | |
- miri | |
- features | |
- deprecated | |
- ffi | |
- ffi-header | |
- doc | |
steps: | |
- run: exit 0 | |
style: | |
name: Check Style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: cargo fmt --check | |
run: | | |
if ! rustfmt --check --edition 2018 $(git ls-files '*.rs'); then | |
printf "Please run \`rustfmt --edition 2018 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 | |
exit 1 | |
fi | |
test: | |
name: Test ${{ matrix.rust }} on ${{ matrix.os }} | |
needs: [style] | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macOS-latest | |
include: | |
- rust: stable | |
features: "--features full,backports,deprecated" | |
- rust: beta | |
features: "--features full,backports" | |
- rust: nightly | |
features: "--features full,nightly,backports" | |
benches: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust (${{ matrix.rust }}) | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Test | |
run: cargo test ${{ matrix.features }} | |
- name: Test all benches | |
if: matrix.benches | |
run: cargo test --benches ${{ matrix.features }} | |
msrv: | |
name: Check MSRV (${{ matrix.rust }}) | |
needs: [style] | |
strategy: | |
matrix: | |
rust: | |
- 1.63 # keep in sync with MSRV.md dev doc | |
os: | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust (${{ matrix.rust }}) | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Check | |
run: cargo check --features full | |
miri: | |
name: Test with Miri | |
needs: [style] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: miri | |
- name: Test | |
# Can't enable tcp feature since Miri does not support the tokio runtime | |
run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri test --features http1,http2,client,server,stream,nightly | |
features: | |
name: features | |
needs: [style] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: check --feature-powerset | |
run: cargo hack --no-dev-deps check --feature-powerset --depth 2 --skip ffi | |
deprecated: | |
name: Check deprecated on ${{ matrix.rust }} | |
needs: [style] | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust (${{ matrix.rust }}) | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Check | |
run: cargo check --features full,backports,deprecated | |
ffi: | |
name: Test C API (FFI) | |
needs: [style] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cbindgen | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cbindgen | |
- name: Build FFI | |
run: cargo rustc --features client,http1,http2,ffi --crate-type cdylib | |
env: | |
RUSTFLAGS: --cfg hyper_unstable_ffi | |
- name: Make Examples | |
run: cd capi/examples && make client | |
- name: Run FFI unit tests | |
run: cargo test --features full,ffi --lib | |
env: | |
RUSTFLAGS: --cfg hyper_unstable_ffi | |
ffi-header: | |
name: Verify hyper.h is up to date | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Install cbindgen | |
uses: taiki-e/cache-cargo-install-action@v1 | |
with: | |
tool: cbindgen | |
- name: Build FFI | |
run: cargo build --features client,http1,http2,ffi | |
env: | |
RUSTFLAGS: --cfg hyper_unstable_ffi | |
- name: Ensure that hyper.h is up to date | |
run: ./capi/gen_header.sh --verify | |
doc: | |
name: Build docs | |
needs: [style, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: cargo doc | |
run: cargo rustdoc --features full,ffi -- --cfg docsrs --cfg hyper_unstable_ffi -D broken-intra-doc-links |