name: CI
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal --component rustfmt
- run: cargo +1.98.0 fmt --all --check
clippy:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal --component clippy
- run: cargo +1.98.0 clippy --all-targets -- -D warnings
- run: cargo +1.98.0 clippy --all-targets --features test-util -- -D warnings
- run: cargo +1.98.0 clippy --all-targets --features tracing -- -D warnings
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal
- run: cargo +1.98.0 test --features test-util --test backend_matrix --test macos --no-run
if: runner.os != 'Windows'
- name: Test systemd-resolved on a disposable interface
if: runner.os == 'Linux'
run: |
sudo ip link add osdns-ci type dummy
trap 'sudo ip link delete osdns-ci' EXIT
sudo ip link set osdns-ci up
sudo env PATH="$PATH" RUSTFLAGS="$RUSTFLAGS" RUSTUP_HOME="$HOME/.rustup" CARGO_HOME="$HOME/.cargo" OSDNS_ALLOW_SYSTEM_MUTATION=1 OSDNS_TEST_INTERFACE=osdns-ci cargo +1.98.0 test --features test-util --test backend_matrix matrix_systemd_resolved_lifecycle -- --exact --nocapture
- run: ./.github/scripts/windows-integration.ps1
if: runner.os == 'Windows'
- run: sudo env PATH="$PATH" RUSTFLAGS="$RUSTFLAGS" RUSTUP_HOME="$HOME/.rustup" CARGO_HOME="$HOME/.cargo" OSDNS_ALLOW_SYSTEM_MUTATION=1 cargo +1.98.0 test --features test-util --test backend_matrix --test macos -- --test-threads=1
if: runner.os == 'macOS'
- run: cargo +1.98.0 test
- run: cargo +1.98.0 test --features test-util
- run: cargo +1.98.0 test --features tracing
openresolv:
runs-on: ubuntu-latest
container: debian:bookworm
steps:
- run: apt-get update && apt-get install -y ca-certificates curl build-essential git openresolv
- uses: actions/checkout@v4
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.98.0
- run: |
echo 'resolv_conf=/tmp/osdns-resolv.conf' >> /etc/resolvconf.conf
resolvconf -u
- run: $HOME/.cargo/bin/cargo +1.98.0 test --features test-util --test backend_matrix matrix_resolvconf_lifecycle -- --exact --nocapture
env:
OSDNS_ALLOW_SYSTEM_MUTATION: "1"
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.89.0 --profile minimal
- run: cargo +1.89.0 check --all-features --all-targets
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal
- run: cargo +1.98.0 doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
- run: cargo +1.98.0 test --doc --all-features
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal
- run: cargo +1.98.0 package --list
- run: cargo +1.98.0 package
- run: cargo +1.98.0 publish --dry-run
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- run: cargo install cargo-semver-checks --locked
- run: cargo +stable semver-checks check-release --manifest-path Cargo.toml
cross-check:
strategy:
fail-fast: false
matrix:
include:
- host: windows-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v4
- run: rustup target add ${{ matrix.target }}
- run: sudo apt-get update && sudo apt-get install -y clang llvm
if: runner.os == 'Linux'
- run: '"C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Append'
if: runner.os == 'Windows'
- run: cargo check --target ${{ matrix.target }} --all-targets --all-features
env:
CC: clang
AR: llvm-ar
CFLAGS: -ffreestanding
feature-powerset:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal
- run: cargo install cargo-hack --locked
- run: cargo +1.98.0 hack check --each-feature --no-dev-deps
deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- uses: EmbarkStudios/cargo-deny-action@v2
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- run: cargo install cargo-audit --locked
- run: cargo +stable audit
bench-compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.98.0 --profile minimal
- run: cargo +1.98.0 bench --features test-util --no-run