Skip to content

Commit

Permalink
feat: configure WDK configuration via parsing Cargo manifest metadata (
Browse files Browse the repository at this point in the history
…#186)

Signed-off-by: Melvin Wang <[email protected]>
Co-authored-by: NateD-MSFT <[email protected]>
  • Loading branch information
wmmc88 and NateD-MSFT authored Aug 23, 2024
1 parent 4ee4b88 commit 32e5ae9
Show file tree
Hide file tree
Showing 202 changed files with 13,048 additions and 234,616 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["-C", "target-feature=+crt-static"]
File renamed without changes.
6 changes: 5 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
directories: ["**/*"]
schedule:
interval: "weekly"
day: "wednesday"
timezone: "America/Los_Angeles"
time: "06:00"
commit-message:
prefix: "chore"
reviewers:
- "microsoft/windows-drivers-rs"
labels:
- "type:dependabot"
- "type:dependencies-cargo"
Expand All @@ -22,6 +24,8 @@ updates:
time: "06:00"
commit-message:
prefix: "chore"
reviewers:
- "microsoft/windows-drivers-rs"
labels:
- "type:dependabot"
- "type:dependencies-github-actions"
10 changes: 8 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,11 @@ jobs:
with:
tool: cargo-make

- name: Build and Package Sample Drivers
run: cargo make default +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
- name: Run Cargo Make (package-driver-flow) in Workspace
run: cargo make package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace

- name: Build Examples (via Cargo Make)
run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}

- name: Package Examples (via Cargo Make)
run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
16 changes: 11 additions & 5 deletions .github/workflows/github-dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ jobs:
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
# AND combinations are currently bugged and must be listed separately: https://github.com/actions/dependency-review-action/issues/263
# OR combinations are currently bugged and must be listed separately: https://github.com/actions/dependency-review-action/issues/670
allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, Unicode-DFS-2016, (MIT OR Apache-2.0) AND Unicode-DFS-2016, Unlicense OR MIT
# anstyle 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
allow-dependencies-licenses: 'pkg:cargo/[email protected]'
allow-licenses: >-
MIT,
Apache-2.0,
BSD-3-Clause,
ISC,
Unicode-DFS-2016
# [email protected] 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
# AND combinations are currently bugged (https://github.com/actions/dependency-review-action/issues/263):
# * [email protected] License: Apache-2.0 AND MIT
# * [email protected] License: (MIT OR Apache-2.0) AND Unicode-DFS-2016
allow-dependencies-licenses: 'pkg:cargo/[email protected], pkg:cargo/[email protected], pkg:cargo/[email protected]'
comment-summary-in-pr: on-failure
# Explicit refs required for merge_group and push triggers:
# https://github.com/actions/dependency-review-action/issues/456
Expand Down
37 changes: 7 additions & 30 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,44 +77,21 @@ jobs:
if: matrix.rust_toolchain == 'nightly'
run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets --features nightly -- -D warnings

udeps:
unused_deps:
name: Detect Unused Cargo Dependencies
runs-on: windows-latest
strategy:
matrix:
wdk:
- Microsoft.WindowsWDK.10.0.22621 # NI WDK

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Winget
uses: ./.github/actions/winget-install
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install WDK (${{ matrix.wdk }})
run: |
if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') {
Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..."
Update-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
} else {
Write-Host "Installing ${{ matrix.wdk }}..."
Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
}
- name: Install Rust Toolchain (Nightly)
# Cargo udeps only supports running on nightly due to reliance on unstable dep-info feature: https://github.com/est31/cargo-udeps/issues/113, https://github.com/est31/cargo-udeps/issues/136
uses: dtolnay/rust-toolchain@nightly
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install Cargo Udeps
- name: Install Cargo Machete
uses: taiki-e/install-action@v2
with:
tool: [email protected]

- name: Run Cargo Udeps
run: cargo +nightly udeps --locked --all-targets
tool: cargo-machete

- name: Run Cargo Udeps (--features nightly)
run: cargo +nightly udeps --locked --all-targets --features nightly
- name: Run Cargo Machete
run: cargo machete --skip-target-dir
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Install Cargo Expand
uses: taiki-e/install-action@v2
with:
tool: [email protected].80
tool: [email protected].85

- name: Run Cargo Test
run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }}
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"+nightly"
],
"rust-analyzer.rustfmt.rangeFormatting.enable": true,
"evenBetterToml.formatter.crlf": true
"evenBetterToml.formatter.crlf": true,
"files.associations": {
"input.h": "c"
}
}
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ That's it! Thank you for your contribution!
The following tools should be installed as a part of the `windows-drivers-rs` developer workflow:
* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.80`
* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.85`
* `cargo-audit`: `cargo install --locked cargo-audit`
* `cargo-udeps`: `cargo install --locked cargo-udeps`
* `cargo-machete`: `cargo install --locked cargo-machete`
* `taplo-cli`: `cargo install --locked taplo-cli`
**Note on arm64:** ARM64 support for ring is [not released yet](https://github.com/briansmith/ring/issues/1167), so TLS features must be disabled until arm64 is officially supported by ring (probably in 0.17.0 release)
Expand Down Expand Up @@ -142,8 +142,7 @@ To maintain the quality of code, tests and tools are required to pass before con
**_Dependency Analysis:_**
* Scan for security advisories in dependent crates: `cargo audit --deny warnings`
* Scan for unused dependencies: `cargo +nightly udeps --locked --all-targets`
* `cargo udeps` requires `nightly` to function
* Scan for unused dependencies: `cargo machete --skip-target-dir`
**_Rust Documentation Build Test_**
Expand Down
Loading

0 comments on commit 32e5ae9

Please sign in to comment.