Upgrade to compatibility with rust edition 2024 #522
Workflow file for this run
This file contains hidden or 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: Rust | |
on: [ push, pull_request ] | |
env: | |
CARGO_TERM_COLOR: 'always' | |
CARGO_TERM_VERBOSE: 'true' | |
RUSTFLAGS: '--deny warnings' | |
RUSTDOCFLAGS: '-Dwarnings' | |
jobs: | |
rust-version: | |
name: Minimal supported Rust version | |
outputs: | |
version: ${{ steps.read_version.outputs.msrv }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- id: read_version | |
run: | | |
awk -F '=' \ | |
'/^rust-version[[:space:]]*=/ { gsub(/([" ]|#.*)/,"",$2); print ("msrv=" $2) }' \ | |
Cargo.toml \ | |
| tee -a "$GITHUB_OUTPUT" | |
test-linux: | |
name: Test (Linux) | |
needs: rust-version | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust-version: | |
- ${{ needs.rust-version.outputs.version }} | |
- stable | |
steps: | |
- name: checkout source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- name: set up cargo cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ matrix.rust-version}}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-${{ matrix.rust-version }}- | |
- name: set up nginx deps cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
.cache/.gnupg | |
.cache/nginx | |
.cache/*.tar.gz | |
.cache/*.tar.asc | |
.cache/*.tar.sig | |
key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} | |
restore-keys: ${{ runner.os }}-deps- | |
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
with: | |
components: rustfmt, clippy | |
toolchain: ${{ matrix.rust-version }} | |
- name: build (all targets, all features) | |
id: build | |
run: cargo build --workspace --all-targets --all-features | |
- name: check ngx, no default features (no_std) | |
run: cargo check -p ngx --no-default-features --features vendored | |
- name: check ngx, alloc | |
run: cargo check -p ngx --no-default-features --features vendored,alloc | |
- name: check ngx, std | |
run: cargo check -p ngx --no-default-features --features vendored,std | |
- name: check ngx, alloc + serde | |
run: cargo check -p ngx --no-default-features --features vendored,alloc,serde | |
- name: clippy | |
# always run if build succeeds | |
if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings | |
- name: test | |
# always run if build succeeds | |
if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
run: cargo test --workspace --all-features | |
- name: rustdoc | |
# always run if build succeeds | |
if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
run: cargo doc --all-features --no-deps | |
examples-linux: | |
name: Examples (Linux) | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout source | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- name: set up cargo cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: set up nginx deps cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
.cache/.gnupg | |
.cache/nginx | |
.cache/*.tar.gz | |
.cache/*.tar.asc | |
.cache/*.tar.sig | |
key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} | |
restore-keys: ${{ runner.os }}-deps- | |
- name: compile examples | |
run: cargo build --release --package examples --examples --all-features | |
test-macos: | |
name: Test (MacOS) | |
runs-on: macos-latest | |
steps: | |
- name: install command line dependencies | |
run: brew install make gnupg | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
submodules: true | |
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
with: | |
toolchain: stable | |
- name: set up cargo cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: set up nginx deps cache | |
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
continue-on-error: false | |
with: | |
path: | | |
.cache/*.tar.gz | |
.cache/*.tar.asc | |
.cache/*.tar.sig | |
key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} | |
restore-keys: ${{ runner.os }}-deps- | |
- name: current directory | |
run: pwd | |
- name: make cache directory | |
run: mkdir -p .cache/.gnupg | |
- name: disable ipv6 for gpg | |
run: echo "disable-ipv6" > .cache/.gnupg/dirmngr.conf | |
- name: build | |
run: cargo build --workspace --all-targets --features "async,vendored" | |
- name: run tests | |
run: cargo test --workspace --features "async,vendored" | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b | |
with: | |
components: rustfmt | |
toolchain: stable | |
- name: rustfmt version | |
run: rustfmt --version | |
- name: cargo fmt | |
run: cargo fmt --all --check |