Skip to content

Commit 30fea55

Browse files
committed
docs: document and enforce Conventional Commits for PR titles
Update CONTRIBUTING.md with comprehensive Conventional Commits guidance including allowed types, optional scopes, breaking change syntax, and examples. Fix stale master reference to main. Add lint-pr-title.yaml GitHub Action using amannn/action-semantic-pull-request@v6 to enforce the convention on PR titles with sticky PR comments for contributor-friendly error messages.
0 parents  commit 30fea55

39 files changed

Lines changed: 4893 additions & 0 deletions

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
# Any flags here must be also added to env.RUSTFLAGS in build.yaml due to rustflag overriding rules: https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags
3+
rustflags = ["-C", "target-feature=+crt-static"]

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Auto detect text files and perform normalization
2+
* text=auto
3+
4+
*.rs text diff=rust
5+
*.toml text diff=toml
6+
Cargo.lock text

.github/dependabot.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "wednesday"
8+
timezone: "America/Los_Angeles"
9+
time: "06:00"
10+
commit-message:
11+
prefix: "chore"
12+
labels:
13+
- "type:dependabot"
14+
- "type:dependencies-cargo"
15+
16+
- package-ecosystem: "github-actions"
17+
directory: "/"
18+
schedule:
19+
interval: "weekly"
20+
day: "wednesday"
21+
timezone: "America/Los_Angeles"
22+
time: "06:00"
23+
commit-message:
24+
prefix: "chore"
25+
labels:
26+
- "type:dependabot"
27+
- "type:dependencies-github-actions"

.github/workflows/build.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
7+
schedule: # Trigger a job on default branch at 4AM PST everyday
8+
- cron: '0 11 * * *'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
13+
14+
env:
15+
RUSTFLAGS: >-
16+
-D warnings
17+
-C target-feature=+crt-static
18+
19+
jobs:
20+
build:
21+
name: Build
22+
strategy:
23+
fail-fast: false # Allow all matrix variants to complete even if some fail
24+
matrix:
25+
runner:
26+
- name: windows-latest
27+
arch: amd64
28+
- name: windows-11-arm
29+
arch: arm64
30+
31+
wdk:
32+
- version: 10.0.22621 # NI WDK
33+
source: winget
34+
- version: 10.0.26100 # GE WDK
35+
source: nuget
36+
37+
llvm:
38+
- 17.0.6
39+
40+
rust_toolchain:
41+
- stable
42+
- beta
43+
- nightly
44+
45+
cargo_profile:
46+
- dev
47+
- release
48+
49+
target_triple:
50+
- name: x86_64-pc-windows-msvc
51+
arch: amd64
52+
- name: aarch64-pc-windows-msvc
53+
arch: arm64
54+
55+
runs-on: ${{ matrix.runner.name }}
56+
57+
steps:
58+
- name: Checkout Repository
59+
uses: actions/checkout@v4
60+
61+
- name: Checkout windows-drivers-rs actions
62+
uses: actions/checkout@v4
63+
with:
64+
repository: microsoft/windows-drivers-rs
65+
ref: main
66+
path: _temp/windows-drivers-rs
67+
sparse-checkout: |
68+
.github/actions
69+
sparse-checkout-cone-mode: false
70+
71+
- name: Copy actions to workspace
72+
shell: pwsh
73+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
74+
75+
- name: Install Winget
76+
uses: ./.github/actions/install-winget
77+
with:
78+
# windows-11-arm runner image does not include winget-cli (see https://github.com/actions/partner-runner-images/issues/95).
79+
force-cli-install: ${{ matrix.runner.name == 'windows-11-arm' && 'true' || 'false' }}
80+
81+
- name: Install LLVM ${{ matrix.llvm }}
82+
uses: ./.github/actions/install-llvm
83+
with:
84+
version: ${{ matrix.llvm }}
85+
86+
- name: Install WDK (${{ matrix.wdk.version }})
87+
uses: ./.github/actions/install-wdk
88+
with:
89+
version: ${{ matrix.wdk.version }}
90+
source: ${{ matrix.wdk.source }}
91+
host: ${{ matrix.wdk.source == 'nuget' && matrix.runner.arch || '' }}
92+
target: ${{ matrix.wdk.source == 'nuget' && matrix.target_triple.arch || '' }}
93+
94+
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
95+
uses: dtolnay/rust-toolchain@master
96+
with:
97+
toolchain: ${{ matrix.rust_toolchain }}
98+
targets: ${{ matrix.target_triple.name }}
99+
100+
- name: Run Cargo Build
101+
run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace
102+
103+
# Steps to use cargo-make to build and package drivers
104+
- name: Install Cargo Make
105+
uses: taiki-e/install-action@v2
106+
with:
107+
tool: cargo-make
108+
109+
- name: Build and Package Sample Drivers
110+
run: cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }}
111+
112+
# Steps to use cargo-wdk to build and package drivers
113+
- name: Install cargo-wdk binary
114+
run: cargo +${{ matrix.rust_toolchain }} install cargo-wdk --locked --force
115+
116+
- name: Build and Package Sample Drivers with cargo-wdk
117+
run: cargo +${{ matrix.rust_toolchain }} wdk build --sample --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }}

