Skip to content

Commit f291dea

Browse files
authored
ci: leverage custom actions in windows-drivers-rs repo (microsoft#47)
1 parent b9aa8bb commit f291dea

7 files changed

Lines changed: 220 additions & 217 deletions

File tree

.github/actions/winget-install/action.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
on:
22
push:
3-
pull_request:
3+
# Temporarily disable until new wdk-build version is ingested: https://github.com/microsoft/Windows-rust-driver-samples/pull/46
4+
# pull_request:
45
merge_group:
56
schedule: # Trigger a job on default branch at 4AM PST everyday
67
- cron: "0 11 * * *"
@@ -15,12 +16,12 @@ env:
1516
jobs:
1617
build:
1718
name: Build
18-
runs-on: windows-latest
19+
runs-on: windows-2025
1920
strategy:
2021
fail-fast: false # Allow all matrix variants to complete even if some fail
2122
matrix:
2223
wdk:
23-
- Microsoft.WindowsWDK.10.0.22621 # NI WDK
24+
- 10.0.22621 # NI WDK
2425

2526
llvm:
2627
- 17.0.6
@@ -44,30 +45,39 @@ jobs:
4445
- name: Checkout Repository
4546
uses: actions/checkout@v4
4647

48+
- name: Checkout windows-drivers-rs actions
49+
uses: actions/checkout@v4
50+
with:
51+
repository: microsoft/windows-drivers-rs
52+
ref: main
53+
path: _temp/windows-drivers-rs
54+
sparse-checkout: |
55+
.github/actions
56+
sparse-checkout-cone-mode: false
57+
58+
- name: Copy actions to workspace
59+
shell: pwsh
60+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
61+
4762
- name: Install Winget
48-
uses: ./.github/actions/winget-install
63+
uses: ./.github/actions/install-winget
4964
with:
5065
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5166

67+
- name: Install Winget PowerShell Module
68+
shell: pwsh
69+
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
70+
5271
- name: Install LLVM ${{ matrix.llvm }}
53-
run: |
54-
if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') {
55-
Write-Host "LLVM ${{ matrix.llvm }} is already installed."
56-
} else {
57-
Write-Host "Installing LLVM ${{ matrix.llvm }}..."
58-
Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force
59-
}
60-
clang --version
72+
uses: ./.github/actions/install-llvm
73+
with:
74+
version: ${{ matrix.llvm }}
6175

6276
- name: Install WDK (${{ matrix.wdk }})
63-
run: |
64-
if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') {
65-
Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..."
66-
Update-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
67-
} else {
68-
Write-Host "Installing ${{ matrix.wdk }}..."
69-
Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
70-
}
77+
uses: ./.github/actions/install-wdk
78+
with:
79+
version: ${{ matrix.wdk }}
80+
source: winget
7181

7282
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
7383
uses: dtolnay/rust-toolchain@master

.github/workflows/cargo-audit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
cargo_audit:
1414
name: Cargo Audit
15-
runs-on: windows-latest
15+
runs-on: windows-2025
1616
permissions:
1717
issues: write
1818
checks: write

.github/workflows/code-formatting-check.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@ on:
66
schedule: # Trigger a job on default branch at 4AM PST everyday
77
- cron: 0 11 * * *
88

9-
109
jobs:
1110
cargo-fmt:
1211
name: .rs Formatting Check
13-
runs-on: windows-latest
12+
runs-on: windows-2025
1413

1514
steps:
1615
- name: Checkout Repository
1716
uses: actions/checkout@v4
1817

1918
- name: Install Rust Toolchain (Nightly)
2019
uses: dtolnay/rust-toolchain@nightly
21-
with:
20+
with:
2221
components: rustfmt
2322

2423
- name: Run Cargo Format
2524
run: cargo +nightly fmt --all -- --check
2625

2726
taplo-fmt:
2827
name: .toml Formatting Check
29-
runs-on: windows-latest
28+
runs-on: windows-2025
3029

3130
steps:
3231
- name: Checkout Repository

.github/workflows/docs.yaml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ env:
1313
jobs:
1414
docs:
1515
name: Docs
16-
runs-on: windows-latest
16+
runs-on: windows-2025
1717
strategy:
1818
matrix:
1919
wdk:
20-
- Microsoft.WindowsWDK.10.0.22621 # NI WDK
20+
- 10.0.22621 # NI WDK
2121

2222
llvm:
2323
- 17.0.6
@@ -39,30 +39,39 @@ jobs:
3939
- name: Checkout Repository
4040
uses: actions/checkout@v4
4141

42+
- name: Checkout windows-drivers-rs actions
43+
uses: actions/checkout@v4
44+
with:
45+
repository: microsoft/windows-drivers-rs
46+
ref: main
47+
path: _temp/windows-drivers-rs
48+
sparse-checkout: |
49+
.github/actions
50+
sparse-checkout-cone-mode: false
51+
52+
- name: Copy actions to workspace
53+
shell: pwsh
54+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
55+
4256
- name: Install Winget
43-
uses: ./.github/actions/winget-install
57+
uses: ./.github/actions/install-winget
4458
with:
4559
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4660

61+
- name: Install Winget PowerShell Module
62+
shell: pwsh
63+
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
64+
4765
- name: Install LLVM ${{ matrix.llvm }}
48-
run: |
49-
if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') {
50-
Write-Host "LLVM ${{ matrix.llvm }} is already installed."
51-
} else {
52-
Write-Host "Installing LLVM ${{ matrix.llvm }}..."
53-
Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force
54-
}
55-
clang --version
66+
uses: ./.github/actions/install-llvm
67+
with:
68+
version: ${{ matrix.llvm }}
5669

5770
- name: Install WDK (${{ matrix.wdk }})
58-
run: |
59-
if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') {
60-
Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..."
61-
Update-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
62-
} else {
63-
Write-Host "Installing ${{ matrix.wdk }}..."
64-
Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
65-
}
71+
uses: ./.github/actions/install-wdk
72+
with:
73+
version: ${{ matrix.wdk }}
74+
source: winget
6675

6776
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
6877
uses: dtolnay/rust-toolchain@master

.github/workflows/lint.yaml

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ name: Lint
1010
jobs:
1111
clippy:
1212
name: Clippy
13-
runs-on: windows-latest
13+
runs-on: windows-2025
1414
permissions:
1515
checks: write
1616
strategy:
1717
matrix:
1818
wdk:
19-
- Microsoft.WindowsWDK.10.0.22621 # NI WDK
19+
- 10.0.22621 # NI WDK
2020

2121
llvm:
2222
- 17.0.6
@@ -38,30 +38,39 @@ jobs:
3838
- name: Checkout Repository
3939
uses: actions/checkout@v4
4040

41+
- name: Checkout windows-drivers-rs actions
42+
uses: actions/checkout@v4
43+
with:
44+
repository: microsoft/windows-drivers-rs
45+
ref: main
46+
path: _temp/windows-drivers-rs
47+
sparse-checkout: |
48+
.github/actions
49+
sparse-checkout-cone-mode: false
50+
51+
- name: Copy actions to workspace
52+
shell: pwsh
53+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
54+
4155
- name: Install Winget
42-
uses: ./.github/actions/winget-install
56+
uses: ./.github/actions/install-winget
4357
with:
4458
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4559

60+
- name: Install Winget PowerShell Module
61+
shell: pwsh
62+
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
63+
4664
- name: Install LLVM ${{ matrix.llvm }}
47-
run: |
48-
if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') {
49-
Write-Host "LLVM ${{ matrix.llvm }} is already installed."
50-
} else {
51-
Write-Host "Installing LLVM ${{ matrix.llvm }}..."
52-
Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force
53-
}
54-
clang --version
65+
uses: ./.github/actions/install-llvm
66+
with:
67+
version: ${{ matrix.llvm }}
5568

5669
- name: Install WDK (${{ matrix.wdk }})
57-
run: |
58-
if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') {
59-
Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..."
60-
Update-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
61-
} else {
62-
Write-Host "Installing ${{ matrix.wdk }}..."
63-
Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
64-
}
70+
uses: ./.github/actions/install-wdk
71+
with:
72+
version: ${{ matrix.wdk }}
73+
source: winget
6574

6675
- name: Install Rust Toolchain (${{ matrix.rust_toolchain }})
6776
uses: dtolnay/rust-toolchain@master
@@ -79,30 +88,44 @@ jobs:
7988

8089
machete:
8190
name: Detect Unused Cargo Dependencies
82-
runs-on: windows-latest
91+
runs-on: windows-2025
8392
strategy:
8493
matrix:
8594
wdk:
86-
- Microsoft.WindowsWDK.10.0.22621 # NI WDK
95+
- 10.0.22621 # NI WDK
8796

8897
steps:
8998
- name: Checkout Repository
9099
uses: actions/checkout@v4
91100

101+
- name: Checkout windows-drivers-rs actions
102+
uses: actions/checkout@v4
103+
with:
104+
repository: microsoft/windows-drivers-rs
105+
ref: main
106+
path: _temp/windows-drivers-rs
107+
sparse-checkout: |
108+
.github/actions
109+
sparse-checkout-cone-mode: false
110+
111+
- name: Copy actions to workspace
112+
shell: pwsh
113+
run: Copy-Item -Recurse -Force _temp/windows-drivers-rs/.github/actions .github/
114+
92115
- name: Install Winget
93-
uses: ./.github/actions/winget-install
116+
uses: ./.github/actions/install-winget
94117
with:
95118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96119

120+
- name: Install Winget PowerShell Module
121+
shell: pwsh
122+
run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
123+
97124
- name: Install WDK (${{ matrix.wdk }})
98-
run: |
99-
if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') {
100-
Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..."
101-
Update-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
102-
} else {
103-
Write-Host "Installing ${{ matrix.wdk }}..."
104-
Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force
105-
}
125+
uses: ./.github/actions/install-wdk
126+
with:
127+
version: ${{ matrix.wdk }}
128+
source: winget
106129

107130
- name: Install Rust Toolchain
108131
uses: dtolnay/rust-toolchain@stable

0 commit comments

Comments
 (0)