From 0eabe5380e8c9d8486712a60805a9e07fd85861c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Thu, 30 Jun 2022 07:03:44 +0200 Subject: [PATCH 01/31] Make the title a step environment variable, so it doesn't need to be escaped. --- .../actions/verify-submodule-pull-request/action.yml | 10 ++++++++-- .github/workflows/verify.yml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/verify-submodule-pull-request/action.yml b/.github/actions/verify-submodule-pull-request/action.yml index 807e82ac3..6491ffe4c 100644 --- a/.github/actions/verify-submodule-pull-request/action.yml +++ b/.github/actions/verify-submodule-pull-request/action.yml @@ -25,10 +25,16 @@ runs: New-Item -ItemType File -Force $Profile | Out-Null Get-Content -Raw ${{ github.action_path }}/functions.ps1 >> $Profile + # We are using env for the title input in these steps because it realistically could contain + # quotes apostrophes or even both. This way those don't need to be escaped. - name: Ensure Current PR Title Includes Issue Code shell: pwsh - run: Check-Current '${{ inputs.title }}' + env: + PR_TITLE: ${{ inputs.title }} + run: Check-Current $Env:PR_TITLE - name: Ensure Parent Repository Contains Matching PR shell: pwsh - run: Check-Parent '${{ inputs.repository }}' '${{ inputs.title }}' + env: + PR_TITLE: ${{ inputs.title }} + run: Check-Parent '${{ inputs.repository }}' $Env:PR_TITLE diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 15a5852d9..a34b915d3 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -13,6 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Ensure Parent PR Exists - uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@dev + uses: Lombiq/GitHub-Actions/.github/actions/verify-submodule-pull-request@issue/OSOE-110 with: title: ${{ github.event.pull_request.title }} From 8e2c9892ffcc38bc9b92d20803ba3375353e8525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Thu, 30 Jun 2022 22:48:49 +0200 Subject: [PATCH 02/31] Call Update-ManifestVersion --- .../publish-nuget/Update-NuspecDependencies.ps1 | 13 +++++++++++++ .github/actions/publish-nuget/action.yml | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 .github/actions/publish-nuget/Update-NuspecDependencies.ps1 diff --git a/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 b/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 new file mode 100644 index 000000000..a8d689b42 --- /dev/null +++ b/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 @@ -0,0 +1,13 @@ +if (-not (Test-Path dependencies.xml)) { exit 0 } + +$fileName = (Get-Childitem *.nuspec).FullName +$nuspec = [xml](Get-Content $fileName) +$group = $nuspec.package.metadata.dependencies.group + +foreach($dependency in ([xml](Get-Content dependencies.xml)).dependencies.dependency) +{ + $node = $nuspec.ImportNode($dependency, $True) + $group.AppendChild($node) +} + +$nuspec.Save($fileName) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index a9e177bf5..f04c30114 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -102,6 +102,11 @@ runs: ) dotnet pack @arguments + - name: Update nuspec dependencies + working-directory: artifacts + shell: pwsh + run: Update-ManifestVersion + - name: Push with dotnet shell: pwsh run: dotnet nuget push artifacts/*.nupkg --api-key $Env:API_KEY --source '${{ steps.setup.outputs.source-url }}' --skip-duplicate From 9e6896f8b04e154995b7e4f04c408566875d66e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 15:57:27 +0200 Subject: [PATCH 03/31] Optional nuspec generation via pwsh script. --- .../publish-nuget/Update-NuspecDependencies.ps1 | 13 ------------- .github/actions/publish-nuget/action.yml | 10 ++++++---- 2 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 .github/actions/publish-nuget/Update-NuspecDependencies.ps1 diff --git a/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 b/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 deleted file mode 100644 index a8d689b42..000000000 --- a/.github/actions/publish-nuget/Update-NuspecDependencies.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -if (-not (Test-Path dependencies.xml)) { exit 0 } - -$fileName = (Get-Childitem *.nuspec).FullName -$nuspec = [xml](Get-Content $fileName) -$group = $nuspec.package.metadata.dependencies.group - -foreach($dependency in ([xml](Get-Content dependencies.xml)).dependencies.dependency) -{ - $node = $nuspec.ImportNode($dependency, $True) - $group.AppendChild($node) -} - -$nuspec.Save($fileName) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 6ea24c6e6..9a351d30c 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -49,6 +49,11 @@ runs: shell: pwsh run: dotnet restore -p:NuGetBuild=true --verbosity ${{ inputs.verbosity }} + - name: Generate nuspec file if needed + if: hashFile('ConvertTo-Nuspec.ps1') + shell: pwsh + run: ./ConvertTo-Nuspec.ps1 '${{ steps.setup.outputs.publish-version }}' + - name: Build uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev # Notes on the configuration: @@ -95,6 +100,7 @@ runs: "--verbosity:${{ inputs.verbosity }}", "-p:NuGetBuild=true", "-p:Version=${{ steps.setup.outputs.publish-version }}", + "-p:NuspecProperties=${{ steps.setup.outputs.publish-version }}", "-p:GenerateDocumentationFile=True", "-p:NoWarn=NU5104", "-p:TreatWarningsAsErrors=true", @@ -105,10 +111,6 @@ runs: ) dotnet pack @arguments - - name: Update nuspec dependencies - working-directory: artifacts - shell: pwsh - run: Update-ManifestVersion - name: Push with dotnet shell: pwsh From 9aedbb38914ff6af7f92c84cd47d35debb16f498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 15:57:54 +0200 Subject: [PATCH 04/31] Rewrite to pack each of the solution's projects separately. --- .github/actions/publish-nuget/action.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 9a351d30c..466dcc7b0 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -96,7 +96,7 @@ runs: "--warnaserror", "--no-restore", "--no-build", - "--output:artifacts", + "--output:" + (Join-Path $PWD artifacts), "--verbosity:${{ inputs.verbosity }}", "-p:NuGetBuild=true", "-p:Version=${{ steps.setup.outputs.publish-version }}", @@ -109,8 +109,23 @@ runs: "-p:SymbolPackageFormat=snupkg", "-p:NoDefaultExcludes=true" ) - dotnet pack @arguments + foreach ($project in (dotnet sln list | Select-Object -Skip 2 | % { Get-ChildItem $_ })) + { + Push-Location $project.Directory + + $nuspecFile = (Get-ChildItem *.nuspec).Name + if ($nuspecFile.Count -eq 1) + { + dotnet pack $project -p:NuspecFile="$nuspecFile" @arguments + } + else + { + dotnet pack $project @arguments + } + + Pop-Location + } - name: Push with dotnet shell: pwsh From a825d3a1357683303140bedd9adbff015a02bcb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 16:16:57 +0200 Subject: [PATCH 05/31] Some random code cleanup. --- .../publish-nuget/Update-ManifestVersion.ps1 | 22 +++++-------------- .github/actions/publish-nuget/action.yml | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 index 4f21b5b74..a91e98698 100644 --- a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 +++ b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 @@ -2,28 +2,16 @@ [string] $WorkDir, [string] - $PackageVersion + $Version ) -function Update-Manifest-Version { - param( - [string] - $Manifest, - [string] - $Version - ) - - (Get-Content -Raw $Manifest) -replace - '(?\[assembly:\s*(Module|Theme)\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" | - Out-File $Manifest - - Write-Output "Version updated in $Manifest to $Version" -} - $manifests = Get-ChildItem $WorkDir -File -Recurse -Filter "Manifest.cs" | Select-String -List -Pattern '(OrchardCore.Modules.Manifest|OrchardCore.DisplayManagement.Manifest)' | Select-Object -ExpandProperty Path foreach ($manifest in $manifests) { - Update-Manifest-Version $manifest $PackageVersion + $regex = '(?\[assembly:\s*(Module|Theme)\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" + (Get-Content -Raw $manifest) -replace $regex | Out-File $manifest + + Write-Output "Version updated in $manifest to $Version" } diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 466dcc7b0..de3755c07 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -40,7 +40,7 @@ runs: - name: Update package manifest version shell: pwsh - run: Update-ManifestVersion './' '${{ steps.setup.outputs.publish-version }}' + run: Update-ManifestVersion $PWD '${{ steps.setup.outputs.publish-version }}' - name: Enable Node corepack uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev From 78e31cdedf2e5fe1ba8bfa900f050d5ffb2d86d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 16:17:59 +0200 Subject: [PATCH 06/31] Refactor pack logic into script. --- .../publish-nuget/New-NugetPackages.ps1 | 18 ++++++++++++++++++ .github/actions/publish-nuget/action.yml | 19 +------------------ 2 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 .github/actions/publish-nuget/New-NugetPackages.ps1 diff --git a/.github/actions/publish-nuget/New-NugetPackages.ps1 b/.github/actions/publish-nuget/New-NugetPackages.ps1 new file mode 100644 index 000000000..a0891811f --- /dev/null +++ b/.github/actions/publish-nuget/New-NugetPackages.ps1 @@ -0,0 +1,18 @@ +param([array] $Arguments) + +foreach ($project in (dotnet sln list | Select-Object -Skip 2 | % { Get-ChildItem $_ })) +{ + Push-Location $project.Directory + + $nuspecFile = (Get-ChildItem *.nuspec).Name + if ($nuspecFile.Count -eq 1) + { + dotnet pack $project -p:NuspecFile="$nuspecFile" @Arguments + } + else + { + dotnet pack $project @Arguments + } + + Pop-Location +} \ No newline at end of file diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index de3755c07..771309428 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -91,7 +91,7 @@ runs: # * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages: # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg. run: | - $arguments = @( + New-NugetPackages @( "--configuration:Release", "--warnaserror", "--no-restore", @@ -110,23 +110,6 @@ runs: "-p:NoDefaultExcludes=true" ) - foreach ($project in (dotnet sln list | Select-Object -Skip 2 | % { Get-ChildItem $_ })) - { - Push-Location $project.Directory - - $nuspecFile = (Get-ChildItem *.nuspec).Name - if ($nuspecFile.Count -eq 1) - { - dotnet pack $project -p:NuspecFile="$nuspecFile" @arguments - } - else - { - dotnet pack $project @arguments - } - - Pop-Location - } - - name: Push with dotnet shell: pwsh run: dotnet nuget push artifacts/*.nupkg --api-key $Env:API_KEY --source '${{ steps.setup.outputs.source-url }}' --skip-duplicate From ea6ecac54af6bd035a904d8ddd2555955f8b14fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 16:23:43 +0200 Subject: [PATCH 07/31] Revert "Some random code cleanup." This reverts commit a825d3a1357683303140bedd9adbff015a02bcb7. --- .../publish-nuget/Update-ManifestVersion.ps1 | 22 ++++++++++++++----- .github/actions/publish-nuget/action.yml | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 index a91e98698..4f21b5b74 100644 --- a/.github/actions/publish-nuget/Update-ManifestVersion.ps1 +++ b/.github/actions/publish-nuget/Update-ManifestVersion.ps1 @@ -2,16 +2,28 @@ [string] $WorkDir, [string] - $Version + $PackageVersion ) +function Update-Manifest-Version { + param( + [string] + $Manifest, + [string] + $Version + ) + + (Get-Content -Raw $Manifest) -replace + '(?\[assembly:\s*(Module|Theme)\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" | + Out-File $Manifest + + Write-Output "Version updated in $Manifest to $Version" +} + $manifests = Get-ChildItem $WorkDir -File -Recurse -Filter "Manifest.cs" | Select-String -List -Pattern '(OrchardCore.Modules.Manifest|OrchardCore.DisplayManagement.Manifest)' | Select-Object -ExpandProperty Path foreach ($manifest in $manifests) { - $regex = '(?\[assembly:\s*(Module|Theme)\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" - (Get-Content -Raw $manifest) -replace $regex | Out-File $manifest - - Write-Output "Version updated in $manifest to $Version" + Update-Manifest-Version $manifest $PackageVersion } diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 771309428..2323751fc 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -40,7 +40,7 @@ runs: - name: Update package manifest version shell: pwsh - run: Update-ManifestVersion $PWD '${{ steps.setup.outputs.publish-version }}' + run: Update-ManifestVersion './' '${{ steps.setup.outputs.publish-version }}' - name: Enable Node corepack uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev From abdc4cf94d51139a7393d0931dd75cc8b6738b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 16:42:51 +0200 Subject: [PATCH 08/31] Update target branch. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7216c25cd..c4d8700c2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -49,7 +49,7 @@ jobs: dotnet-version: ${{ inputs.dotnet-version }} - name: Publish to NuGet - uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@dev + uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@issue/OSOE-110 with: source: ${{ inputs.source }} verbosity: ${{ inputs.verbosity }} From 33db42df8cfba073e91ad544f52dc27905ecf8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 17:25:41 +0200 Subject: [PATCH 09/31] Fix typo. --- .github/actions/publish-nuget/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 2323751fc..ba4299d5d 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -50,7 +50,7 @@ runs: run: dotnet restore -p:NuGetBuild=true --verbosity ${{ inputs.verbosity }} - name: Generate nuspec file if needed - if: hashFile('ConvertTo-Nuspec.ps1') + if: hashFiles('ConvertTo-Nuspec.ps1') shell: pwsh run: ./ConvertTo-Nuspec.ps1 '${{ steps.setup.outputs.publish-version }}' From d5179f8f0ae64dccda9410b80ff5b34fb14e335f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 17:39:58 +0200 Subject: [PATCH 10/31] Fix NuspecProperties --- .github/actions/publish-nuget/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index ba4299d5d..d66c6984b 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -100,7 +100,7 @@ runs: "--verbosity:${{ inputs.verbosity }}", "-p:NuGetBuild=true", "-p:Version=${{ steps.setup.outputs.publish-version }}", - "-p:NuspecProperties=${{ steps.setup.outputs.publish-version }}", + "-p:NuspecProperties=version=${{ steps.setup.outputs.publish-version }}", "-p:GenerateDocumentationFile=True", "-p:NoWarn=NU5104", "-p:TreatWarningsAsErrors=true", From afa9f86a27a6d26a4ae755375ffdc5aa546db7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 21:47:48 +0200 Subject: [PATCH 11/31] Add before pack hook. --- .github/actions/publish-nuget/action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index d66c6984b..a984e623f 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -81,6 +81,11 @@ runs: -p:DebugSymbols=true -p:DebugType=portable + - name: Actions prior to dotnet pack + if: hashFiles('Invoke-BeforePack.ps1') + shell: pwsh + run: ./Invoke-BeforePack.ps1 + - name: Pack shell: pwsh # Notes on the configuration apart from what's also for dotnet build: From 4f62c5c2ea38e19f584a6c5a9c605937ba7e2a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 2 Jul 2022 23:18:51 +0200 Subject: [PATCH 12/31] Fix "No newline at end of file". --- .github/actions/publish-nuget/New-NugetPackages.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/New-NugetPackages.ps1 b/.github/actions/publish-nuget/New-NugetPackages.ps1 index a0891811f..5fa3656b5 100644 --- a/.github/actions/publish-nuget/New-NugetPackages.ps1 +++ b/.github/actions/publish-nuget/New-NugetPackages.ps1 @@ -15,4 +15,4 @@ foreach ($project in (dotnet sln list | Select-Object -Skip 2 | % { Get-ChildIte } Pop-Location -} \ No newline at end of file +} From e3ff0b876080cca8a96500c270df37f141e39a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 4 Jul 2022 01:20:54 +0200 Subject: [PATCH 13/31] Whitelist NU5100. --- .github/actions/publish-nuget/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index a984e623f..4540eb46a 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -107,7 +107,7 @@ runs: "-p:Version=${{ steps.setup.outputs.publish-version }}", "-p:NuspecProperties=version=${{ steps.setup.outputs.publish-version }}", "-p:GenerateDocumentationFile=True", - "-p:NoWarn=NU5104", + "-p:NoWarn=NU5104%3BNU5100", "-p:TreatWarningsAsErrors=true", "-p:WarnOnPackingNonPackableProject=True", "-p:IncludeSymbols=true", From 5801fade1a7e1ba8da13e2323f53f27acaeeadfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 25 Jul 2022 00:24:59 +0200 Subject: [PATCH 14/31] Handle special case when no errors were displayed at all. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 5767f88f6..e71dd6404 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -72,6 +72,15 @@ if ($expectedErrorCodes) $fail = 0 $report = New-Object "System.Text.StringBuilder" "`n" + if ($null -eq $errorCodes -or -not $errorCodes.Count) + { + $expectedCount = $expectedErrorCodes.Count + $expectedCodesJoined = $expectedErrorCodes -join ', ' + + Write-Output "::error::Expected $expectedCount error codes ($expectedCodesJoined), but none were displayed." + exit 1 + } + $length = [System.Math]::Max($errorCodes.Count, $expectedErrorCodes.Count) foreach ($index in 0..($length - 1)) { From 352ac78ef7a98ea64ab29206dccb1fdd4f1b23c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 25 Jul 2022 00:41:00 +0200 Subject: [PATCH 15/31] Test double building, just as a sanity check. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index e71dd6404..905849dc1 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -56,6 +56,8 @@ $errorLines = New-Object "System.Collections.Generic.List[string]" $errorCodes = New-Object "System.Collections.Generic.List[string]" $errorFormat = '^(.*)\((\d+),(\d+)\): error (.*)' +dotnet build $Solution @buildSwitches 2>&1 | Out-Null +bash -c 'true' dotnet build $Solution @buildSwitches 2>&1 | % { if ($_ -notmatch $errorFormat) { return $_ } From 560dff1ddb03209803e739d1e04f0a0e39aad728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 25 Jul 2022 00:48:16 +0200 Subject: [PATCH 16/31] Select correct branch from workflow --- .github/workflows/test-analysis-failure.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-analysis-failure.yml b/.github/workflows/test-analysis-failure.yml index 3aa8a92ae..80013cc25 100644 --- a/.github/workflows/test-analysis-failure.yml +++ b/.github/workflows/test-analysis-failure.yml @@ -87,7 +87,7 @@ jobs: uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev - name: Build and Static Code Analysis - uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev + uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@issue/OSOE-110 with: directory: ${{ inputs.build-directory }} verbosity: quiet From 65f76abb7eafdb829661b92e99f5db63ab3f8cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Mon, 25 Jul 2022 01:22:03 +0200 Subject: [PATCH 17/31] Revert "Test double building, just as a sanity check." This reverts commit 352ac78ef7a98ea64ab29206dccb1fdd4f1b23c1. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 905849dc1..e71dd6404 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -56,8 +56,6 @@ $errorLines = New-Object "System.Collections.Generic.List[string]" $errorCodes = New-Object "System.Collections.Generic.List[string]" $errorFormat = '^(.*)\((\d+),(\d+)\): error (.*)' -dotnet build $Solution @buildSwitches 2>&1 | Out-Null -bash -c 'true' dotnet build $Solution @buildSwitches 2>&1 | % { if ($_ -notmatch $errorFormat) { return $_ } From 7aa87ff471bda53c2fe8ee18becc9654f915af5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Thu, 28 Jul 2022 23:45:29 +0200 Subject: [PATCH 18/31] Add LombiqNetAnalyzers target execution. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index e71dd6404..8ae358a5d 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -50,6 +50,11 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj Write-Output "::endgroup::" } +# This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will +# be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target +# will still run on the projects that have it. +dotnet msbuild -target:LombiqNetAnalyzers $Solution | Out-Null; bash -c 'true' + Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``." $errorLines = New-Object "System.Collections.Generic.List[string]" From c30bcc47d70c5c71eb1158e2ab56d8e2cf4770e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Thu, 28 Jul 2022 23:52:35 +0200 Subject: [PATCH 19/31] Don't out-null just yet --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 8ae358a5d..71d6846f9 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -53,7 +53,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will # be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target # will still run on the projects that have it. -dotnet msbuild -target:LombiqNetAnalyzers $Solution | Out-Null; bash -c 'true' +dotnet msbuild -target:LombiqNetAnalyzers $Solution Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``." From 89118d3b8e11af2cc5216f532b349f20cddf64f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 29 Jul 2022 00:25:10 +0200 Subject: [PATCH 20/31] Suppress again. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 71d6846f9..0dbd6d675 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -53,7 +53,8 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will # be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target # will still run on the projects that have it. -dotnet msbuild -target:LombiqNetAnalyzers $Solution +dotnet msbuild -target:LombiqNetAnalyzers $Solution | Out-Null +bash -c 'true' Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``." From 7690a861bf4c5f13cd44b86c4906092554e0279d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 29 Jul 2022 01:02:53 +0200 Subject: [PATCH 21/31] Restore as well. --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 0dbd6d675..66864fd30 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -53,7 +53,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will # be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target # will still run on the projects that have it. -dotnet msbuild -target:LombiqNetAnalyzers $Solution | Out-Null +dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $Solution | Out-Null bash -c 'true' Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``." From ff5b373cb151060b06382c9c1ce8a01ffa078acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Tue, 2 Aug 2022 01:42:37 +0200 Subject: [PATCH 22/31] Rename script as per PSUseSingularNouns. --- .../{New-NugetPackages.ps1 => New-NugetPackage.ps1} | 0 .github/actions/publish-nuget/action.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/publish-nuget/{New-NugetPackages.ps1 => New-NugetPackage.ps1} (100%) diff --git a/.github/actions/publish-nuget/New-NugetPackages.ps1 b/.github/actions/publish-nuget/New-NugetPackage.ps1 similarity index 100% rename from .github/actions/publish-nuget/New-NugetPackages.ps1 rename to .github/actions/publish-nuget/New-NugetPackage.ps1 diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 0f2753045..3e70880ae 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -106,7 +106,7 @@ runs: ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } - New-NugetPackages @( + New-NugetPackage @( "--configuration:Release", "--warnaserror", "--no-restore", From 2f882a1e7565f675262e17d55ff1c7fd1c11f226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Tue, 2 Aug 2022 01:42:50 +0200 Subject: [PATCH 23/31] Code cleanup --- .../build-dotnet/Build-DotNetSolution.ps1 | 7 ++----- .../actions/publish-nuget/New-NugetPackage.ps1 | 16 +++++++++++++++- .github/actions/publish-nuget/action.yml | 5 ++++- .../verify-submodule-pull-request/action.yml | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 66864fd30..0a0501069 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -8,9 +8,7 @@ function ConvertTo-Array([string] $rawInput) { - $rawInput.Replace("`r", "").Split("`n") | - % { $_.Trim() } | - ? { -not [string]::IsNullOrEmpty($_) } + $rawInput.Replace("`r", "").Split("`n") | % { $_.Trim() } | ? { $_ } } Write-Output ".NET version number: $Version" @@ -53,8 +51,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj # This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will # be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target # will still run on the projects that have it. -dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $Solution | Out-Null -bash -c 'true' +dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $Solution | Out-Null || bash -c 'true' Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``." diff --git a/.github/actions/publish-nuget/New-NugetPackage.ps1 b/.github/actions/publish-nuget/New-NugetPackage.ps1 index 5fa3656b5..adfc45c34 100644 --- a/.github/actions/publish-nuget/New-NugetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NugetPackage.ps1 @@ -1,6 +1,20 @@ + +<# +.SYNOPSIS + Creates a NuGet package from each project in the sln file in the current directory. +.DESCRIPTION + Uses "dotnet sln list" to get all projects in the current directory. This means the current directory must have + exactly one sln file in it. Then calls "dotnet pack" for each csproj file with the provided arguments. If there is + a nuspec file in the project's directory too, then it is used to generate the package description instead of the + regular auto-generation. +.EXAMPLE + New-NugetPackage @("--configuration:Release", "--warnaserror") + Calls "dotnet pack project.csproj --configuration:Release --warnaserror" on each project. +#> + param([array] $Arguments) -foreach ($project in (dotnet sln list | Select-Object -Skip 2 | % { Get-ChildItem $_ })) +foreach ($project in (dotnet sln list | Select-Object -Skip 2 | Get-Item)) { Push-Location $project.Directory diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 3e70880ae..70b4311cd 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -95,6 +95,9 @@ runs: - name: Pack shell: pwsh # Notes on the configuration apart from what's also for dotnet build: + # * NoWarn on NU5100 because if the project has no dll of its own (e.g. a package that only has dependencies or + # targets and props) then it will be a false positive. This can't happen with regular packages so the warning + # is overall not worthwhile. # * NoWarn on NU5104 to not have warnings for prerelease dependencies, see: # https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5104. # * -p:WarnOnPackingNonPackableProject=True will cause a build warning (converted to error) if we try to pack @@ -102,7 +105,7 @@ runs: # * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages: # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg. run: | - $noWarn = @('NU5104', 'NU5100') + @' + $noWarn = @('NU5100', 'NU5104') + @' ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } diff --git a/.github/actions/verify-submodule-pull-request/action.yml b/.github/actions/verify-submodule-pull-request/action.yml index 6491ffe4c..6a21fc31e 100644 --- a/.github/actions/verify-submodule-pull-request/action.yml +++ b/.github/actions/verify-submodule-pull-request/action.yml @@ -25,8 +25,8 @@ runs: New-Item -ItemType File -Force $Profile | Out-Null Get-Content -Raw ${{ github.action_path }}/functions.ps1 >> $Profile - # We are using env for the title input in these steps because it realistically could contain - # quotes apostrophes or even both. This way those don't need to be escaped. + # We are using env for the title input in these steps because it realistically could contain quotes apostrophes or + # even both. This way those don't need to be escaped. - name: Ensure Current PR Title Includes Issue Code shell: pwsh env: From 8bae04aaaaa90a7ced7a7aa8d9e0fc47c41b6097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Tue, 2 Aug 2022 11:25:13 +0200 Subject: [PATCH 24/31] dismiss => discard --- .github/actions/build-dotnet/Build-DotNetSolution.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 index 0a0501069..cf6091db1 100644 --- a/.github/actions/build-dotnet/Build-DotNetSolution.ps1 +++ b/.github/actions/build-dotnet/Build-DotNetSolution.ps1 @@ -48,7 +48,7 @@ if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj Write-Output "::endgroup::" } -# This prepares the solution with the Lombiq.Analyzers files. The output and exit code are dismissed because they will +# This prepares the solution with the Lombiq.Analyzers files. The output and exit code are discarded because they will # be in error if there is a project without the LombiqNetAnalyzers target. Then there is nothing to do, and the target # will still run on the projects that have it. dotnet msbuild '-target:Restore;LombiqNetAnalyzers' $Solution | Out-Null || bash -c 'true' From 73d3413ea38774ffe8a62489a68b683eee4d3cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Tue, 2 Aug 2022 11:48:45 +0200 Subject: [PATCH 25/31] Various cleanup. --- .../{New-NugetPackage.ps1 => New-NuGetPackage.ps1} | 1 - .github/actions/publish-nuget/action.yml | 2 +- .github/actions/verify-submodule-pull-request/action.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) rename .github/actions/publish-nuget/{New-NugetPackage.ps1 => New-NuGetPackage.ps1} (99%) diff --git a/.github/actions/publish-nuget/New-NugetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 similarity index 99% rename from .github/actions/publish-nuget/New-NugetPackage.ps1 rename to .github/actions/publish-nuget/New-NuGetPackage.ps1 index adfc45c34..da131f064 100644 --- a/.github/actions/publish-nuget/New-NugetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -1,4 +1,3 @@ - <# .SYNOPSIS Creates a NuGet package from each project in the sln file in the current directory. diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 70b4311cd..4ff011882 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -109,7 +109,7 @@ runs: ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } - New-NugetPackage @( + New-NuGetPackage @( "--configuration:Release", "--warnaserror", "--no-restore", diff --git a/.github/actions/verify-submodule-pull-request/action.yml b/.github/actions/verify-submodule-pull-request/action.yml index 6a21fc31e..9bcd51500 100644 --- a/.github/actions/verify-submodule-pull-request/action.yml +++ b/.github/actions/verify-submodule-pull-request/action.yml @@ -25,7 +25,7 @@ runs: New-Item -ItemType File -Force $Profile | Out-Null Get-Content -Raw ${{ github.action_path }}/functions.ps1 >> $Profile - # We are using env for the title input in these steps because it realistically could contain quotes apostrophes or + # We are using env for the title input in these steps because it realistically could contain quotes, apostrophes or # even both. This way those don't need to be escaped. - name: Ensure Current PR Title Includes Issue Code shell: pwsh From 8775245c66158beadd6760fe1a8f9f01d59ffa2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Tue, 2 Aug 2022 11:59:40 +0200 Subject: [PATCH 26/31] Comment on NuspecFile. --- .github/actions/publish-nuget/New-NuGetPackage.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/publish-nuget/New-NuGetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 index da131f064..3a0589a6d 100644 --- a/.github/actions/publish-nuget/New-NuGetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -13,6 +13,7 @@ param([array] $Arguments) +# We go through the projects individually, because the "-p:NuspecFile=" parameter can't be passed to a solution. foreach ($project in (dotnet sln list | Select-Object -Skip 2 | Get-Item)) { Push-Location $project.Directory From fd47198d6c8fa09d2e0114980a2a0e4d7adf1566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Thu, 4 Aug 2022 01:23:31 +0200 Subject: [PATCH 27/31] Move "We go through the projects individually..." into the `comment-help`. --- .github/actions/publish-nuget/New-NuGetPackage.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/New-NuGetPackage.ps1 b/.github/actions/publish-nuget/New-NuGetPackage.ps1 index 3a0589a6d..5b32c35b9 100644 --- a/.github/actions/publish-nuget/New-NuGetPackage.ps1 +++ b/.github/actions/publish-nuget/New-NuGetPackage.ps1 @@ -6,6 +6,9 @@ exactly one sln file in it. Then calls "dotnet pack" for each csproj file with the provided arguments. If there is a nuspec file in the project's directory too, then it is used to generate the package description instead of the regular auto-generation. +.NOTES + We go through the projects individually in a foreach loop, because the "-p:NuspecFile=" parameter can't be passed + to a solution. .EXAMPLE New-NugetPackage @("--configuration:Release", "--warnaserror") Calls "dotnet pack project.csproj --configuration:Release --warnaserror" on each project. @@ -13,7 +16,6 @@ param([array] $Arguments) -# We go through the projects individually, because the "-p:NuspecFile=" parameter can't be passed to a solution. foreach ($project in (dotnet sln list | Select-Object -Skip 2 | Get-Item)) { Push-Location $project.Directory From 7c91ad89d6eca15bde731766eece6548e2cb6451 Mon Sep 17 00:00:00 2001 From: Oliver Friedrich Date: Thu, 4 Aug 2022 11:17:27 +0200 Subject: [PATCH 28/31] Trying to fix NU5104 --- .github/actions/publish-nuget/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 4ff011882..fd23c22e5 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -105,7 +105,7 @@ runs: # * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages: # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg. run: | - $noWarn = @('NU5100', 'NU5104') + @' + $noWarn = @('NU5100') + @' ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } From e86529e814b7f6a750e8005f51d1ebdd7a8a7a38 Mon Sep 17 00:00:00 2001 From: Oliver Friedrich Date: Thu, 4 Aug 2022 12:32:58 +0200 Subject: [PATCH 29/31] Revert "Trying to fix NU5104" This reverts commit 7c91ad89d6eca15bde731766eece6548e2cb6451. --- .github/actions/publish-nuget/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index fd23c22e5..4ff011882 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -105,7 +105,7 @@ runs: # * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages: # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg. run: | - $noWarn = @('NU5100') + @' + $noWarn = @('NU5100', 'NU5104') + @' ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } From 2cb188ff04b134c8becac59b954e1aa3cef37bf1 Mon Sep 17 00:00:00 2001 From: Oliver Friedrich Date: Thu, 4 Aug 2022 13:31:15 +0200 Subject: [PATCH 30/31] Trying to fix NU5100 and remove it altogether --- .github/actions/publish-nuget/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 4ff011882..40e5e796e 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -95,9 +95,6 @@ runs: - name: Pack shell: pwsh # Notes on the configuration apart from what's also for dotnet build: - # * NoWarn on NU5100 because if the project has no dll of its own (e.g. a package that only has dependencies or - # targets and props) then it will be a false positive. This can't happen with regular packages so the warning - # is overall not worthwhile. # * NoWarn on NU5104 to not have warnings for prerelease dependencies, see: # https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5104. # * -p:WarnOnPackingNonPackableProject=True will cause a build warning (converted to error) if we try to pack @@ -105,7 +102,7 @@ runs: # * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages: # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg. run: | - $noWarn = @('NU5100', 'NU5104') + @' + $noWarn = @('NU5104') + @' ${{ inputs.dotnet-pack-ignore-warning }} '@.Split() | ? { $_ } From c6c0bcd463c2dce264e58448daee40591ae40335 Mon Sep 17 00:00:00 2001 From: Oliver Friedrich Date: Thu, 4 Aug 2022 14:34:22 +0200 Subject: [PATCH 31/31] Add parameter to disable symbol package creation during publish --- .github/actions/publish-nuget/action.yml | 6 +++++- .github/workflows/publish-nuget.yml | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/actions/publish-nuget/action.yml b/.github/actions/publish-nuget/action.yml index 40e5e796e..cd5a5e266 100644 --- a/.github/actions/publish-nuget/action.yml +++ b/.github/actions/publish-nuget/action.yml @@ -16,6 +16,10 @@ inputs: description: > Additional warning codes for the `-p:NoWarn=` argument of `dotnet pack`. The items can be separated by any whitespace, including newlines. + dotnet-pack-include-symbols: + required: false + default: "true" + description: If set to "true", a symbol package will be created together with the NuGet package. secrets: API_KEY: required: true @@ -120,7 +124,7 @@ runs: "-p:NoWarn=$($noWarn -join '%3B')", "-p:TreatWarningsAsErrors=true", "-p:WarnOnPackingNonPackableProject=True", - "-p:IncludeSymbols=true", + "-p:IncludeSymbols=${{ inputs.dotnet-pack-include-symbols }}", "-p:SymbolPackageFormat=snupkg", "-p:NoDefaultExcludes=true" ) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 6796dc487..7e0ef4f7e 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -30,6 +30,11 @@ on: description: > Additional warning codes for the `-p:NoWarn=` argument of `dotnet pack`. The items can be separated by any whitespace, including newlines. + dotnet-pack-include-symbols: + required: false + type: string + default: "true" + description: If set to "true", a symbol package will be created together with the NuGet package. secrets: # We can't access org secrets here so they need to be passed in, see: # https://github.community/t/resuable-called-workflow-environment-variables-secrets-and-trigger-event-access/207723/2 @@ -61,5 +66,6 @@ jobs: source: ${{ inputs.source }} verbosity: ${{ inputs.verbosity }} dotnet-pack-ignore-warning: ${{ inputs.dotnet-pack-ignore-warning }} + dotnet-pack-include-symbols: ${{ inputs.dotnet-pack-include-symbols }} env: API_KEY: ${{ secrets.API_KEY }}