ci #1277
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: | |
push: | |
branches: | |
- "master" | |
- "**_ci" | |
pull_request: | |
schedule: | |
- cron: "0 1 * * 0" | |
env: | |
CARGO_TERM_COLOR: always | |
MIRIFLAGS: -Zmiri-disable-isolation | |
RUST_BACKTRACE: full | |
jobs: | |
ci: | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- 1.73.0 # MSRV | |
runs_on: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
feature: | |
- net-std | |
- net-async-std | |
- net-tokio | |
- net-smol | |
- all | |
- "" | |
include: | |
- runs_on: ubuntu-latest | |
feature: net-tokio,socket2 | |
rust: stable | |
- runs_on: ubuntu-latest | |
feature: net-tokio,socket2 | |
rust: beta | |
- runs_on: ubuntu-latest | |
feature: net-tokio,socket2 | |
rust: 1.73.0 # MSRV | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt,clippy | |
- name: build rsdns | |
if: ${{ matrix.feature != 'all' && matrix.feature != '' }} | |
run: cargo build --no-default-features --features ${{ matrix.feature }} | |
- name: build all rsdns | |
if: ${{ matrix.feature == 'all' }} | |
run: cargo build --all-features | |
- name: build no-default-features rsdns | |
if: ${{ matrix.feature == '' }} | |
run: cargo build --no-default-features | |
- name: test rsdns | |
if: ${{ matrix.feature != 'all' && matrix.feature != '' }} | |
run: cargo test --no-default-features --features ${{ matrix.feature }} | |
- name: test all rsdns | |
if: ${{ matrix.feature == 'all' }} | |
run: cargo test --all-features | |
- name: test no-default-features rsdns | |
if: ${{ matrix.feature == '' }} | |
run: cargo test --no-default-features | |
- name: lint rsdns | |
if: ${{ matrix.feature != 'all' && matrix.feature != '' }} | |
run: cargo clippy --no-default-features --features ${{ matrix.feature }} --all-targets | |
- name: lint all rsdns | |
if: ${{ matrix.feature == 'all' }} | |
run: cargo clippy --all-features --all-targets | |
- name: lint no-default-features rsdns | |
if: ${{ matrix.feature == '' }} | |
run: cargo clippy --no-default-features --all-targets | |
common-ci: | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- name: format all | |
run: cargo fmt -- --check | |
- name: doc rsdns | |
env: | |
RUSTDOCFLAGS: "--cfg docsrs" | |
run: cargo doc --all-features --no-deps | |
no-rustfmt: | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: remove rustfmt | |
run: | | |
if which rustfmt; then | |
rm $(which rustfmt) | |
echo "remove-rustfmt: OK" | |
fi | |
if which rustfmt; then | |
echo "remove-rustfmt: VERIFY ERR" | |
exit 1 | |
fi | |
shell: bash | |
- name: build with minimal toolchain | |
run: cargo build --all-features | |
- name: test with minimal toolchain | |
run: cargo build --all-features | |
- name: check with minimal toolchain | |
run: cargo check --all-features | |
fuzz: | |
runs-on: ubuntu-latest | |
steps: | |
- name: install llvm-12 | |
run: sudo apt install -y llvm-12 | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- uses: jannekem/run-python-script-action@v1 | |
with: | |
script: | | |
lines = [] | |
with open("fuzz/Cargo.toml", "r") as cargo: | |
lines = cargo.readlines() | |
for i in range(len(lines)): | |
if lines[i] == '# path = ".."\n': | |
lines[i] = 'path = ".."\n' | |
print('rsdns path set to ".."') | |
with open("fuzz/Cargo.toml", "w") as cargo: | |
cargo.write(''.join(lines)) | |
print('Cargo.toml updated succcessfully') | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: llvm-tools-preview,rust-src | |
- name: install cargo-fuzz | |
run: cargo install cargo-fuzz | |
- name: fuzz rrset_from_msg | |
run: cargo fuzz run rrset_from_msg -- -max_total_time=5 -verbosity=0 | |
miri: | |
if: false # disabled until miri RAM consumption is fixed | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: | |
runs_on: | |
- ubuntu-latest | |
feature: | |
- all | |
- "" | |
- default | |
- net-std | |
- net-async-std | |
- net-tokio | |
- net-tokio,socket2 | |
- net-smol | |
steps: | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- id: find_miri | |
run: | | |
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) | |
echo "Found miri at: $MIRI_NIGHTLY" | |
echo "miri=$MIRI_NIGHTLY" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ steps.find_miri.outputs.miri }} | |
components: miri,rust-src,rustfmt | |
- name: miri | |
if: ${{ matrix.feature != 'all' && matrix.feature != '' }} | |
run: cargo miri test --no-default-features --features ${{ matrix.feature }} | |
- name: miri all | |
if: ${{ matrix.feature == 'all' }} | |
run: cargo miri test --all-features | |
- name: miri no-default-features | |
if: ${{ matrix.feature == '' }} | |
run: cargo miri test --no-default-features |