Skip to content

Commit ecee3f9

Browse files
committed
chore: Adopt '_rust/main' template
2 parents 2cb5cb6 + 8c836ea commit ecee3f9

27 files changed

+1023
-364
lines changed

.clippy.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
disallowed-methods = [
7+
{ path = "std::option::Option::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
8+
{ path = "std::option::Option::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
9+
{ path = "std::result::Result::map_or", reason = "prefer `map(..).unwrap_or(..)` for legibility" },
10+
{ path = "std::result::Result::map_or_else", reason = "prefer `map(..).unwrap_or_else(..)` for legibility" },
11+
{ path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" },
12+
{ path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" },
13+
]

.clog.toml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/renovate.json5

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
schedule: [
3+
'before 5am on the first day of the month',
4+
],
5+
semanticCommits: 'enabled',
6+
configMigration: true,
7+
dependencyDashboard: true,
8+
customManagers: [
9+
{
10+
customType: 'regex',
11+
fileMatch: [
12+
'^rust-toolchain\\.toml$',
13+
'Cargo.toml$',
14+
'clippy.toml$',
15+
'\\.clippy.toml$',
16+
'^\\.github/workflows/ci.yml$',
17+
'^\\.github/workflows/rust-next.yml$',
18+
],
19+
matchStrings: [
20+
'MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)',
21+
'(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV',
22+
],
23+
depNameTemplate: 'rust',
24+
packageNameTemplate: 'rust-lang/rust',
25+
datasourceTemplate: 'github-releases',
26+
},
27+
],
28+
packageRules: [
29+
{
30+
commitMessageTopic: 'MSRV',
31+
matchManagers: [
32+
'custom.regex',
33+
],
34+
matchPackageNames: [
35+
'rust',
36+
],
37+
minimumReleaseAge: '336 days', // 8 releases * 6 weeks per release * 7 days per week
38+
internalChecksFilter: 'strict',
39+
extractVersion: '^(?<version>\\d+\\.\\d+)', // Drop the patch version
40+
schedule: [
41+
'* * * * *',
42+
],
43+
},
44+
// Goals:
45+
// - Keep version reqs low, ignoring compatible normal/build dependencies
46+
// - Take advantage of latest dev-dependencies
47+
// - Rollup safe upgrades to reduce CI runner load
48+
// - Help keep number of versions down by always using latest breaking change
49+
// - Have lockfile and manifest in-sync
50+
{
51+
matchManagers: [
52+
'cargo',
53+
],
54+
matchDepTypes: [
55+
'build-dependencies',
56+
'dependencies',
57+
],
58+
matchCurrentVersion: '>=0.1.0',
59+
matchUpdateTypes: [
60+
'patch',
61+
],
62+
enabled: false,
63+
},
64+
{
65+
matchManagers: [
66+
'cargo',
67+
],
68+
matchDepTypes: [
69+
'build-dependencies',
70+
'dependencies',
71+
],
72+
matchCurrentVersion: '>=1.0.0',
73+
matchUpdateTypes: [
74+
'minor',
75+
],
76+
enabled: false,
77+
},
78+
{
79+
matchManagers: [
80+
'cargo',
81+
],
82+
matchDepTypes: [
83+
'dev-dependencies',
84+
],
85+
matchCurrentVersion: '>=0.1.0',
86+
matchUpdateTypes: [
87+
'patch',
88+
],
89+
automerge: true,
90+
groupName: 'compatible (dev)',
91+
},
92+
{
93+
matchManagers: [
94+
'cargo',
95+
],
96+
matchDepTypes: [
97+
'dev-dependencies',
98+
],
99+
matchCurrentVersion: '>=1.0.0',
100+
matchUpdateTypes: [
101+
'minor',
102+
],
103+
automerge: true,
104+
groupName: 'compatible (dev)',
105+
},
106+
],
107+
}

.github/settings.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
2+
3+
repository:
4+
description: "Do two directories have different contents?"
5+
homepage: "https://docs.rs/dir-diff"
6+
topics: "fs testing"
7+
has_issues: true
8+
has_projects: false
9+
has_wiki: false
10+
has_downloads: true
11+
default_branch: master
12+
13+
# Preference: people do clean commits
14+
allow_merge_commit: true
15+
# Backup in case we need to clean up commits
16+
allow_squash_merge: true
17+
# Not really needed
18+
allow_rebase_merge: false
19+
20+
allow_auto_merge: true
21+
delete_branch_on_merge: true
22+
23+
squash_merge_commit_title: "PR_TITLE"
24+
squash_merge_commit_message: "PR_BODY"
25+
merge_commit_message: "PR_BODY"
26+
27+
labels:
28+
# Type
29+
- name: bug
30+
color: '#b60205'
31+
description: "Not as expected"
32+
- name: enhancement
33+
color: '#1d76db'
34+
description: "Improve the expected"
35+
# Flavor
36+
- name: question
37+
color: "#cc317c"
38+
description: "Uncertainty is involved"
39+
- name: breaking-change
40+
color: "#e99695"
41+
- name: good first issue
42+
color: '#c2e0c6'
43+
description: "Help wanted!"
44+
45+
branches:
46+
- name: master
47+
protection:
48+
required_pull_request_reviews: null
49+
required_conversation_resolution: true
50+
required_status_checks:
51+
# Required. Require branches to be up to date before merging.
52+
strict: false
53+
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
54+
enforce_admins: false
55+
restrictions: null

.github/workflows/audit.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Security audit
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
paths:
9+
- '**/Cargo.toml'
10+
- '**/Cargo.lock'
11+
push:
12+
branches:
13+
- master
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
CLICOLOR: 1
19+
20+
jobs:
21+
security_audit:
22+
permissions:
23+
issues: write # to create issues (actions-rs/audit-check)
24+
checks: write # to create check (actions-rs/audit-check)
25+
runs-on: ubuntu-latest
26+
# Prevent sudden announcement of a new advisory from failing ci:
27+
continue-on-error: true
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
- uses: actions-rs/audit-check@v1
32+
with:
33+
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@v4
46+
- uses: EmbarkStudios/cargo-deny-action@v1
47+
with:
48+
command: check ${{ matrix.checks }}
49+
rust-version: stable

.github/workflows/ci.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- master
11+
12+
env:
13+
RUST_BACKTRACE: 1
14+
CARGO_TERM_COLOR: always
15+
CLICOLOR: 1
16+
17+
jobs:
18+
ci:
19+
permissions:
20+
contents: none
21+
name: CI
22+
needs: [test, msrv, docs, rustfmt, clippy]
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Done
26+
run: exit 0
27+
test:
28+
name: Test
29+
strategy:
30+
matrix:
31+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
32+
rust: ["stable"]
33+
continue-on-error: ${{ matrix.rust != 'stable' }}
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
- name: Install Rust
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
toolchain: ${{ matrix.rust }}
42+
- uses: Swatinem/rust-cache@v2
43+
- name: Build
44+
run: cargo test --no-run --workspace --all-features
45+
- name: Default features
46+
run: cargo test --workspace
47+
- name: All features
48+
run: cargo test --workspace --all-features
49+
- name: No-default features
50+
run: cargo test --workspace --no-default-features
51+
msrv:
52+
name: "Check MSRV: 1.65.0"
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
- name: Install Rust
58+
uses: dtolnay/rust-toolchain@stable
59+
with:
60+
toolchain: "1.65.0" # MSRV
61+
- uses: Swatinem/rust-cache@v2
62+
- name: Default features
63+
run: cargo check --workspace --all-targets
64+
- name: All features
65+
run: cargo check --workspace --all-targets --all-features
66+
- name: No-default features
67+
run: cargo check --workspace --all-targets --no-default-features
68+
lockfile:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout repository
72+
uses: actions/checkout@v4
73+
- name: Install Rust
74+
uses: dtolnay/rust-toolchain@stable
75+
with:
76+
toolchain: stable
77+
- uses: Swatinem/rust-cache@v2
78+
- name: "Is lockfile updated?"
79+
run: cargo fetch --locked
80+
docs:
81+
name: Docs
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout repository
85+
uses: actions/checkout@v4
86+
- name: Install Rust
87+
uses: dtolnay/rust-toolchain@stable
88+
with:
89+
toolchain: stable
90+
- uses: Swatinem/rust-cache@v2
91+
- name: Check documentation
92+
env:
93+
RUSTDOCFLAGS: -D warnings
94+
run: cargo doc --workspace --all-features --no-deps --document-private-items
95+
rustfmt:
96+
name: rustfmt
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: Checkout repository
100+
uses: actions/checkout@v4
101+
- name: Install Rust
102+
uses: dtolnay/rust-toolchain@stable
103+
with:
104+
# Not MSRV because its harder to jump between versions and people are
105+
# more likely to have stable
106+
toolchain: stable
107+
components: rustfmt
108+
- uses: Swatinem/rust-cache@v2
109+
- name: Check formatting
110+
run: cargo fmt --all -- --check
111+
clippy:
112+
name: clippy
113+
runs-on: ubuntu-latest
114+
permissions:
115+
security-events: write # to upload sarif results
116+
steps:
117+
- name: Checkout repository
118+
uses: actions/checkout@v4
119+
- name: Install Rust
120+
uses: dtolnay/rust-toolchain@stable
121+
with:
122+
toolchain: "1.65.0" # MSRV
123+
components: clippy
124+
- uses: Swatinem/rust-cache@v2
125+
- name: Install SARIF tools
126+
run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv
127+
- name: Install SARIF tools
128+
run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv
129+
- name: Check
130+
run: >
131+
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
132+
| clippy-sarif
133+
| tee clippy-results.sarif
134+
| sarif-fmt
135+
continue-on-error: true
136+
- name: Upload
137+
uses: github/codeql-action/upload-sarif@v2
138+
with:
139+
sarif_file: clippy-results.sarif
140+
wait-for-processing: true
141+
- name: Report status
142+
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated

0 commit comments

Comments
 (0)