.github/workflows/cargo-audit.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Cargo Audit
2+
3+
on:
4+
push:
5+
paths:
6+
- "**/Cargo.toml"
7+
- "**/Cargo.lock"
8+
pull_request:
9+
merge_group:
10+
schedule: # Trigger a job on default branch at 4AM PST everyday
11+
- cron: 0 11 * * *
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
15+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
16+
17+
jobs:
18+
cargo_audit:
19+
name: Cargo Audit
20+
runs-on: windows-latest
21+
permissions:
22+
issues: write
23+
checks: write
24+
25+
steps:
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
29+
- name: Run Cargo Audit
30+
uses: rustsec/audit-check@v1
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Code Formatting Check
2+
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
7+
schedule: # Trigger a job on default branch at 4AM PST everyday
8+
- cron: 0 11 * * *
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
13+
14+
jobs:
15+
cargo-fmt:
16+
name: .rs Formatting Check
17+
runs-on: windows-latest
18+
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install Rust Toolchain (Nightly)
24+
uses: dtolnay/rust-toolchain@nightly
25+
with:
26+
components: rustfmt
27+
28+
- name: Run Cargo Format
29+
run: cargo +nightly fmt --all -- --check
30+
31+
taplo-fmt:
32+
name: .toml Formatting Check
33+
runs-on: windows-latest
34+
35+
steps:
36+
- name: Checkout Repository
37+
uses: actions/checkout@v4
38+
39+
- name: Install Rust Toolchain (Stable)
40+
uses: dtolnay/rust-toolchain@stable
41+
42+
- name: Install taplo-cli
43+
uses: taiki-e/install-action@v2
44+
with:
45+
tool: taplo-cli
46+
47+
- run: taplo fmt --check --diff
48+
name: Check TOML files formatting

