Skip to content

ci: Use auguwu/[email protected] to run clippy

ci: Use auguwu/[email protected] to run clippy #90

Workflow file for this run

# We use `actions-rs` for most of our actions
#
# This file is for the main tests. clippy & rustfmt are separate workflows
on: [push, pull_request]
name: Cargo Test
env:
CARGO_TERM_COLOR: always
# has a history of occasional bugs (especially on old versions)
#
# the ci is free so we might as well use it ;)
CARGO_INCREMENTAL: 0
# Tested versions:
# 1. stable
# 2. nightly
# 3. Minimum Supported Rust Version (MSRV)
jobs:
test:
permissions:
# Needed for auguwu/clippy-action
checks: write
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false # Even if one job fails we still want to see the other ones
matrix:
rust:
# Minimum Supported Rust Version: 1.49
#
# This is hardcoded and needs to be in sync with Cargo.toml and the README
#
# Right now we have to explicitly list the combination of features & msrv,
# because some feature combinations are unsupported (currently nested-values).
#
# TODO: Once the MSRV supports all feature combos, add this back
# - << put msrv here >>
# Per the MSRV policy (discussed in Wiki/docs), this places an upper bound on the MSRV
#
# In other words, we can never raise the MSRV past this, and must always support it.
- "stable minus 15 releases"
# Major release 1.56: The first version to support `edition="2021"`
#
# This appears to be the earliest version that `erased-serde` supports,
# so is the earliest one we can enable the 'nested-values' feature.
- 1.56
# A recent version of stable rust that is hardcoded.
#
# This should be kept as up to date as possible.
#
# This is used so that clippy & tests are run on a reliable reference point.
# If clippy has any warnings, this will fail the build (we run with --deny warnings)
- 1.72
# The most recent version of stable rust (automatically updated)
#
# Sometimes, this is exactly the same as the hardcoded right above.
# However sometimes it will be automatically updated to something a little newer.
#
# If there are new clippy lints in the automatic update that aren't
# in the hardcoded versions, they will _NOT_ fail the build.
# This is true even if they are set to deny by default (clippy does this for some 'correctness' lints).
# They will simply be regular warnings.
- stable
- nightly
# NOTE: Features to test must be specified manually. They are applied to all versions separately.
#
# This has the advantage of being more flexibile and thorough
# This has the disadvantage of being more vebrose
#
# Specific feature combos can be overridden per-version with 'include' and 'ecclude'
features:
- ""
- "nested-values"
- "dynamic-keys"
- "nothreads"
- "nested-values dynamic-keys"
- "nested-values dynamic-keys nothreads"
include:
# Minimum Supported Rust Version (1.49) doesn't support nested-values feature
#
# This is because the erased-serde dependency currently requires edition="2021", which was added in Rust 1.56.
# As a workaround, we explicitly include the combinations of features that we want to test on MSRV.
#
# TODO: Go back to testing all features (see above)
- rust: 1.49
features: "" # Default features
- rust: 1.49
features: "dynamic-keys"
- rust: 1.49
features: "nothreads"
- rust: 1.49
features: "nothreads dynamic-keys" # All (supported) features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- name: Check
# A failing `cargo check` always ends the build
run: |
cargo check --all-targets --verbose --features "${{ matrix.features }}"
# A failing `cargo check` always fails the build
continue-on-error: false
- name: Test
run: |
cargo test --all-targets --verbose --features "${{ matrix.features }}"
# We require tests to succeed on all the feature combinations.
#
# However, we can grant special exceptions for the Minimum Supported Rust Version
# if there is a really good reason (like a dependency that requires a newer version).
continue-on-error: false
- name: Clippy
# TODO: Use actual auguwu/clippy-action action instead of my fork
uses: Techcable/clippy-action@input/features
with:
check-args: --all-targets
features: "${{ matrix.features }}"
token: ${{secrets.GITHUB_TOKEN}}