Skip to content

Commit 2b27ede

Browse files
authored
Merge pull request #147 from epage/template
chore: Update from _rust/main template
2 parents 5a981e6 + 080e200 commit 2b27ede

File tree

14 files changed

+174
-59
lines changed

14 files changed

+174
-59
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[resolver]
2+
incompatible-rust-versions = "fallback"

.github/renovate.json5

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
commitMessageLowerCase: 'never',
77
configMigration: true,
88
dependencyDashboard: true,
9+
"pre-commit": {
10+
enabled: true
11+
},
912
customManagers: [
1013
{
1114
customType: 'regex',
12-
fileMatch: [
13-
'^rust-toolchain\\.toml$',
14-
'Cargo.toml$',
15-
'clippy.toml$',
16-
'\\.clippy.toml$',
17-
'^\\.github/workflows/ci.yml$',
18-
'^\\.github/workflows/rust-next.yml$',
15+
managerFilePatterns: [
16+
'/^rust-toolchain\\.toml$/',
17+
'/Cargo.toml$/',
18+
'/clippy.toml$/',
19+
'/\\.clippy.toml$/',
20+
'/^\\.github/workflows/ci.yml$/',
21+
'/^\\.github/workflows/rust-next.yml$/',
1922
],
2023
matchStrings: [
2124
'STABLE.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
@@ -25,6 +28,18 @@
2528
packageNameTemplate: 'rust-lang/rust',
2629
datasourceTemplate: 'github-releases',
2730
},
31+
{
32+
customType: 'regex',
33+
managerFilePatterns: [
34+
'/^\\.github/workflows/pre-commit.yml$/',
35+
],
36+
matchStrings: [
37+
'prek-version.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
38+
],
39+
depNameTemplate: 'prek',
40+
packageNameTemplate: 'j178/prek',
41+
datasourceTemplate: 'github-releases',
42+
},
2843
],
2944
packageRules: [
3045
{
@@ -41,6 +56,20 @@
4156
],
4257
automerge: true,
4358
},
59+
{
60+
commitMessageTopic: 'Prek',
61+
matchManagers: [
62+
'custom.regex',
63+
],
64+
matchDepNames: [
65+
'prek',
66+
],
67+
extractVersion: '^(?<version>\\d+\\.\\d+\\.\\d+)',
68+
schedule: [
69+
'* * * * *',
70+
],
71+
automerge: true,
72+
},
4473
// Goals:
4574
// - Keep version reqs low, ignoring compatible normal/build dependencies
4675
// - Take advantage of latest dev-dependencies

.github/workflows/ci.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
rust: ["stable"]
3939
continue-on-error: ${{ matrix.rust != 'stable' }}
4040
runs-on: ${{ matrix.os }}
41+
env:
42+
# Reduce amount of data cached
43+
CARGO_PROFILE_DEV_DEBUG: line-tables-only
4144
steps:
4245
- name: Checkout repository
4346
uses: actions/checkout@v6
@@ -50,10 +53,13 @@ jobs:
5053
- name: Build
5154
run: cargo test --workspace --no-run
5255
- name: Test
53-
run: cargo hack test --feature-powerset --workspace
56+
run: cargo hack test --each-feature --workspace
5457
msrv:
5558
name: "Check MSRV"
56-
runs-on: ubuntu-latest
59+
strategy:
60+
matrix:
61+
os: ["ubuntu-latest"]
62+
runs-on: ${{ matrix.os }}
5763
steps:
5864
- name: Checkout repository
5965
uses: actions/checkout@v6
@@ -64,10 +70,13 @@ jobs:
6470
- uses: Swatinem/rust-cache@v2
6571
- uses: taiki-e/install-action@cargo-hack
6672
- name: Default features
67-
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --all-targets
73+
run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going
6874
minimal-versions:
6975
name: Minimal versions
70-
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
os: ["ubuntu-latest"]
79+
runs-on: ${{ matrix.os }}
7180
steps:
7281
- name: Checkout repository
7382
uses: actions/checkout@v6
@@ -82,7 +91,7 @@ jobs:
8291
- name: Downgrade dependencies to minimal versions
8392
run: cargo +nightly generate-lockfile -Z minimal-versions
8493
- name: Compile with minimal versions
85-
run: cargo +stable check --workspace --all-features --locked
94+
run: cargo +stable check --workspace --all-features --locked --keep-going
8695
lockfile:
8796
runs-on: ubuntu-latest
8897
steps:
@@ -104,12 +113,12 @@ jobs:
104113
- name: Install Rust
105114
uses: dtolnay/rust-toolchain@stable
106115
with:
107-
toolchain: "1.83" # STABLE
116+
toolchain: "1.93" # STABLE
108117
- uses: Swatinem/rust-cache@v2
109118
- name: Check documentation
110119
env:
111120
RUSTDOCFLAGS: -D warnings
112-
run: cargo doc --workspace --all-features --no-deps --document-private-items
121+
run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going
113122
rustfmt:
114123
name: rustfmt
115124
runs-on: ubuntu-latest
@@ -119,11 +128,11 @@ jobs:
119128
- name: Install Rust
120129
uses: dtolnay/rust-toolchain@stable
121130
with:
122-
toolchain: "1.83" # STABLE
131+
toolchain: "1.93" # STABLE
123132
components: rustfmt
124133
- uses: Swatinem/rust-cache@v2
125134
- name: Check formatting
126-
run: cargo fmt --all -- --check
135+
run: cargo fmt --check
127136
clippy:
128137
name: clippy
129138
runs-on: ubuntu-latest
@@ -135,7 +144,7 @@ jobs:
135144
- name: Install Rust
136145
uses: dtolnay/rust-toolchain@stable
137146
with:
138-
toolchain: "1.83" # STABLE
147+
toolchain: "1.93" # STABLE
139148
components: clippy
140149
- uses: Swatinem/rust-cache@v2
141150
- name: Install SARIF tools
@@ -144,7 +153,7 @@ jobs:
144153
run: cargo install sarif-fmt --locked
145154
- name: Check
146155
run: >
147-
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
156+
cargo clippy --workspace --all-features --all-targets --message-format=json
148157
| clippy-sarif
149158
| tee clippy-results.sarif
150159
| sarif-fmt
@@ -155,7 +164,7 @@ jobs:
155164
sarif_file: clippy-results.sarif
156165
wait-for-processing: true
157166
- name: Report status
158-
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
167+
run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated
159168
coverage:
160169
name: Coverage
161170
runs-on: ubuntu-latest

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v6
26-
- uses: actions/setup-python@v6
26+
- uses: j178/prek-action@v1
2727
with:
28-
python-version: '3.x'
29-
- uses: pre-commit/action@v3.0.1
28+
prek-version: '0.2.27'

.github/workflows/rust-next.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
rust: "nightly"
2929
continue-on-error: ${{ matrix.rust != 'stable' }}
3030
runs-on: ${{ matrix.os }}
31+
env:
32+
# Reduce amount of data cached
33+
CARGO_PROFILE_DEV_DEBUG: line-tables-only
3134
steps:
3235
- name: Checkout repository
3336
uses: actions/checkout@v6
@@ -40,10 +43,15 @@ jobs:
4043
- name: Build
4144
run: cargo test --workspace --no-run
4245
- name: Test
43-
run: cargo hack test --feature-powerset --workspace
46+
run: cargo hack test --each-feature --workspace
4447
latest:
4548
name: "Check latest dependencies"
46-
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
os: ["ubuntu-latest"]
52+
runs-on: ${{ matrix.os }}
53+
env:
54+
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: allow
4755
steps:
4856
- name: Checkout repository
4957
uses: actions/checkout@v6
@@ -58,4 +66,4 @@ jobs:
5866
- name: Build
5967
run: cargo test --workspace --no-run
6068
- name: Test
61-
run: cargo hack test --feature-powerset --workspace
69+
run: cargo hack test --each-feature --workspace

.github/workflows/template.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Template Update
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
schedule:
8+
- cron: '1 1 1 * *'
9+
workflow_dispatch:
10+
11+
env:
12+
RUST_BACKTRACE: 1
13+
CARGO_TERM_COLOR: always
14+
CLICOLOR: 1
15+
TEMPLATE_URL: "https://github.com/epage/_rust.git"
16+
TEMPLATE_BRANCH: "main"
17+
18+
concurrency:
19+
group: "${{ github.workflow }}-${{ github.ref }}"
20+
cancel-in-progress: true
21+
22+
jobs:
23+
update:
24+
permissions:
25+
security-events: write # to create PR
26+
pull-requests: write
27+
contents: write # to push the branch
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
with:
33+
fetch-depth: 0
34+
- name: Configure git
35+
run: |
36+
git config --global user.name '${{ github.actor }}'
37+
git config --global user.email '<>'
38+
- name: Fetch template
39+
run: "git remote add template ${{ env.TEMPLATE_URL }} && git fetch template ${{ env.TEMPLATE_BRANCH }}"
40+
- name: Merge template
41+
run: "git checkout -b template-update && git merge template/${{ env.TEMPLATE_BRANCH }} -m 'chore: Update from template'"
42+
- name: Clear any existing branch
43+
run: "git push origin --delete template-update"
44+
continue-on-error: true
45+
env:
46+
GH_TOKEN: ${{ github.token }}
47+
- name: Push branch
48+
run: "git push --set-upstream origin template-update"
49+
env:
50+
GH_TOKEN: ${{ github.token }}
51+
- name: Create PR
52+
run: "gh pr create --head template-update --title 'chore: Update from template' --body ''"
53+
env:
54+
GH_TOKEN: ${{ github.token }}
55+
- name: Merge PR
56+
run: "gh pr merge --auto --delete-branch"
57+
env:
58+
GH_TOKEN: ${{ github.token }}

.pre-commit-config.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
1+
default_install_hook_types: ["pre-commit", "commit-msg"]
12
repos:
23
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
4+
rev: v6.0.0
45
hooks:
56
- id: check-yaml
6-
stages: [commit]
77
- id: check-json
8-
stages: [commit]
98
- id: check-toml
10-
stages: [commit]
119
- id: check-merge-conflict
12-
stages: [commit]
1310
- id: check-case-conflict
14-
stages: [commit]
1511
- id: detect-private-key
16-
stages: [commit]
1712
- repo: https://github.com/crate-ci/typos
18-
rev: v1.16.20
13+
rev: v1.42.1
1914
hooks:
2015
- id: typos
21-
stages: [commit]
2216
- repo: https://github.com/crate-ci/committed
23-
rev: v1.0.20
17+
rev: v1.1.10
2418
hooks:
2519
- id: committed
26-
stages: [commit-msg]

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Change Log
22

33
All notable changes to this project will be documented in this file.
4-
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/).
57

68
<!-- next-header -->
79
## [Unreleased] - ReleaseDate

CONTRIBUTING.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ appreciate any level you're willing to do.
77

88
Need some new functionality to help? You can let us know by opening an
99
[issue][new issue]. It's helpful to look through [all issues][all issues] in
10-
case its already being talked about.
10+
case it's already being talked about.
1111

1212
## Bug Reports
1313

1414
Please let us know about what problems you run into, whether in behavior or
1515
ergonomics of API. You can do this by opening an [issue][new issue]. It's
16-
helpful to look through [all issues][all issues] in case its already being
16+
helpful to look through [all issues][all issues] in case it's already being
1717
talked about.
1818

1919
## Pull Requests
2020

21-
Looking for an idea? Check our [issues][issues]. If it's look more open ended,
21+
Looking for an idea? Check our [issues][issues]. If the issue looks open ended,
2222
it is probably best to post on the issue how you are thinking of resolving the
2323
issue so you can get feedback early in the process. We want you to be
2424
successful and it can be discouraging to find out a lot of re-work is needed.
@@ -41,15 +41,18 @@ As a heads up, we'll be running your PR through the following gauntlet:
4141
Not everything can be checked automatically though.
4242

4343
We request that the commit history gets cleaned up.
44+
4445
We ask that commits are atomic, meaning they are complete and have a single responsibility.
45-
PRs should tell a cohesive story, with test and refactor commits that keep the
46+
A complete commit should build, pass tests, update documentation and tests, and not have dead code.
47+
48+
PRs should tell a cohesive story, with refactor and test commits that keep the
4649
fix or feature commits simple and clear.
4750

4851
Specifically, we would encourage
4952
- File renames be isolated into their own commit
50-
- Add tests in a commit before their feature or fix, showing the current behavior.
53+
- Add tests in a commit before their feature or fix, showing the current behavior (i.e. they should pass).
5154
The diff for the feature/fix commit will then show how the behavior changed,
52-
making it clearer to reviewrs and the community and showing people that the
55+
making the commit's intent clearer to reviewers and the community, and showing people that the
5356
test is verifying the expected state.
5457
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)
5558

0 commit comments

Comments
 (0)