Skip to content

Commit c6d3495

Browse files
authored
Merge pull request #168 from epage/template
chore: Update from '_rust/main' template
2 parents e71a9f7 + ce6689c commit c6d3495

16 files changed

+327
-115
lines changed

Diff for: .clippy.toml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
msrv = "1.64.0" # MSRV
1+
msrv = "1.65.0" # MSRV
2+
warn-on-all-wildcard-imports = true
3+
allow-expect-in-tests = true
4+
allow-unwrap-in-tests = true
5+
allow-dbg-in-tests = true
6+
allow-print-in-tests = true
7+
disallowed-methods = [
8+
{ path = "std::option::Option::map_or", reason = "use `map(..).unwrap_or(..)`" },
9+
{ path = "std::option::Option::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
10+
{ path = "std::result::Result::map_or", reason = "use `map(..).unwrap_or(..)`" },
11+
{ path = "std::result::Result::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
12+
]

Diff for: .github/renovate.json5

+26
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44
],
55
"semanticCommits": "enabled",
66
"configMigration": true,
7+
"dependencyDashboard": true,
8+
"regexManagers": [
9+
{
10+
"fileMatch": [
11+
"^rust-toolchain\\.toml$",
12+
"Cargo.toml$",
13+
"clippy.toml$",
14+
"\.clippy.toml$",
15+
"^\.github/workflows/ci.yml$",
16+
"^\.github/workflows/rust-next.yml$",
17+
],
18+
"matchStrings": [
19+
"MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)",
20+
"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV",
21+
],
22+
"depNameTemplate": "rust",
23+
"packageNameTemplate": "rust-lang/rust",
24+
"datasourceTemplate": "github-releases",
25+
}
26+
],
727
"packageRules": [
28+
{
29+
"commitMessageTopic": "MSRV",
30+
"matchManagers": ["regex"],
31+
"matchPackageNames": ["rust"],
32+
"stabilityDays": 126, // 3 releases * 6 weeks per release * 7 days per week
33+
},
834
// Goals:
935
// - Keep version reqs low, ignoring compatible normal/build dependencies
1036
// - Take advantage of latest dev-dependencies

Diff for: .github/settings.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
22

33
repository:
4-
description: Assert process::Command - Easy command initialization and assertions
5-
homepage: https://docs.rs/assert_cmd
6-
topics: rust cli test
4+
description: "Assert process::Command - Easy command initialization and assertions"
5+
homepage: "https://docs.rs/assert_cmd"
6+
topics: "rust cli test"
77
has_issues: true
88
has_projects: false
99
has_wiki: false
@@ -21,19 +21,19 @@ labels:
2121
# Type
2222
- name: bug
2323
color: '#b60205'
24-
description: Not as expected
24+
description: "Not as expected"
2525
- name: enhancement
2626
color: '#1d76db'
27-
description: Improve the expected
27+
description: "Improve the expected"
2828
# Flavor
2929
- name: question
3030
color: "#cc317c"
31-
description: Uncertainty is involved
31+
description: "Uncertainty is involved"
3232
- name: breaking-change
3333
color: "#e99695"
3434
- name: good first issue
3535
color: '#c2e0c6'
36-
description: Help wanted!
36+
description: "Help wanted!"
3737

3838
branches:
3939
- name: master

Diff for: .github/workflows/audit.yml

+33-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
name: Security audit
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
pull_request:
48
paths:
59
- '**/Cargo.toml'
610
- '**/Cargo.lock'
711
push:
8-
paths:
9-
- '**/Cargo.toml'
10-
- '**/Cargo.lock'
11-
schedule:
12-
- cron: '3 3 3 * *'
12+
branches:
13+
- master
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
CLICOLOR: 1
19+
1320
jobs:
1421
security_audit:
22+
permissions:
23+
issues: write # to create issues (actions-rs/audit-check)
24+
checks: write # to create check (actions-rs/audit-check)
1525
runs-on: ubuntu-latest
26+
# Prevent sudden announcement of a new advisory from failing ci:
27+
continue-on-error: true
1628
steps:
1729
- name: Checkout repository
1830
uses: actions/checkout@v3
1931
- uses: actions-rs/audit-check@v1
2032
with:
2133
token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
cargo_deny:
36+
permissions:
37+
issues: write # to create issues (actions-rs/audit-check)
38+
checks: write # to create check (actions-rs/audit-check)
39+
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
checks:
43+
- bans licenses sources
44+
steps:
45+
- uses: actions/checkout@v3
46+
- uses: EmbarkStudios/cargo-deny-action@v1
47+
with:
48+
command: check ${{ matrix.checks }}
49+
rust-version: stable

Diff for: .github/workflows/ci.yml

+37-33
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
name: CI
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
pull_request:
4-
paths:
5-
- '**'
6-
- '!/*.md'
7-
- '!/docs/**'
8-
- "!/LICENSE-*"
98
push:
109
branches:
1110
- master
12-
paths:
13-
- '**'
14-
- '!/*.md'
15-
- '!/docs/**'
16-
- "!/LICENSE-*"
17-
schedule:
18-
- cron: '13 13 13 * *'
11+
12+
env:
13+
RUST_BACKTRACE: 1
14+
CARGO_TERM_COLOR: always
15+
CLICOLOR: 1
16+
1917
jobs:
2018
ci:
19+
permissions:
20+
contents: none
2121
name: CI
2222
needs: [test, msrv, docs, rustfmt, clippy]
2323
runs-on: ubuntu-latest
@@ -36,11 +36,9 @@ jobs:
3636
- name: Checkout repository
3737
uses: actions/checkout@v3
3838
- name: Install Rust
39-
uses: actions-rs/toolchain@v1
39+
uses: dtolnay/rust-toolchain@stable
4040
with:
4141
toolchain: ${{ matrix.rust }}
42-
profile: minimal
43-
override: true
4442
- uses: Swatinem/rust-cache@v2
4543
- name: Build
4644
run: cargo test --no-run --workspace --all-features
@@ -51,17 +49,15 @@ jobs:
5149
- name: No-default features
5250
run: cargo test --workspace --no-default-features
5351
msrv:
54-
name: "Check MSRV: 1.64.0"
52+
name: "Check MSRV: 1.65.0"
5553
runs-on: ubuntu-latest
5654
steps:
5755
- name: Checkout repository
5856
uses: actions/checkout@v3
5957
- name: Install Rust
60-
uses: actions-rs/toolchain@v1
58+
uses: dtolnay/rust-toolchain@stable
6159
with:
62-
toolchain: 1.64.0 # MSRV
63-
profile: minimal
64-
override: true
60+
toolchain: 1.65.0 # MSRV
6561
- uses: Swatinem/rust-cache@v2
6662
- name: Default features
6763
run: cargo check --workspace --all-targets
@@ -76,11 +72,9 @@ jobs:
7672
- name: Checkout repository
7773
uses: actions/checkout@v3
7874
- name: Install Rust
79-
uses: actions-rs/toolchain@v1
75+
uses: dtolnay/rust-toolchain@stable
8076
with:
8177
toolchain: stable
82-
profile: minimal
83-
override: true
8478
- uses: Swatinem/rust-cache@v2
8579
- name: Check documentation
8680
env:
@@ -93,32 +87,42 @@ jobs:
9387
- name: Checkout repository
9488
uses: actions/checkout@v3
9589
- name: Install Rust
96-
uses: actions-rs/toolchain@v1
90+
uses: dtolnay/rust-toolchain@stable
9791
with:
9892
# Not MSRV because its harder to jump between versions and people are
9993
# more likely to have stable
10094
toolchain: stable
101-
profile: minimal
102-
override: true
10395
components: rustfmt
10496
- uses: Swatinem/rust-cache@v2
10597
- name: Check formatting
10698
run: cargo fmt --all -- --check
10799
clippy:
108100
name: clippy
109101
runs-on: ubuntu-latest
102+
permissions:
103+
security-events: write # to upload sarif results
110104
steps:
111105
- name: Checkout repository
112106
uses: actions/checkout@v3
113107
- name: Install Rust
114-
uses: actions-rs/toolchain@v1
108+
uses: dtolnay/rust-toolchain@stable
115109
with:
116-
toolchain: 1.64.0 # MSRV
117-
profile: minimal
118-
override: true
110+
toolchain: 1.65.0 # MSRV
119111
components: clippy
120112
- uses: Swatinem/rust-cache@v2
121-
- uses: actions-rs/clippy-check@v1
113+
- name: Install SARIF tools
114+
run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv
115+
- name: Install SARIF tools
116+
run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv
117+
- name: Check
118+
run: >
119+
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
120+
| clippy-sarif
121+
| tee clippy-results.sarif
122+
| sarif-fmt
123+
continue-on-error: true
124+
- name: Upload
125+
uses: github/codeql-action/upload-sarif@v2
122126
with:
123-
token: ${{ secrets.GITHUB_TOKEN }}
124-
args: --workspace --all-features --all-targets -- -D warnings --allow deprecated
127+
sarif_file: clippy-results.sarif
128+
wait-for-processing: true

Diff for: .github/workflows/committed.yml

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
name: Lint Commits
44
on: [pull_request]
55

6+
permissions:
7+
contents: read
8+
9+
env:
10+
RUST_BACKTRACE: 1
11+
CARGO_TERM_COLOR: always
12+
CLICOLOR: 1
13+
614
jobs:
715
committed:
816
name: Lint Commits

Diff for: .github/workflows/pre-commit.yml

+11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
name: pre-commit
2+
3+
permissions: {} # none
4+
25
on:
36
pull_request:
47
push:
58
branches: [master]
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
615
jobs:
716
pre-commit:
17+
permissions:
18+
contents: read
819
runs-on: ubuntu-latest
920
steps:
1021
- uses: actions/checkout@v3

Diff for: .github/workflows/rust-next.yml

+11-51
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
name: rust-next
2+
3+
permissions:
4+
contents: read
5+
26
on:
37
schedule:
48
- cron: '13 13 13 * *'
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
515
jobs:
616
test:
717
name: Test
@@ -18,63 +28,13 @@ jobs:
1828
- name: Checkout repository
1929
uses: actions/checkout@v3
2030
- name: Install Rust
21-
uses: actions-rs/toolchain@v1
31+
uses: dtolnay/rust-toolchain@stable
2232
with:
2333
toolchain: ${{ matrix.rust }}
24-
profile: minimal
25-
override: true
2634
- uses: Swatinem/rust-cache@v2
27-
- name: Build
28-
run: cargo test --no-run --workspace --all-features
2935
- name: Default features
3036
run: cargo test --workspace
3137
- name: All features
3238
run: cargo test --workspace --all-features
3339
- name: No-default features
3440
run: cargo test --workspace --no-default-features
35-
rustfmt:
36-
name: rustfmt
37-
strategy:
38-
matrix:
39-
rust:
40-
- stable
41-
- beta
42-
continue-on-error: ${{ matrix.rust != 'stable' }}
43-
runs-on: ubuntu-latest
44-
steps:
45-
- name: Checkout repository
46-
uses: actions/checkout@v3
47-
- name: Install Rust
48-
uses: actions-rs/toolchain@v1
49-
with:
50-
toolchain: ${{ matrix.rust }}
51-
profile: minimal
52-
override: true
53-
components: rustfmt
54-
- uses: Swatinem/rust-cache@v2
55-
- name: Check formatting
56-
run: cargo fmt --all -- --check
57-
clippy:
58-
name: clippy
59-
strategy:
60-
matrix:
61-
rust:
62-
- 1.64.0 # MSRV
63-
- stable
64-
continue-on-error: ${{ matrix.rust != '1.64.0' }} # MSRV
65-
runs-on: ubuntu-latest
66-
steps:
67-
- name: Checkout repository
68-
uses: actions/checkout@v3
69-
- name: Install Rust
70-
uses: actions-rs/toolchain@v1
71-
with:
72-
toolchain: ${{ matrix.rust }}
73-
profile: minimal
74-
override: true
75-
components: clippy
76-
- uses: Swatinem/rust-cache@v2
77-
- uses: actions-rs/clippy-check@v1
78-
with:
79-
token: ${{ secrets.GITHUB_TOKEN }}
80-
args: --workspace --all-features --all-targets -- -D warnings

0 commit comments

Comments
 (0)