Skip to content

Lint

Lint #126

Workflow file for this run

on:
push:
pull_request:
merge_group:
schedule: # Trigger a job on default branch at 4AM PST everyday
- cron: "0 11 * * *"
name: Lint
jobs:
clippy:
name: Clippy
runs-on: windows-2025
permissions:
checks: write
strategy:
matrix:
wdk:
- 10.0.22621 # NI WDK
llvm:
- 17.0.6
rust_toolchain:
- stable
- beta
- nightly
cargo_profile:
- dev
- release
target_triple:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout windows-drivers-rs actions
uses: actions/checkout@v4
with:
repository: microsoft/windows-drivers-rs
ref: main
path: _temp/windows-drivers-rs
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
- name: Copy actions to workspace
shell: pwsh
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
- name: Install Winget
uses: ./.github/actions/install-winget
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Winget PowerShell Module
shell: pwsh
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
- name: Install LLVM ${{ matrix.llvm }}
uses: ./.github/actions/install-llvm
with:
version: ${{ matrix.llvm }}
- name: Install WDK (${{ matrix.wdk }})
uses: ./.github/actions/install-wdk
with:
version: ${{ matrix.wdk }}
source: winget
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_toolchain }}
components: clippy
targets: ${{ matrix.target_triple }}
- name: Run Cargo Clippy
run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets -- -D warnings
- name: Run Cargo Clippy (--features nightly)
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
machete:
name: Detect Unused Cargo Dependencies
runs-on: windows-2025
strategy:
matrix:
wdk:
- 10.0.22621 # NI WDK
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Checkout windows-drivers-rs actions
uses: actions/checkout@v4
with:
repository: microsoft/windows-drivers-rs
ref: main
path: _temp/windows-drivers-rs
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
- name: Copy actions to workspace
shell: pwsh
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
- name: Install Winget
uses: ./.github/actions/install-winget
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Winget PowerShell Module
shell: pwsh
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
- name: Install WDK (${{ matrix.wdk }})
uses: ./.github/actions/install-wdk
with:
version: ${{ matrix.wdk }}
source: winget
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Cargo Machete
uses: taiki-e/install-action@v2
with:
tool: cargo-machete
- name: Run Cargo Machete
run: cargo machete