.github/workflows/docs.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
7+
schedule: # Trigger a job on default branch at 4AM PST everyday
8+
- cron: '0 11 * * *'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
13+
14+
env:
15+
RUSTDOCFLAGS: -D warnings
16+
17+
jobs:
18+
docs:
19+
name: Docs
20+
strategy:
21+
fail-fast: false # Allow all matrix variants to complete even if some fail
22+
matrix:
23+
runner:
24+
- name: windows-latest
25+
arch: amd64
26+
- name: windows-11-arm
27+
arch: arm64
28+
29+
wdk:
30+
- version: 10.0.22621 # NI WDK
31+
source: winget
32+
- version: 10.0.26100 # GE WDK
33+
source: nuget
34+
35+
llvm:
36+
- 17.0.6
37+
38+
rust_toolchain:
39+
- stable
40+
- beta
41+
- nightly
42+
43+
cargo_profile:
44+
- dev
45+
- release
46+
47+
target_triple:
48+
- name: x86_64-pc-windows-msvc
49+
arch: amd64
50+
- name: aarch64-pc-windows-msvc
51+
arch: arm64
52+
53+
runs-on: ${{ matrix.runner.name }}
54+
55+
steps:
56+
- name: Checkout Repository
57+
uses: actions/checkout@v4
58+
59+
- name: Checkout windows-drivers-rs actions
60+
uses: actions/checkout@v4
61+
with:
62+
repository: microsoft/windows-drivers-rs
63+
ref: main
64+
path: _temp/windows-drivers-rs
65+
sparse-checkout: |
66+
.github/actions
67+
sparse-checkout-cone-mode: false
68+
69+
- name: Copy actions to workspace
70+
shell: pwsh
71+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
72+
73+
- name: Install Winget
74+
uses: ./.github/actions/install-winget
75+
with:
76+
# windows-11-arm runner image does not include winget-cli (see https://github.com/actions/partner-runner-images/issues/95).
77+
force-cli-install: ${{ matrix.runner.name == 'windows-11-arm' && 'true' || 'false' }}
78+
79+
- name: Install LLVM ${{ matrix.llvm }}
80+
uses: ./.github/actions/install-llvm
81+
with:
82+
version: ${{ matrix.llvm }}
83+
84+
- name: Install WDK (${{ matrix.wdk.version }})
85+
uses: ./.github/actions/install-wdk
86+
with:
87+
version: ${{ matrix.wdk.version }}
88+
source: ${{ matrix.wdk.source }}
89+
host: ${{ matrix.wdk.source == 'nuget' && matrix.runner.arch || '' }}
90+
target: ${{ matrix.wdk.source == 'nuget' && matrix.target_triple.arch || '' }}
91+
92+
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
93+
uses: dtolnay/rust-toolchain@master
94+
with:
95+
toolchain: ${{ matrix.rust_toolchain }}
96+
targets: ${{ matrix.target_triple.name }}
97+
98+
- name: Run Cargo Doc
99+
# proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368
100+
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace --exclude wdk-macros
101+
- name: Run Cargo Doc (--features nightly)
102+
if: matrix.rust_toolchain == 'nightly'
103+
# proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368
104+
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace --exclude wdk-macros --features nightly
105+
- name: Run Cargo Doc w/ proc-macro crates
106+
# Skip duplicate runs on the same runner
107+
if: matrix.target_triple.arch == matrix.runner.arch
108+
# cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677
109+
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }}
110+
111+
- name: Run Cargo Doc w/ proc-macro crates (--features nightly)
112+
# Skip duplicate runs on the same runner
113+
if: ${{ matrix.target_triple.arch == matrix.runner.arch && matrix.rust_toolchain == 'nightly' }}
114+
# cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677
115+
run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --features nightly
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Dependency Review
2+
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
10+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
11+
12+
jobs:
13+
dependency-review:
14+
name: Github Dependency Review
15+
runs-on: ubuntu-latest
16+
permissions:
17+
pull-requests: write
18+
contents: read
19+
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v4
23+
24+
- name: Dependency Review
25+
uses: actions/dependency-review-action@v4
26+
with:
27+
allow-licenses: >-
28+
MIT,
29+
Apache-2.0,
30+
BSD-3-Clause,
31+
ISC,
32+
Unicode-DFS-2016
33+
# anstyle@1.0.4 is licensed as (MIT OR Apache-2.0), but the Github api fails to detect it: https://github.com/rust-cli/anstyle/tree/main/crates/anstyle
34+
allow-dependencies-licenses: 'pkg:cargo/anstyle@1.0.4'
35+
comment-summary-in-pr: on-failure
36+
# Explicit refs required for merge_group and push triggers:
37+
# https://github.com/actions/dependency-review-action/issues/456
38+
# https://github.com/actions/dependency-review-action/issues/252
39+
base-ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || (github.event_name == 'push' && github.event.before || (github.event_name == 'merge_group' && 'main' || 'unsupported trigger' ) ) }}
40+
head-ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha || (github.event_name == 'merge_group' && github.ref || 'unsupported trigger' ) ) }}

0 commit comments

Comments
 (0)