Skip to content

Commit

Permalink
Partial Manual Merge of develop to main specifically to add support f…
Browse files Browse the repository at this point in the history
…or fine grained exclusions (#1076)

user/jakob/partial_manual_merge_develop_to_main_fine_grained_exclusion
  • Loading branch information
JakobL-MSFT authored Jan 15, 2024
1 parent 7b0c7e2 commit d3e7ba7
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/Build-ChangedSamples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ foreach ($file in $ChangedFiles) {
$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" -or $filename -eq "Build-SampleSet.ps1") {
if ($filename -eq "Build-AllSamples.ps1" -or $filename -eq "Build-Sample.ps1" -or $filename -eq "Build-SampleSet.ps1" -or $filename -eq "exclusions.csv") {
$buildAll = $true
}
if ($dir -like "$root\.github\scripts" -or $dir -like "$root\.github\scripts\*") {
Expand Down
4 changes: 2 additions & 2 deletions Build-AllSamples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ 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"
Write-Verbose "`u{1F50E} Found and filtered in sample [$dir_norm] at $dir"
$sampleSet[$dir_norm] = $dir
}
else {
Write-Verbose "`u{1F50E} Found and excluded sample [$dir_norm] at $dir"
Write-Verbose "`u{1F50E} Found and filtered out sample [$dir_norm] at $dir"
}
}

Expand Down
71 changes: 66 additions & 5 deletions Build-SampleSet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,74 @@ finally {
$ErrorActionPreference = $oldPreference
}

#
# Determine build environment: 'WDK', 'EWDK', or 'GitHub'. Only used to determine build number.
# Determine build number (used for exclusions based on build number). Five digits. Say, '22621'.
#
$build_environment=""
$build_number=0
#
# EWDK sets environment variable Version_Number. For example '10.0.22621.0'.
#
if($env:Version_Number -match '10.0.(?<build>.*).0') {
$build_environment="EWDK"
$build_number=$Matches.build
}
#
# WDK sets environment variable UCRTVersion. For example '10.0.22621.0'.
#
elseif ($env:UCRTVersion -match '10.0.(?<build>.*).0') {
$build_environment="WDK"
$build_number=$Matches.build
}
#
# Hack: In GitHub we do not have an environment variable where we can see WDK build number, so we have it hard coded.
#
elseif (-not $env:GITHUB_REPOSITORY -eq '') {
$build_environment="GitHub"
$build_number=22621
}
else {

# Dump all environment variables so as to help debug error:
Write-Output "Environment variables {"
gci env:* | sort-object name
Write-Output "Environment variables }"

Write-Error "Could not determine build environment."
exit 1
}

#
# Determine exclusions.
#
# Exclusions are loaded from .\exclusions.csv.
# Each line has form:
# Path,Configurations,MinBuild,MaxBuild,Reason
# Where:
# Path: Is the path to folder containing solution(s) using backslashes. For example: 'audio\acx\samples\audiocodec\driver' .
# Configurations: Are the configurations to exclude. For example: '*|arm64' .
# MinBuild: Is the minimum WDK/EWDK build number the exclusion is applicable for. For example: '22621' .
# MaxBuild: Is the maximum WDK/EWDK build number the exclusion is applicable for. For example: '26031' .
# Reason: Is plain text documenting the reason for the exclusion. For example: 'error C1083: Cannot open include file: 'acx.h': No such file or directory' .
#
$exclusionConfigurations = @{}
$exclusionReasons = @{}
Import-Csv 'exclusions.csv' | ForEach-Object {
if ($_.Configurations) {
$exclusionConfigurations[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Configurations
$excluded_driver=$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()
$excluded_configurations=($_.configurations -eq '' ? '*' : $_.configurations)
$excluded_minbuild=($_.MinBuild -eq '' ? 00000 : $_.MinBuild)
$excluded_maxbuild=($_.MaxBuild -eq '' ? 99999 : $_.MaxBuild)
if (($excluded_minbuild -le $build_number) -and ($build_number -le $excluded_maxbuild) )
{
$exclusionConfigurations[$excluded_driver] = $excluded_configurations
$exclusionReasons[$excluded_driver] = $_.Reason
Write-Verbose "Exclusion.csv entry applied for '$excluded_driver' for configuration '$excluded_configurations'."
}
else {
$exclusionConfigurations[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = '*'
else
{
Write-Verbose "Exclusion.csv entry not applied for '$excluded_driver' due to build number."
}
$exclusionReasons[$_.Path.Replace($root, '').Trim('\').Replace('\', '.').ToLower()] = $_.Reason
}

$jresult = @{
Expand All @@ -67,6 +125,8 @@ $jresult = @{

$SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count

Write-Output ("Build Environment: " + $build_environment)
Write-Output ("Build Number: " + $build_number)
Write-Output ("Samples: " + $sampleSet.Count)
Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")")
Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")
Expand Down Expand Up @@ -178,6 +238,7 @@ $sw.Stop()

if ($jresult.FailSet.Count -gt 0) {
Write-Output "Some combinations were built with errors:"
$jresult.FailSet = $jresult.FailSet | Sort-Object
foreach ($failedSample in $jresult.FailSet) {
$failedSample -match "^(.*) (\w*)\|(\w*)$" | Out-Null
$failName = $Matches[1]
Expand Down
34 changes: 19 additions & 15 deletions exclusions.csv
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
Path,Reason
general\dchu\osrfx2_dchu_base,Wrong Toolset - needs migration
general\dchu\osrfx2_dchu_extension_loose,Needs fix for project not found
general\dchu\osrfx2_dchu_extension_tight,Wrong Toolset - needs migration
general\filehistory,Deprecated APIs
general\simplemediasource,ARM64 LNK1181: cannot open input file 'SimpleMediaSource.lib'
general\winhec 2017 lab\toaster driver,Needs input from end user
general\winhec 2017 lab\toaster support app,Needs input from end user
network\trans\stmedit,Invalid Win32 architecture
network\trans\wfpsampler,Missing INF section; missing libs
network\wlan\wdi,Invalid architecture
print\oem printer customization plug-in samples\c++,Invalid architecture
print\v4printdriversamples\printerextensionsample,Invalid architecture
tree,Missing headers
video\indirectdisplay,ARM64 Warning C4530: C++ exception handler used but unwind semantics are not enabled
Path,Configurations,MinBuild,MaxBuild,Reason
avstream\sampledevicemft,*,26031,,Only GE: Fails to build
general\dchu\osrfx2_dchu_base,*,,,Wrong Toolset - needs migration
general\dchu\osrfx2_dchu_extension_loose,*,,,Needs fix for project not found
general\dchu\osrfx2_dchu_extension_tight,*,,,Wrong Toolset - needs migration
general\filehistory,*,,,Deprecated APIs
general\simplemediasource,Debug|arm64,,,Only Debug|arm64: LNK1181: cannot open input file 'SimpleMediaSource.lib'
general\winhec 2017 lab\toaster driver,*,,,Needs input from end user
general\winhec 2017 lab\toaster support app,*,,,Needs input from end user
hid\hidusbfx2,*,,22621,Only NI: Bug 48374115: NI Serviced version of infverif and NI version of Windows Driver Samples should be compatible
hid\vhidmini2,*,,22621,Only NI: Bug 48374115: NI Serviced version of infverif and NI version of Windows Driver Samples should be compatible
network\trans\stmedit,*,,,Invalid Win32 architecture
network\trans\wfpsampler,*,,,Missing INF section; missing libs
network\wlan\wdi,*,,,Invalid architecture
print\oem printer customization plug-in samples\c++,*,,,Invalid architecture
print\v4printdriversamples\printerextensionsample,*,,,Invalid architecture
storage\class\cdrom,*,26031,,Only GE: Fails to build
tree,*,,,Missing headers
video\indirectdisplay,*|arm64,,,Only arm64: Warning C4530: C++ exception handler used but unwind semantics are not enabled

0 comments on commit d3e7ba7

Please sign in to comment.