Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2
updates:
- package-ecosystem: "cargo"
# Scan the workspace root; cargo sub-crates are reachable via
# [workspace] members and will be included in the Cargo.lock.
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "06:00"
open-pull-requests-limit: 10
labels:
- "dependencies"
- "cargo"
# Track all dependencies the project depends on, including
# indirect ones. The crate is pre-1.0 so we do not want to
# auto-merge; we want a PR per bump so reviewers can spot
# regressions.
allow:
- dependency-type: "direct"
- dependency-type: "indirect"
groups:
patch:
patterns:
- "*"
update-types:
- "patch"
minor:
patterns:
- "*"
update-types:
- "minor"
commit-message:
prefix: "deps"
include: "scope"
132 changes: 76 additions & 56 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,89 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
msrv:
name: Verify MSRV (1.99.1)
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain (1.99.1)
uses: dtolnay/rust-toolchain@1.99.1

- name: Check
run: cargo check --all-features

build_linux:
needs: msrv
name: Build Linux
strategy:
fail-fast: false # force all builds to run even if one fails
matrix:
include:
- target: x86_64-unknown-linux-gnu
rust: stable
run-tests: true
- target: aarch64-unknown-linux-gnu
rust: nightly
run-tests: true
- target: riscv64gc-unknown-linux-gnu
rust: nightly
run-tests: true
runs-on: [self-hosted, linux, x64]

# The runner image ships the cross std for the aarch64 and riscv64gc
# gnu targets on the nightly toolchain and points CARGO_TARGET_*_LINKER
# at the cross compilers in PATH, so the cross clippy, build, and test
# runs execute nightly with --target while staying on the x64 host.
# Clippy and the build stop at checked and emitted code, so they need
# no target execution; the test run executes foreign-arch binaries,
# and the image points CARGO_TARGET_*_RUNNER at the matching static
# qemu-user emulators, so cargo runs the cross test binaries, the
# doctests included, through them. The fmt check stays on the default
# stable toolchain.
steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain
if: matrix.run-tests
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Check Code Format
if: matrix.run-tests
run: cargo fmt --all -- --check

- name: Code Lint
run: cargo clippy --all-targets --all-features -- -D warnings
if: matrix.run-tests
run: cargo +${{ matrix.rust }} clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings

- name: Build
run: cargo build --verbose --all-features
run: cargo +${{ matrix.rust }} build --verbose --all-features --target ${{ matrix.target }}

- name: Run tests
run: cargo test --verbose --all-features
if: matrix.run-tests
# The test list enables every feature except the three slow gates,
# so the test jobs stay inside their budgets (docs/ci-test-budget.md).
# Keep the list in sync with the [features] table. Code Lint above
# keeps --all-features, so the gated code stays lint-checked.
run: |
cargo +${{ matrix.rust }} test --verbose --features deprecated,legacy_chacha20_fallback,wasm --target ${{ matrix.target }}

build_macos:
needs: msrv
name: Build macOS
strategy:
fail-fast: false # force all builds to run even if one fails
matrix:
include:
- target: aarch64-apple-darwin
rust: stable
run-tests: true
- target: x86_64-apple-darwin
rust: stable
run-tests: true
runs-on: [self-hosted, macos, arm64]

steps:
Expand All @@ -48,64 +102,30 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
components: rustfmt, clippy

- name: Build
run: cargo build --target ${{ matrix.target }} --release --all-features

msrv:
name: Verify MSRV (1.99)
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain (1.99)
uses: dtolnay/rust-toolchain@1.99.0

- name: Check
run: cargo check --all-features

ensure_no_std:
name: Ensure no_std
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain (nightly)
uses: dtolnay/rust-toolchain@nightly
with:
targets: thumbv6m-none-eabi

- name: Build (no_std)
run: cargo build --no-default-features --target thumbv6m-none-eabi
shell: bash

coverage:
name: Coverage
runs-on: [self-hosted, linux, x64]

steps:
- uses: actions/checkout@v4

- name: Install Rust Toolchain (stable)
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Check Code Format
if: matrix.run-tests
run: cargo fmt --all -- --check

- name: Install cargo-llvm-cov
run: command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov
- name: Code Lint
if: matrix.run-tests
run: cargo +${{ matrix.rust }} clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings

- name: Run coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Build
run: cargo +${{ matrix.rust }} build --verbose --all-features --target ${{ matrix.target }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
- name: Run tests
if: matrix.run-tests
# The test list enables every feature except the three slow gates,
# so the test jobs stay inside their budgets (docs/ci-test-budget.md).
# Keep the list in sync with the [features] table. Code Lint above
# keeps --all-features, so the gated code stays lint-checked.
run: |
cargo +${{ matrix.rust }} test --verbose --features deprecated,legacy_chacha20_fallback,wasm --target ${{ matrix.target }}

audit:
needs: [build_linux, build_macos]
name: Security Audit
runs-on: [self-hosted, linux, x64]

Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ categories = ["encoding", "data-structures"]
[features]
default = ["std"]
std = ["unsigned-varint/std"]
# Feature names required by the shared family CI workflow test step. No code
# in this crate gates on these yet.
deprecated = []
legacy_chacha20_fallback = []
wasm = []

[dependencies]
thiserror = { version = "2.0", default-features = false }
Expand Down
Loading