Skip to content

Commit

Permalink
Merge pull request #316 from epage/template
Browse files Browse the repository at this point in the history
chore: Update from _rust/main template
  • Loading branch information
epage committed Apr 17, 2024
2 parents 98ce803 + 258f25c commit 9f810cc
Show file tree
Hide file tree
Showing 27 changed files with 339 additions and 165 deletions.
5 changes: 4 additions & 1 deletion .clippy.toml
@@ -1,5 +1,8 @@
msrv = "1.71" # MSRV
warn-on-all-wildcard-imports = true
allow-print-in-tests = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
disallowed-methods = [
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
Expand Down
38 changes: 36 additions & 2 deletions .github/renovate.json5
Expand Up @@ -3,6 +3,7 @@
'before 5am on the first day of the month',
],
semanticCommits: 'enabled',
commitMessageLowerCase: 'never',
configMigration: true,
dependencyDashboard: true,
customManagers: [
Expand All @@ -20,7 +21,25 @@
'MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV',
],
depNameTemplate: 'rust',
depNameTemplate: 'MSRV',
packageNameTemplate: 'rust-lang/rust',
datasourceTemplate: 'github-releases',
},
{
customType: 'regex',
fileMatch: [
'^rust-toolchain\\.toml$',
'Cargo.toml$',
'clippy.toml$',
'\\.clippy.toml$',
'^\\.github/workflows/ci.yml$',
'^\\.github/workflows/rust-next.yml$',
],
matchStrings: [
'STABLE.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?STABLE',
],
depNameTemplate: 'STABLE',
packageNameTemplate: 'rust-lang/rust',
datasourceTemplate: 'github-releases',
},
Expand All @@ -32,7 +51,7 @@
'custom.regex',
],
matchPackageNames: [
'rust',
'MSRV',
],
minimumReleaseAge: '840 days', // 20 releases * 6 weeks per release * 7 days per week
internalChecksFilter: 'strict',
Expand All @@ -41,6 +60,19 @@
'* * * * *',
],
},
{
commitMessageTopic: 'Rust Stable',
matchManagers: [
'custom.regex',
],
matchPackageNames: [
'STABLE',
],
extractVersion: '^(?<version>\\d+\\.\\d+)', // Drop the patch version
schedule: [
'* * * * *',
],
},
// Goals:
// - Keep version reqs low, ignoring compatible normal/build dependencies
// - Take advantage of latest dev-dependencies
Expand Down Expand Up @@ -72,6 +104,7 @@
matchCurrentVersion: '>=1.0.0',
matchUpdateTypes: [
'minor',
'patch',
],
enabled: false,
},
Expand Down Expand Up @@ -99,6 +132,7 @@
matchCurrentVersion: '>=1.0.0',
matchUpdateTypes: [
'minor',
'patch',
],
automerge: true,
groupName: 'compatible (dev)',
Expand Down
26 changes: 15 additions & 11 deletions .github/settings.yml
Expand Up @@ -24,14 +24,18 @@ repository:
squash_merge_commit_message: "PR_BODY"
merge_commit_message: "PR_BODY"

branches:
- name: main
protection:
required_pull_request_reviews: null
required_conversation_resolution: true
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: false
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
enforce_admins: false
restrictions: null
# This serves more as documentation.
# Branch protection API was replaced by rulesets but settings isn't updated.
# See https://github.com/repository-settings/app/issues/825
#
# branches:
# - name: main
# protection:
# required_pull_request_reviews: null
# required_conversation_resolution: true
# required_status_checks:
# # Required. Require branches to be up to date before merging.
# strict: false
# contexts: ["CI", "Spell Check with Typos"]
# enforce_admins: false
# restrictions: null
4 changes: 4 additions & 0 deletions .github/workflows/audit.yml
Expand Up @@ -17,6 +17,10 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
security_audit:
permissions:
Expand Down
59 changes: 41 additions & 18 deletions .github/workflows/ci.yml
Expand Up @@ -14,21 +14,27 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
ci:
permissions:
contents: none
name: CI
needs: [test, msrv, docs, rustfmt, clippy]
needs: [test, msrv, lockfile, docs, rustfmt, clippy]
runs-on: ubuntu-latest
if: "always()"
steps:
- name: Done
run: exit 0
- name: Failed
run: exit 1
if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')"
test:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
os: ["ubuntu-latest", "windows-latest", "macos-14"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
Expand All @@ -42,25 +48,25 @@ jobs:
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run --workspace --all-features
run: cargo test --workspace --no-run
- name: Test
run: cargo hack test --workspace --feature-powerset
run: cargo hack test --feature-powerset --workspace
- name: Run crate example
run: cargo run --example default
msrv:
name: "Check MSRV: 1.71"
name: "Check MSRV"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.71" # MSRV
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Check
run: cargo hack check --workspace --all-targets --feature-powerset
- name: Default features
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --all-targets
lockfile:
runs-on: ubuntu-latest
steps:
Expand All @@ -72,7 +78,7 @@ jobs:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: "Is lockfile updated?"
run: cargo fetch --locked
run: cargo update --workspace --locked
docs:
name: Docs
runs-on: ubuntu-latest
Expand All @@ -82,7 +88,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
toolchain: "1.76" # STABLE
- uses: Swatinem/rust-cache@v2
- name: Check documentation
env:
Expand All @@ -97,9 +103,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
# Not MSRV because its harder to jump between versions and people are
# more likely to have stable
toolchain: stable
toolchain: "1.76" # STABLE
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
Expand All @@ -115,13 +119,13 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.71" # MSRV
toolchain: "1.76" # STABLE
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install SARIF tools
run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv
run: cargo install clippy-sarif --locked
- name: Install SARIF tools
run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv
run: cargo install sarif-fmt --locked
- name: Check
run: >
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
Expand All @@ -136,3 +140,22 @@ jobs:
wait-for-processing: true
- name: Report status
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Gather coverage
run: cargo tarpaulin --output-dir coverage --out lcov
- name: Publish to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .github/workflows/committed.yml
Expand Up @@ -11,6 +11,10 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
committed:
name: Lint Commits
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yml
Expand Up @@ -12,6 +12,10 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
pre-commit:
permissions:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/rust-next.yml
Expand Up @@ -12,12 +12,16 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
test:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-14"]
rust: ["stable", "beta"]
include:
- os: ubuntu-latest
Expand All @@ -34,9 +38,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run --workspace --all-features
run: cargo test --workspace --no-run
- name: Test
run: cargo hack test --workspace --feature-powerset
run: cargo hack test --feature-powerset --workspace
- name: Run crate example
run: cargo run --example default
latest:
Expand All @@ -54,8 +58,8 @@ jobs:
- name: Update dependencues
run: cargo update
- name: Build
run: cargo test --no-run --workspace --all-features
run: cargo test --workspace --no-run
- name: Test
run: cargo hack test --workspace --feature-powerset
run: cargo hack test --feature-powerset --workspace
- name: Run crate example
run: cargo run --example default
4 changes: 4 additions & 0 deletions .github/workflows/spelling.yml
Expand Up @@ -10,6 +10,10 @@ env:
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
spelling:
name: Spell Check with Typos
Expand Down

0 comments on commit 9f810cc

Please sign in to comment.