Skip to content

feat: conditional compilation support #189

feat: conditional compilation support

feat: conditional compilation support #189

Workflow file for this run

name: Rust
on: [ push, pull_request ]
env:
CARGO_TERM_COLOR: 'always'
CARGO_TERM_VERBOSE: 'true'
RUSTDOCFLAGS: '-Dwarnings'
jobs:
test-linux:
name: Test (Linux)
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v4
- name: set up cargo cache
uses: actions/cache@v4
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@v4
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@stable
with:
components: rustfmt, clippy
- name: build
id: build
run: cargo build --workspace --all-targets --all-features
- name: run clippy
if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
- name: run tests
if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds
run: cargo test --workspace --all-features
- name: rustdoc
if: ${{ !cancelled() && steps.build.outcome == 'success' }} # always run if build succeeds
run: cargo doc --no-deps
examples-linux:
name: Examples (Linux)
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v4
- name: set up cargo cache
uses: actions/cache@v4
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@v4
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@v4
- uses: dtolnay/rust-toolchain@stable
- name: set up cargo cache
uses: actions/cache@v4
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@v4
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
- name: run tests
run: cargo test --workspace
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: rustfmt version
run: rustfmt --version
- name: cargo fmt
run: cargo fmt --all --check