Skip to content

Lint

Lint #311

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-latest
permissions:
checks: write
strategy:
matrix:
wdk:
- Microsoft.WindowsWDK.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: Install Winget
uses: ./.github/actions/winget-install
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install LLVM ${{ matrix.llvm }}
run: |
if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') {
Write-Host "LLVM ${{ matrix.llvm }} is already installed."
} else {
Write-Host "Installing LLVM ${{ matrix.llvm }}..."
Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force
}
clang --version
- 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 (${{ 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
udeps:
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 Cargo Udeps
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Run Cargo Udeps
run: cargo +nightly udeps --locked --all-targets
- name: Run Cargo Udeps (--features nightly)
run: cargo +nightly udeps --locked --all-targets --features nightly