CI #329
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 | |
schedule: | |
- cron: '0 2 * * *' | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
rust: [nightly, beta, stable] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} | |
- run: cargo build --all --all-features --all-targets | |
- name: Run cargo check (without dev-dependencies to catch missing feature flags) | |
if: startsWith(matrix.rust, 'nightly') | |
run: cargo check -Z features=dev_dep | |
- run: cargo test | |
# Copied from: https://github.com/rust-lang/stacker/pull/19/files | |
windows_gnu: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
rust: [nightly] | |
target: | |
- x86_64-pc-windows-gnu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe. | |
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} | |
- run: rustup target add ${{ matrix.target }} | |
# https://github.com/rust-lang/rust/issues/49078 | |
- name: Fix windows-gnu rust-mingw | |
run : | | |
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do | |
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/lib/$i" "`rustc --print sysroot`/lib/rustlib/x86_64-pc-windows-gnu/lib" | |
done | |
shell: bash | |
- run: cargo build --target ${{ matrix.target }} --all --all-features --all-targets | |
- run: cargo test --target ${{ matrix.target }} | |
cross: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup update stable | |
- name: Install cross | |
uses: taiki-e/install-action@v1 | |
with: | |
# https://github.com/cross-rs/cross/issues/724 | |
tool: [email protected] | |
- name: Android | |
if: startsWith(matrix.os, 'ubuntu') | |
run: cross test --target arm-linux-androideabi | |
- name: NetBSD | |
if: startsWith(matrix.os, 'ubuntu') | |
run: cross build --target x86_64-unknown-netbsd | |
- name: FreeBSD | |
if: startsWith(matrix.os, 'ubuntu') | |
run: cross build --target x86_64-unknown-freebsd | |
- name: iOS | |
if: startsWith(matrix.os, 'macos') | |
run: cross build --target aarch64-apple-ios | |
# - name: illumos | |
# if: startsWith(matrix.os, 'ubuntu') | |
# run: cross build --target x86_64-unknown-illumos | |
msrv: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# When updating this, the reminder to update the minimum supported | |
# Rust version in Cargo.toml and .clippy.toml. | |
ad_rust: ['1.47'] | |
dp_rust: ['1.41'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust for async-dns | |
run: rustup update ${{ matrix.ad_rust }} && rustup default ${{ matrix.ad_rust }} | |
- run: cargo build | |
- name: Install Rust for dns-protocol | |
run: rustup update ${{ matrix.dp_rust }} && rustup default ${{ matrix.dp_rust }} | |
- run: cargo build -p dns-protocol | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup update stable | |
- run: cargo clippy --all-features --all-targets | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
run: rustup update stable | |
- run: cargo fmt --all --check | |
security_audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |