Skip to content

Commit e7b7555

Browse files
committed
chore: First step
0 parents  commit e7b7555

23 files changed

+1019
-0
lines changed

.cargo/config

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.x86_64-pc-windows-msvc]
2+
rustflags = ["-Ctarget-feature=+crt-static"]
3+
4+
[target.i686-pc-windows-msvc]
5+
rustflags = ["-Ctarget-feature=+crt-static"]

.clippy.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
msrv = "1.64.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+
]

.github/renovate.json5

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"schedule": [
3+
"before 3am on the first day of the month"
4+
],
5+
"semanticCommits": "enabled",
6+
"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+
],
27+
"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+
},
34+
// Goals:
35+
// - Keep version reqs low, ignoring compatible normal/build dependencies
36+
// - Take advantage of latest dev-dependencies
37+
// - Rollup safe upgrades to reduce CI runner load
38+
// - Help keep number of versions down by always using latest breaking change
39+
// - Have lockfile and manifest in-sync
40+
{
41+
"matchManagers": ["cargo"],
42+
"matchDepTypes": ["build-dependencies", "dependencies"],
43+
"matchCurrentVersion": ">=0.1.0",
44+
"matchUpdateTypes": ["patch"],
45+
"enabled": false,
46+
},
47+
{
48+
"matchManagers": ["cargo"],
49+
"matchDepTypes": ["build-dependencies", "dependencies"],
50+
"matchCurrentVersion": ">=1.0.0",
51+
"matchUpdateTypes": ["minor"],
52+
"enabled": false,
53+
},
54+
{
55+
"matchManagers": ["cargo"],
56+
"matchDepTypes": ["dev-dependencies"],
57+
"matchCurrentVersion": ">=0.1.0",
58+
"matchUpdateTypes": ["patch"],
59+
"automerge": true,
60+
"groupName": "compatible (dev)",
61+
},
62+
{
63+
"matchManagers": ["cargo"],
64+
"matchDepTypes": ["dev-dependencies"],
65+
"matchCurrentVersion": ">=1.0.0",
66+
"matchUpdateTypes": ["minor"],
67+
"automerge": true,
68+
"groupName": "compatible (dev)",
69+
},
70+
],
71+
}

.github/settings.yml

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

.github/workflows/audit.yml

+49
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+
- main
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@v3
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@v3
46+
- uses: EmbarkStudios/cargo-deny-action@v1
47+
with:
48+
command: check ${{ matrix.checks }}
49+
rust-version: stable

.github/workflows/ci.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
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@v3
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.64.0"
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v3
57+
- name: Install Rust
58+
uses: dtolnay/rust-toolchain@stable
59+
with:
60+
toolchain: 1.64.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+
docs:
69+
name: Docs
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v3
74+
- name: Install Rust
75+
uses: dtolnay/rust-toolchain@stable
76+
with:
77+
toolchain: stable
78+
- uses: Swatinem/rust-cache@v2
79+
- name: Check documentation
80+
env:
81+
RUSTDOCFLAGS: -D warnings
82+
run: cargo doc --workspace --all-features --no-deps --document-private-items
83+
rustfmt:
84+
name: rustfmt
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Checkout repository
88+
uses: actions/checkout@v3
89+
- name: Install Rust
90+
uses: dtolnay/rust-toolchain@stable
91+
with:
92+
# Not MSRV because its harder to jump between versions and people are
93+
# more likely to have stable
94+
toolchain: stable
95+
components: rustfmt
96+
- uses: Swatinem/rust-cache@v2
97+
- name: Check formatting
98+
run: cargo fmt --all -- --check
99+
clippy:
100+
name: clippy
101+
runs-on: ubuntu-latest
102+
permissions:
103+
security-events: write # to upload sarif results
104+
steps:
105+
- name: Checkout repository
106+
uses: actions/checkout@v3
107+
- name: Install Rust
108+
uses: dtolnay/rust-toolchain@stable
109+
with:
110+
toolchain: 1.64.0 # MSRV
111+
components: clippy
112+
- uses: Swatinem/rust-cache@v2
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
126+
with:
127+
sarif_file: clippy-results.sarif
128+
wait-for-processing: true

.github/workflows/committed.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Not run as part of pre-commit checks because they don't handle sending the correct commit
2+
# range to `committed`
3+
name: Lint Commits
4+
on: [pull_request]
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
RUST_BACKTRACE: 1
11+
CARGO_TERM_COLOR: always
12+
CLICOLOR: 1
13+
14+
jobs:
15+
committed:
16+
name: Lint Commits
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Actions Repository
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- name: Lint Commits
24+
uses: crate-ci/committed@master

.github/workflows/pre-commit.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pre-commit
2+
3+
permissions: {} # none
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches: [main]
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
15+
jobs:
16+
pre-commit:
17+
permissions:
18+
contents: read
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v4
23+
- uses: pre-commit/[email protected]

0 commit comments

Comments
 (0)