Skip to content

ci(release): measure static linkage on dry runs instead of inferring it #299

ci(release): measure static linkage on dry runs instead of inferring it

ci(release): measure static linkage on dry runs instead of inferring it #299

Workflow file for this run

# SPDX-FileCopyrightText: 2025 Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
#
# SPDX-License-Identifier: LicenseRef-PlainMIT OR MIT
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
# beta/nightly are informational: a toolchain regression upstream should not
# gate merges, but we still want to see it.
continue-on-error: ${{ matrix.rust != 'stable' }}
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v6
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
- name: Cache cargo index
uses: actions/cache@v6
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
- name: Cache cargo build
uses: actions/cache@v6
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
# The integration harness shells out to git; give it a committer identity.
- name: Setup git
run: |
git config --global user.email "ci@example.com"
git config --global user.name "CI"
- name: Run tests
run: cargo nextest run --all-features --no-fail-fast
lint:
name: lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Install hk with mise
uses: jdx/mise-action@v4
env:
HK_MISE: 1
MISE_YES: 1
with:
experimental: true
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
reshim: true
install: true
mise_toml: |
[tools]
rust = "1.89"
act = "latest"
"cargo:cargo-deny" = { version = "latest", depends = ["rust"] }
"cargo:cargo-nextest" = { version = "latest", depends = ["rust"] }
hk = { version = "1.48", depends = ["pkl"], postinstall = 'hk install --mise || true'}
pkl = "latest"
typos = { version = "latest", depends = ["rust"] }
# mise installs the toolchain without optional components, so cargo_fmt and
# cargo_clippy have no binary to call.
- name: Add rustfmt and clippy components
run: rustup component add rustfmt clippy
# --all: hk defaults to staged/changed files, which on a fresh CI checkout
# leaves most steps with nothing to do. --skip-step cargo_test: the test
# job above owns running the suite. --no-fail-fast: report every lint
# problem in one run instead of aborting the rest on the first failure.
- name: Run hk check
env:
HK_MISE: 1
MISE_YES: 1
run: hk check --all --skip-step cargo_test --no-fail-fast
security_audit:
name: Security Audit
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
steps:
- uses: actions/checkout@v7
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN || github.token }}
# Keep in sync with the `ignore` list in deny.toml, which documents why
# each of these is accepted.
ignore: RUSTSEC-2024-0364
coverage:
name: Code Coverage
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@67ef31d5b988238dd797d409d6f9574278e20537
with:
toolchain: 1.91
components: llvm-tools-preview
- name: Setup git
run: |
git config --global user.email "ci@example.com"
git config --global user.name "CI"
- name: install other components
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
- name: Generate code coverage
run: |
cargo llvm-cov \
nextest --all-features --workspace \
--lcov --output-path lcov.info \
--ignore-filename-regex '\.cargo[/\\]registry|\.cargo[/\\]git|rustup[/\\]toolchains|/rustc/|scripts[/\\]|tests[/\\]|examples[/\\]|benches[/\\]|target[/\\]|.*long_about.rs|.*lib.rs' \
--manifest-path Cargo.toml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Log report
run: |
cat lcov.info