[ci]Verify notice.md and NuGet packages are synced (#23000)

* Create verifyNoticeMdAgainstNugetPackages.ps1

* Update build-powertoys-steps.yml

* Update verifyNoticeMdAgainstNugetPackages.ps1

* Update verifyNoticeMdAgainstNugetPackages.ps1

* Update build-powertoys-steps.yml

* Update build-powertoys-steps.yml

* Update NOTICE.md

* Update NOTICE.md

* Update NOTICE.md

* Update verifyNoticeMdAgainstNugetPackages.ps1

* Update verifyNoticeMdAgainstNugetPackages.ps1

* adding back in the Community Toolkit items

weird, some how there was a checkin with this being removed

* Update .pipelines/verifyNoticeMdAgainstNugetPackages.ps1

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>

* Update .pipelines/verifyNoticeMdAgainstNugetPackages.ps1

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>

* Update .pipelines/verifyNoticeMdAgainstNugetPackages.ps1

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>

* Update .pipelines/verifyNoticeMdAgainstNugetPackages.ps1

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>

* shifting the restore for setup back to where it was plus moving the verification to end.

* moved wrong powershell, fliping back

Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
This commit is contained in:
Clint Rutkas
2023-01-09 04:27:57 -08:00
committed by GitHub
parent 8b98ed7447
commit 3fb707f78d
3 changed files with 140 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ steps:
clean: true clean: true
- task: PowerShell@2 - task: PowerShell@2
displayName: Verifying Nuget packages for PowerToys.sln displayName: Verifying Nuget package versions for PowerToys.sln
inputs: inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1' filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1'
arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln' arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln'
@@ -69,7 +69,7 @@ steps:
configPath: NuGet.config configPath: NuGet.config
restoreSolution: PowerToys.sln restoreSolution: PowerToys.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages' restoreDirectory: '$(Build.SourcesDirectory)\packages'
- task: VSBuild@1 - task: VSBuild@1
displayName: 'Build PowerToys.sln' displayName: 'Build PowerToys.sln'
inputs: inputs:
@@ -137,12 +137,6 @@ steps:
msbuildArgs: ${{ parameters.additionalBuildArguments }} msbuildArgs: ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true maximumCpuCount: true
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
targetType: filePath
filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1'
- task: NuGetCommand@2 - task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToysSetup.sln displayName: Restore NuGet packages for PowerToysSetup.sln
inputs: inputs:
@@ -152,6 +146,12 @@ steps:
restoreSolution: installer\PowerToysSetup.sln restoreSolution: installer\PowerToysSetup.sln
restoreDirectory: '$(Build.SourcesDirectory)\installer\packages' restoreDirectory: '$(Build.SourcesDirectory)\installer\packages'
- task: PowerShell@2
displayName: Download and install WiX 3.14 development build
inputs:
targetType: filePath
filePath: '$(build.sourcesdirectory)\.pipelines\installWiX.ps1'
- task: VSBuild@1 - task: VSBuild@1
displayName: 'Build PowerToys MSI' displayName: 'Build PowerToys MSI'
inputs: inputs:
@@ -227,3 +227,10 @@ steps:
**\powerpreviewTest.dll **\powerpreviewTest.dll
**\UnitTests-FancyZones.dll **\UnitTests-FancyZones.dll
!**\obj\** !**\obj\**
- task: PowerShell@2
displayName: Verifying Notice.md and Nuget packages match
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1'
arguments: -path '$(build.sourcesdirectory)\'
pwsh: true

View File

@@ -0,0 +1,73 @@
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$path
)
$noticeFile = Get-Content -Raw "NOTICE.md"
Write-Host $noticeFile
Write-Host "Verifying NuGet packages"
$projFiles = Get-ChildItem $path -Filter *.csproj -force -Recurse
$projFiles.Count
Write-Host "Going through all csproj files"
$totalList = $projFiles | ForEach-Object -Parallel {
$csproj = $_
$nugetTemp = @();
#Workaround for preventing exit code from dotnet process from reflecting exit code in PowerShell
$procInfo = New-Object System.Diagnostics.ProcessStartInfo -Property @{
FileName = "dotnet.exe";
Arguments = "list $csproj package";
RedirectStandardOutput = $true;
RedirectStandardError = $true;
}
$proc = [System.Diagnostics.Process]::Start($procInfo);
while (!$proc.StandardOutput.EndOfStream) {
$nugetTemp += $proc.StandardOutput.ReadLine();
}
$proc = $null;
$procInfo = $null;
if($nugetTemp -is [array] -and $nugetTemp.count -gt 3)
{
$temp = New-Object System.Collections.ArrayList
$temp.AddRange($nugetTemp)
$temp.RemoveRange(0, 3)
foreach($p in $temp)
{
# breaking item down to usable array and getting 1 and 2, see below of a sample output
# > PACKAGE VERSION VERSION
$p = -split $p
$p = $p[1, 2]
$tempString = $p[0] + " " + $p[1]
if(![string]::IsNullOrWhiteSpace($tempString))
{
echo "- $tempString";
}
}
$csproj = $null;
}
} -ThrottleLimit 4 | Sort-Object
$returnList = [System.Collections.Generic.HashSet[string]]($totalList) -join "`r`n"
Write-Host $returnList
if (!$noticeFile.Trim().EndsWith($returnList.Trim()))
{
Write-Host -ForegroundColor Red "Notice.md does not match NuGet list."
exit 1
}
exit 0

