ci: bump actions to v4 and add minor enhancements #168
Workflow file for this run
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: Build & Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- master | |
# Allow to manually run the workflow through Github Actions. | |
workflow_dispatch: | |
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build & Test | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
# Minumum Supported Rust Version (MSRV) is 1.63.0. | |
toolchain: [1.63.0, stable, beta, nightly] | |
include: | |
- toolchain: 1.63.0 | |
msrv: true | |
features: | |
- default | |
- database | |
- dns | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Set Rust Profile | |
run: rustup set profile minimal | |
- name: Update Rust Toolchain | |
run: rustup update | |
- name: Pin Dependencies | |
if: matrix.msrv | |
run: | | |
cargo update -p allocator-api2 --precise "0.2.9" --verbose | |
- name: Build | |
run: cargo build features ${{ matrix.features }} --no-default-features | |
- name: Test | |
run: cargo test --features ${{ matrix.features }} --no-default-features | |
clippy: | |
name: Clippy | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
# Minumum Supported Rust Version (MSRV) is 1.63.0. | |
toolchain: [1.63.0, stable, beta, nightly] | |
include: | |
- toolchain: 1.63.0 | |
msrv: true | |
features: | |
- default | |
- database | |
- dns | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Set Rust Profile | |
run: rustup set profile minimal | |
- name: Update Rust Toolchain | |
run: rustup update | |
- name: Pin Dependencies | |
if: matrix.msrv | |
run: | | |
cargo update -p allocator-api2 --precise "0.2.9" --verbose | |
- name: Clippy | |
run: cargo clippy --all-targets --features ${{ matrix.features }} --no-default-features -- -D warnings | |
fmt: | |
name: Formatting | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
# Minumum Supported Rust Version (MSRV) is 1.63.0. | |
toolchain: [1.63.0, stable, beta, nightly] | |
include: | |
- toolchain: 1.63.0 | |
msrv: true | |
features: | |
- default | |
- database | |
- dns | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} | |
- name: Install Rust Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Update Rust Toolchain | |
run: rustup update | |
- name: Formatting | |
run: cargo fmt --all -- --config format_code_in_doc_comments=true check |