Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Merge pull request #7 from tweedegolf/dependabot/github_actions/taiki… #23

Merge pull request #7 from tweedegolf/dependabot/github_actions/taiki…

Merge pull request #7 from tweedegolf/dependabot/github_actions/taiki… #23

Workflow file for this run

name: Checks
permissions:
contents: read
on:
push:
branches:
- main
merge_group:
branches:
- main
jobs:
build:
name: Build and test
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- rust: "stable"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
- rust: "msrv"
target: "x86_64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
- rust: "stable"
target: "x86_64-unknown-linux-musl"
os: ubuntu-latest
features: "--all-features"
- rust: "stable"
target: "aarch64-unknown-linux-gnu"
os: ubuntu-latest
features: "--all-features"
steps:
- name: Checkout sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false
- name: Set target rust version
run: echo "TARGET_RUST_VERSION=$(if [ "${{matrix.rust}}" = "msrv" ]; then grep rust-version Cargo.toml | grep MSRV | cut -d'"' -f2; else echo "${{matrix.rust}}"; fi)" >> $GITHUB_ENV
- name: Install toolchain
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a
with:
toolchain: "${TARGET_RUST_VERSION}"
targets: "${{ matrix.target }}"
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@241e9bf5f01f63286a020946ddaa3fd6d9c32cca # v1.22.0
with:
target: ${{ matrix.target }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@9b00020f6f75a34aa11872329c46b410780fda7e # v2.34.2
with:
tool: cargo-llvm-cov
- name: Rust cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: "${{matrix.rust}}-${{matrix.target}}"
- name: cargo build
run: cargo build ${{ matrix.features }}
- name: cargo test
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info
env:
RUST_BACKTRACE: 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
unused:
name: Check unused dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a
with:
toolchain: nightly
- name: Install udeps
uses: taiki-e/install-action@9b00020f6f75a34aa11872329c46b410780fda7e # v2.34.2
with:
tool: cargo-udeps
- name: cargo udeps
run: cargo udeps --workspace --all-targets
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
clippy:
name: Clippy
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
use_zig: false
zig_args: ""
- target: aarch64-unknown-linux-gnu
use_zig: true
zig_args: "-target aarch64-linux-gnu -g"
- target: armv7-unknown-linux-gnueabihf
use_zig: true
zig_args: "-target arm-linux-gnueabihf -mcpu=generic+v7a+vfp3-d32+thumb2-neon -g"
- target: x86_64-unknown-linux-musl
use_zig: true
zig_args: "-target x86_64-linux-musl"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a
with:
toolchain: stable
components: clippy
targets: ${{matrix.target}}
# Use zig as our C compiler for convenient cross-compilation. We run into rustls having a dependency on `ring`.
# This crate uses C and assembly code, and because of its build scripts, `cargo clippy` needs to be able to compile
# that code for our target.
- uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0
with:
version: 0.9.0
if: ${{matrix.use_zig}}
- name: Install cargo-zigbuild
uses: taiki-e/install-action@9b00020f6f75a34aa11872329c46b410780fda7e # v2.34.2
with:
tool: cargo-zigbuild
if: ${{matrix.use_zig}}
- name: Set TARGET_CC for zig
run: echo "TARGET_CC=/home/runner/.cargo/bin/cargo-zigbuild zig cc -- ${{matrix.zig_args}}" >> $GITHUB_ENV
if: ${{matrix.use_zig}}
- name: Rust cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
shared-key: "stable-${{matrix.target}}"
- name: Run clippy
run: cargo clippy --target ${{matrix.target}} --workspace --all-targets --all-features -- -D warnings
audit-dependencies:
name: Audit dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: EmbarkStudios/cargo-deny-action@3f4a782664881cf5725d0ffd23969fcce89fd868
with:
arguments: --workspace --all-features