View File

@@ -274,3 +274,55 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
## NuGet Packages used by PowerToys
- CommunityToolkit.Labs.WinUI.SettingsControls 0.0.7
- CommunityToolkit.Mvvm 8.0.0
- CommunityToolkit.WinUI.UI 7.1.2
- CommunityToolkit.WinUI.UI.Controls 7.1.2
- ControlzEx 5.0.1
- HelixToolkit 2.20.2
- HelixToolkit.Core.Wpf 2.20.2
- hyjiacan.pinyin4net 4.1.1
- Interop.Microsoft.Office.Interop.OneNote 1.1.0.2
- LazyCache 2.4.0
- Mages 2.0.1
- Markdig.Signed 0.27.0
- Microsoft.CodeAnalysis.NetAnalyzers 7.0.0
- Microsoft.Data.Sqlite 7.0.0
- Microsoft.Extensions.Hosting 7.0.0
- Microsoft.NET.Test.Sdk 17.4.1
- Microsoft.Toolkit.Uwp.Notifications 7.1.2
- Microsoft.Web.WebView2 1.0.1343.22
- Microsoft.Windows.CsWin32 0.2.46-beta
- Microsoft.Windows.CsWinRT 2.0.0
- Microsoft.Windows.SDK.BuildTools 10.0.22621.755
- Microsoft.WindowsAppSDK 1.2.221116.1
- Microsoft.Xaml.Behaviors.WinUI.Managed 2.0.9
- Microsoft.Xaml.Behaviors.Wpf 1.1.39
- ModernWpfUI 0.9.4
- Moq 4.18.3
- MSTest.TestAdapter 3.0.1
- MSTest.TestFramework 3.0.1
- NLog 5.0.4
- NLog.Extensions.Logging 5.0.4
- NLog.Schema 5.0.4
- ScipBe.Common.Office.OneNote 3.0.1
- StyleCop.Analyzers 1.2.0-beta.435
- System.CommandLine 2.0.0-beta1.20071.2
- System.ComponentModel.Composition 7.0.0
- System.Configuration.ConfigurationManager 6.0.0
- System.Data.OleDb 7.0.0
- System.Drawing.Common 7.0.0
- System.IO.Abstractions 17.2.3
- System.IO.Abstractions.TestingHelpers 17.2.3
- System.Management 7.0.0
- System.Reactive 5.0.0
- System.Runtime.Caching 7.0.0
- System.ServiceProcess.ServiceController 7.0.0
- UnicodeInformation 2.6.0
- UnitsNet 4.145.0
- Vanara.PInvoke.Shell32 3.4.11
- Vanara.PInvoke.User32 3.4.11
- WinUIEx 1.8.0