-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'microsoft:develop' into develop
- Loading branch information
Showing
772 changed files
with
14,144 additions
and
110,100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Using GitHub actions for building drivers | ||
|
||
If you use GitHub to host your code, you can leverage [GitHub Actions](https://docs.github.com/en/actions) to create automated workflows to build your driver projects. | ||
|
||
`windows-2022` runner (provided by `windows-latest`) is configured with Windows Driver Kit version 22H2 and Visual Studio 2022 off the box, so most solutions can be built by running `msbuild` directly. | ||
|
||
```yaml | ||
name: Build driver solution | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
configuration: [Debug, Release] | ||
platform: [x64] | ||
runs-on: windows-2022 | ||
env: | ||
Solution_Path: path\to\driver\solution.sln | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Add MSBuild to PATH | ||
uses: microsoft/[email protected] | ||
|
||
- name: Build solution | ||
run: | | ||
msbuild ${{ env.Solution_Path }} -p:Configuration:${{ env.Configuration }} -p:Platform:${{ env.Platform }} | ||
env: | ||
Configuration: ${{ matrix.configuration }} | ||
Platform: ${{ matrix.platform }} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[CmdletBinding()] | ||
param ( | ||
[array]$ChangedFiles | ||
) | ||
|
||
$Verbose = $false | ||
if ($PSBoundParameters.ContainsKey('Verbose')) { | ||
$Verbose = $PsBoundParameters.Get_Item('Verbose') | ||
} | ||
|
||
$root = (Get-Location).Path | ||
|
||
# Search for samples (directories) to build | ||
$sampleSet = @{} | ||
$buildAll = $false | ||
foreach ($file in $ChangedFiles) { | ||
if (-not (Test-Path $file)) { | ||
Write-Verbose "`u{2754} Changed file $file cannot be found" | ||
continue | ||
} | ||
$dir = (Get-Item $file).DirectoryName | ||
$filename = Split-Path $file -Leaf | ||
|
||
# Files that can affect how every sample is built should trigger a full build | ||
if ($filename -eq "Build-AllSamples.ps1" -or $filename -eq "Build-Sample.ps1") { | ||
$buildAll = $true | ||
} | ||
if ($dir -like "$root\.github\scripts" -or $dir -like "$root\.github\scripts\*") { | ||
$buildAll = $true | ||
} | ||
if ($dir -like "$root\.github\workflows" -or $dir -like "$root\.github\workflows\*") { | ||
$buildAll = $true | ||
} | ||
if ($buildAll) | ||
{ | ||
Write-Verbose "`u{2754} Full build triggered by change in file $file" | ||
break | ||
} | ||
|
||
while ((-not ($slnItems = (Get-ChildItem $dir '*.sln'))) -and ($dir -ne $root)) { | ||
$dir = (Get-Item $dir).Parent.FullName | ||
} | ||
if ($dir -eq $root) { | ||
Write-Verbose "`u{2754} Changed file $file does not match a sample" | ||
continue | ||
} | ||
$sampleName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() | ||
Write-Verbose "`u{1F50E} Found sample [$sampleName] at $dir from changed file $file" | ||
if (-not ($sampleSet.ContainsKey($sampleName))) { | ||
$sampleSet[$sampleName] = $dir | ||
} | ||
} | ||
|
||
if ($buildAll) { | ||
.\Build-AllSamples -Verbose:$Verbose -LogFilesDirectory (Join-Path $root "_logs") | ||
} | ||
else { | ||
.\Build-SampleSet -SampleSet $sampleSet -Verbose:$Verbose -LogFilesDirectory (Join-Path $root "_logs") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# This workflow runs the latest CodeQL CLI and checks against CodeQL's Cpp library. | ||
# This is the source for the GitHub Security Code Scanning job. | ||
|
||
name: "CodeQL Analysis" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: | ||
- main | ||
- develop | ||
|
||
# Allow manual scheduling | ||
workflow_dispatch: | ||
|
||
jobs: | ||
analyze: | ||
name: Analysis | ||
runs-on: windows-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'cpp' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Add MSBuild to PATH | ||
uses: microsoft/[email protected] | ||
|
||
- name: Retrieve and build all available solutions | ||
id: build-all-samples | ||
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@v2 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,6 @@ jobs: | |
configuration: [Debug, Release] | ||
platform: [x64, arm64] | ||
runs-on: windows-2022 | ||
env: | ||
Solution_Path: general\echo\kmdf\kmdfecho.sln | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
@@ -27,9 +25,9 @@ jobs: | |
uses: microsoft/[email protected] | ||
|
||
- name: Retrieve and build all available solutions | ||
id: build-all-projects | ||
id: build-all-samples | ||
run: | | ||
.\Build-AllProjects.ps1 | ||
.\Build-AllSamples.ps1 -Verbose | ||
env: | ||
Configuration: ${{ matrix.configuration }} | ||
Platform: ${{ matrix.platform }} | ||
WDS_Configuration: ${{ matrix.configuration }} | ||
WDS_Platform: ${{ matrix.platform }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<# | ||
.SYNOPSIS | ||
Builds all available sample solutions in the repository (excluding specific solutions). | ||
.DESCRIPTION | ||
This script searches for all available Visual Studio Solutions (.sln files) and attempts to run MSBuild to build them for the specified configurations and platforms. | ||
.PARAMETER Samples | ||
A regular expression matching the samples to be built. Default is '' that matches all samples. Examples include '^tools.' or '.dchu'. | ||
.PARAMETER Configurations | ||
A list of configurations to build samples under. Values available are 'Debug' and 'Release'. By default, $env:WDS_Configuration will be used as the sole configuration to build for. If this environment variable is not set the default is 'Debug' and 'Release'. | ||
.PARAMETER Platforms | ||
A list of platforms to build samples under (e.g. 'x64', 'arm64'). By default, $env:WDS_Platform will be used as the sole platform to build for. If this environment variable is not set the default is 'x64' and'arm64'. | ||
.PARAMETER LogFilesDirectory | ||
Path to a directory where the log files will be written to. If not provided, outputs will be logged to the '_logs' directory within the current working directory. | ||
.PARAMETER ThrottleLimit | ||
An integer indicating how many combinations to build in parallel. If 0 or not provided this defaults to 5 x number of logical processors. | ||
.INPUTS | ||
None. | ||
.OUTPUTS | ||
None. | ||
.EXAMPLE | ||
.\Build-AllSamples | ||
.EXAMPLE | ||
.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64' | ||
#> | ||
|
||
[CmdletBinding()] | ||
param( | ||
[string]$Samples = "", | ||
[string[]]$Configurations = @(if ([string]::IsNullOrEmpty($env:WDS_Configuration)) { ('Debug', 'Release') } else { $env:WDS_Configuration }), | ||
[string[]]$Platforms = @(if ([string]::IsNullOrEmpty($env:WDS_Platform)) { ('x64', 'arm64') } else { $env:WDS_Platform }), | ||
[string]$LogFilesDirectory = (Join-Path (Get-Location) "_logs"), | ||
[int]$ThrottleLimit | ||
) | ||
|
||
$Verbose = $false | ||
if ($PSBoundParameters.ContainsKey('Verbose')) { | ||
$Verbose = $PsBoundParameters.Get_Item('Verbose') | ||
} | ||
|
||
$root = Get-Location | ||
$solutionFiles = Get-ChildItem -Path $root -Recurse -Filter *.sln | Select-Object -ExpandProperty FullName | ||
|
||
# To include in CI gate | ||
$sampleSet = @{} | ||
foreach ($file in $solutionFiles) { | ||
$dir = (Get-Item $file).DirectoryName | ||
$dir_norm = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() | ||
if ($dir_norm -match ($Samples)) { | ||
Write-Verbose "`u{1F50E} Found and included sample [$dir_norm] at $dir" | ||
$sampleSet[$dir_norm] = $dir | ||
} | ||
else { | ||
Write-Verbose "`u{1F50E} Found and excluded sample [$dir_norm] at $dir" | ||
} | ||
} | ||
|
||
.\Build-SampleSet -SampleSet $sampleSet -Configurations $Configurations -Platform $Platforms -LogFilesDirectory $LogFilesDirectory -Verbose:$Verbose -ThrottleLimit $ThrottleLimit |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.