Skip to content

Build

Build #730

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: Build
env:
RUSTFLAGS: >-
-D warnings
-C target-feature=+crt-static
jobs:
build:
name: Build
runs-on: windows-2025
strategy:
fail-fast: false # Allow all matrix variants to complete even if some fail
matrix:
wdk:
- 10.0.22621 # NI WDK
llvm:
- 17.0.6
rust_toolchain:
- stable
- beta
- nightly
cargo_profile:
- dev
- release
target_triple:
- name: x86_64-pc-windows-msvc
arch: amd64
- name: aarch64-pc-windows-msvc
arch: arm64
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 }}
targets: ${{ matrix.target_triple.name }}
- name: Run Cargo Build
run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace
# Steps to use cargo-make to build and package drivers
- name: Install Cargo Make
uses: taiki-e/install-action@v2
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 }}
# Steps to use cargo-wdk to build and package drivers
- name: Install cargo-wdk binary
run: cargo +${{ matrix.rust_toolchain }} install cargo-wdk --locked --force
- name: Build and Package Sample Drivers with cargo-wdk
run: cargo +${{ matrix.rust_toolchain }} wdk build --sample --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }}