summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorMatt <[email protected]>2024-06-24 11:14:36 -0700
committerGitHub <[email protected]>2024-06-24 11:14:36 -0700
commite59949f40da211f378e8f76bee383506d9b97243 (patch)
treee87800c55626a907a89eb6233f387fc4727c13b5 /.github
parentdbfbeada993778d718d8ac829d8f496ee015d5e2 (diff)
CI Pipelines build with WDK Nuget Packages (#1179)
Integrate nuget into the workflow pipelines
Diffstat (limited to '.github')
-rw-r--r--.github/scripts/Install-Vsix.ps168
-rw-r--r--.github/workflows/Code-Scanning.yml50
-rw-r--r--.github/workflows/ci-pr.yml10
-rw-r--r--.github/workflows/ci.yml13
4 files changed, 106 insertions, 35 deletions
diff --git a/.github/scripts/Install-Vsix.ps1 b/.github/scripts/Install-Vsix.ps1
new file mode 100644
index 00000000..24c7ef45
--- /dev/null
+++ b/.github/scripts/Install-Vsix.ps1
@@ -0,0 +1,68 @@
+<#
+
+.SYNOPSIS
+Checks WDK vsix version and downloads and installs as necessary.
+
+#>
+
+[CmdletBinding()]
+param(
+ [bool]$optimize = $false
+)
+
+$root = Get-Location
+
+# launch developer powershell (if necessary)
+if (-not $env:VSCMD_VER) {
+ Import-Module (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
+ Enter-VsDevShell -VsInstallPath (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*")
+ cd $root
+}
+
+# source environment variables
+. .\Env-Vars.ps1
+
+$version = $env:SAMPLES_VSIX_VERSION
+$uri = $env:SAMPLES_VSIX_URI
+
+function PrintWdkVsix {
+ $installed = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name
+ "WDK Vsix Version: $installed"
+}
+
+function TestWdkVsix {
+ Test-Path "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=$version"
+}
+
+if ($optimize) {
+ "---> Downloading vsix and configuring build environment..."
+ Invoke-WebRequest -Uri "$uri" -OutFile wdk.zip
+ Expand-Archive ".\wdk.zip" .\
+ cp ".\`$MSBuild\*" (Resolve-Path "$env:ProgramFiles\Microsoft Visual Studio\2022\*\MSBuild\") -Recurse -Force
+ "<--- Finished"
+}
+else {
+ "Getting installed WDK vsix..."
+ PrintWdkVsix
+ "Checking the WDK.vsix version installed..."
+ if (-not (TestWdkVsix)) {
+ "The correct WDK vsix is not installed."
+ "Will attempt to download and install now..."
+ Invoke-WebRequest -Uri "$uri" -OutFile wdk.vsix
+ "Finished downloading."
+ "Starting install process. This will take some time to complete..."
+ Start-Process vsixinstaller -ArgumentList "/f /q /sp .\wdk.vsix" -wait
+ "The install process has finished."
+ "Checking the WDK.vsix version installed..."
+ if (TestWdkVsix) {
+ PrintWdkVsix
+ "The WDK vsix version is OK"
+ }
+ else {
+ "The WDK vsix install FAILED"
+ Write-Host "`u{274C} wdk vsix install had an issue"
+ Write-Error "the wdk vsix cannot be installed at this time"
+ exit 1
+ }
+ }
+} \ No newline at end of file
diff --git a/.github/workflows/Code-Scanning.yml b/.github/workflows/Code-Scanning.yml
index a18bcf95..32bb5a65 100644
--- a/.github/workflows/Code-Scanning.yml
+++ b/.github/workflows/Code-Scanning.yml
@@ -32,31 +32,31 @@ jobs:
language: [ 'cpp' ]
steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- submodules: 'recursive'
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v3
- with:
- languages: ${{ matrix.language }}
- packs: microsoft/windows-drivers
- - name: Add MSBuild to PATH
- uses: microsoft/setup-msbuild@v2
+ - name: Install WDK VSIX
+ run: .\.github\scripts\Install-Vsix.ps1 -optimize:$true
- - name: Retrieve and build all available solutions
- run: |
- .\Build-AllSamples.ps1 -Verbose -ThrottleLimit 1
- env:
- WDS_Configuration: Debug
- WDS_Platform: x64
- WDS_WipeOutputs: ${{ true }}
+ - name: Install Nuget Packages
+ run: nuget restore .\packages.config -PackagesDirectory .\packages\
- - name: Perform CodeQL analysis
- uses: github/codeql-action/analyze@v3
- with:
- category: "/language:${{matrix.language}}"
-
-
-
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v3
+ with:
+ languages: ${{ matrix.language }}
+ packs: microsoft/windows-drivers
+
+ - name: Retrieve and build all available solutions
+ run: .\Build-AllSamples.ps1 -Verbose -ThrottleLimit 1
+ env:
+ WDS_Configuration: Debug
+ WDS_Platform: x64
+ WDS_WipeOutputs: ${{ true }}
+
+ - name: Perform CodeQL analysis
+ uses: github/codeql-action/analyze@v3
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml
index 7640b966..a179127a 100644
--- a/.github/workflows/ci-pr.yml
+++ b/.github/workflows/ci-pr.yml
@@ -22,8 +22,11 @@ jobs:
with:
submodules: 'recursive'
- - name: Add MSBuild to PATH
- uses: microsoft/setup-msbuild@v2
+ - name: Install WDK VSIX
+ run: .\.github\scripts\Install-Vsix.ps1 -optimize:$true
+
+ - name: Install Nuget Packages
+ run: nuget restore .\packages.config -PackagesDirectory .\packages\
- name: Get changed files
id: get-changed-files
@@ -63,8 +66,7 @@ jobs:
path: _logs
- name: Join and generate global reports
- run: |
- .\.github\scripts\Join-CsvReports.ps1
+ run: .\.github\scripts\Join-CsvReports.ps1
- name: Archive global overview build reports
uses: actions/upload-artifact@v3
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ad92f83b..13563aa8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,12 +22,14 @@ jobs:
with:
submodules: 'recursive'
- - name: Add MSBuild to PATH
- uses: microsoft/setup-msbuild@v2
+ - name: Install WDK VSIX
+ run: .\.github\scripts\Install-Vsix.ps1 -optimize:$true
+
+ - name: Install Nuget Packages
+ run: nuget restore .\packages.config -PackagesDirectory .\packages\
- name: Retrieve and build all available solutions
- run: |
- .\Build-AllSamples.ps1 -Verbose
+ run: .\Build-AllSamples.ps1 -Verbose
env:
WDS_Configuration: ${{ matrix.configuration }}
WDS_Platform: ${{ matrix.platform }}
@@ -56,8 +58,7 @@ jobs:
path: _logs
- name: Join and generate global reports
- run: |
- .\.github\scripts\Join-CsvReports.ps1
+ run: .\.github\scripts\Join-CsvReports.ps1
- name: Archive global overview build reports
uses: actions/upload-artifact@v3