mirror of
https://github.com/NLnetLabs/domain.git
synced 2026-09-24 02:34:56 +02:00
The MSRV is being bumped so that `domain` can access newer language features. In particular: - `<[u8]>::utf8_chunks()` (1.79) is very useful for processing byte strings that will _mostly_ contain valid UTF-8 text. - `core::net` (1.77) allows us to remove our polyfills of `Ipv4Addr` etc., used when the `std` feature is disabled. - `async fn` and return-position `impl Trait` in traits (1.75) allow us to define traits using `async fn`, avoiding the overhead of `Box<dyn Future>` for un-nameable future types. - `Option::is_some_and()` (1.70) simplifies a very common pattern when inspecting optional values. The MSRV bump policy is also being updated; it sets a maximum MSRV (relative to the latest stable Rust version) and documents the conditions under which a bump will occur.
119 lines
4.3 KiB
YAML
119 lines
4.3 KiB
YAML
name: ci
|
|
# Don't run on push as well as pull_request otherwise the jobs will be run
|
|
# twice [1]. Run on pull_request instead of push as otherwise code is not
|
|
# built & tested against the PR target branch as if it were already merged
|
|
# (thus hiding issues until post-merge).
|
|
# [1]: https://github.com/orgs/community/discussions/26940
|
|
on: pull_request
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
rust: [1.79.0, stable, beta, nightly]
|
|
env:
|
|
RUSTFLAGS: "-D warnings"
|
|
# We use 'vcpkg' to install OpenSSL on Windows.
|
|
VCPKG_ROOT: "${{ github.workspace }}\\vcpkg"
|
|
VCPKGRS_TRIPLET: x64-windows-release
|
|
# Ensure that OpenSSL is dynamically linked.
|
|
VCPKGRS_DYNAMIC: 1
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
- name: Install Rust
|
|
uses: hecrj/setup-rust-action@v2
|
|
with:
|
|
rust-version: ${{ matrix.rust }}
|
|
- if: matrix.os == 'ubuntu-latest'
|
|
run: sudo apt-get install -y libssl-dev
|
|
- if: matrix.os == 'windows-latest'
|
|
id: vcpkg
|
|
uses: johnwason/vcpkg-action@v6
|
|
with:
|
|
pkgs: openssl
|
|
triplet: ${{ env.VCPKGRS_TRIPLET }}
|
|
token: ${{ github.token }}
|
|
github-binarycache: true
|
|
- if: matrix.rust == 'stable'
|
|
run: rustup component add clippy
|
|
- if: matrix.rust == 'stable'
|
|
run: cargo clippy --all-features --all-targets -- -D warnings
|
|
- if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
|
|
run: cargo fmt --all -- --check
|
|
- run: cargo check --no-default-features --all-targets
|
|
- run: cargo test --all-features
|
|
|
|
minimal-versions:
|
|
name: Check minimal versions
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTFLAGS: "-D warnings"
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
- name: Install Rust
|
|
uses: hecrj/setup-rust-action@v2
|
|
with:
|
|
rust-version: "1.79.0"
|
|
- name: Install OpenSSL
|
|
run: sudo apt-get install -y libssl-dev
|
|
- name: Install nightly Rust
|
|
run: rustup install nightly
|
|
- name: Check with minimal-versions
|
|
run: |
|
|
cargo +nightly update -Z minimal-versions
|
|
cargo check --all-features --all-targets --locked
|
|
|
|
# Note: This deliberately doesn't try to run the examples as some of them
|
|
# don't terminate and/or attempt to make network connections that will fail
|
|
# or perhaps be a nuisance to real name servers if run regularly by CI.
|
|
#
|
|
# Note: This is just a band aid, ideally there would be a way for Cargo to
|
|
# build/run examples using the feature set specified in Cargo.toml itself,
|
|
# but that isn't currently possible (see [1]).
|
|
#
|
|
# [1]: https://github.com/rust-lang/cargo/issues/4663)
|
|
build-examples:
|
|
name: Build examples
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust: [1.79.0, stable, beta, nightly]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
- name: Install Rust
|
|
uses: hecrj/setup-rust-action@v2
|
|
with:
|
|
rust-version: ${{ matrix.rust }}
|
|
- name: Compile all examples
|
|
shell: bash
|
|
# TODO: Emit matrix elements based on inspecting Cargo.toml so that
|
|
# each example runs as its own GitHub Actions step/job?
|
|
run: |
|
|
# Generate the set of cargo check --example X --features Y commands to
|
|
# run and store them in a temporary script. This command works by
|
|
# extracting the example blocks from the Cargo.toml file and the set
|
|
# of features that the block indicates are needed to run the example.
|
|
# E.g. given this block in Cargo.toml:
|
|
#
|
|
# [[example]]
|
|
# name = "lookup"
|
|
# required-features = ["resolv"]
|
|
#
|
|
# It outputs a line that looks like this:
|
|
#
|
|
# cargo check --example lookup --features resolv
|
|
#
|
|
# One line per example is output and the set of lines directed to a temporary
|
|
# shell script file which is then run in the next step.
|
|
|
|
cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].targets[] | select(.kind[] | contains("example")) | "cargo check --example \(.name) --features \(."required-features" | flatten | join(","))"' > ${{ runner.temp }}/check-examples.sh
|
|
|
|
# Run the temporary script:
|
|
|
|
bash -x -e ${{ runner.temp }}/check-examples.sh
|