Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-110: Fix verify action that fails if the PR title has apostrophe in it #21

Merged
merged 38 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0eabe53
Make the title a step environment variable, so it doesn't need to be …
sarahelsaig Jun 30, 2022
8e2c989
Call Update-ManifestVersion
sarahelsaig Jun 30, 2022
58fa418
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 2, 2022
9e6896f
Optional nuspec generation via pwsh script.
sarahelsaig Jul 2, 2022
9aedbb3
Rewrite to pack each of the solution's projects separately.
sarahelsaig Jul 2, 2022
a825d3a
Some random code cleanup.
sarahelsaig Jul 2, 2022
78e31cd
Refactor pack logic into script.
sarahelsaig Jul 2, 2022
ea6ecac
Revert "Some random code cleanup."
sarahelsaig Jul 2, 2022
abdc4cf
Update target branch.
sarahelsaig Jul 2, 2022
33db42d
Fix typo.
sarahelsaig Jul 2, 2022
d5179f8
Fix NuspecProperties
sarahelsaig Jul 2, 2022
afa9f86
Add before pack hook.
sarahelsaig Jul 2, 2022
4f62c5c
Fix "No newline at end of file".
sarahelsaig Jul 2, 2022
e3ff0b8
Whitelist NU5100.
sarahelsaig Jul 3, 2022
3c85210
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 10, 2022
254c588
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 12, 2022
9da1790
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 15, 2022
8d898c0
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 24, 2022
5801fad
Handle special case when no errors were displayed at all.
sarahelsaig Jul 24, 2022
352ac78
Test double building, just as a sanity check.
sarahelsaig Jul 24, 2022
560dff1
Select correct branch from workflow
sarahelsaig Jul 24, 2022
65f76ab
Revert "Test double building, just as a sanity check."
sarahelsaig Jul 24, 2022
d86196a
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Jul 28, 2022
7aa87ff
Add LombiqNetAnalyzers target execution.
sarahelsaig Jul 28, 2022
c30bcc4
Don't out-null just yet
sarahelsaig Jul 28, 2022
89118d3
Suppress again.
sarahelsaig Jul 28, 2022
7690a86
Restore as well.
sarahelsaig Jul 28, 2022
173e727
Merge remote-tracking branch 'origin/dev' into issue/OSOE-110
sarahelsaig Aug 1, 2022
ff5b373
Rename script as per PSUseSingularNouns.
sarahelsaig Aug 1, 2022
2f882a1
Code cleanup
sarahelsaig Aug 1, 2022
8bae04a
dismiss => discard
sarahelsaig Aug 2, 2022
73d3413
Various cleanup.
sarahelsaig Aug 2, 2022
8775245
Comment on NuspecFile.
sarahelsaig Aug 2, 2022
fd47198
Move "We go through the projects individually..." into the `comment-h…
sarahelsaig Aug 3, 2022
7c91ad8
Trying to fix NU5104
Aug 4, 2022
e86529e
Revert "Trying to fix NU5104"
Aug 4, 2022
2cb188f
Trying to fix NU5100 and remove it altogether
Aug 4, 2022
c6c0bcd
Add parameter to disable symbol package creation during publish
Aug 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/actions/build-dotnet/Build-DotNetSolution.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ 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:Restore;LombiqNetAnalyzers' $Solution | Out-Null
bash -c 'true'
0liver marked this conversation as resolved.
Show resolved Hide resolved

Write-Output "Building solution with ``dotnet build $Solution $($buildSwitches -join " ")``."

$errorLines = New-Object "System.Collections.Generic.List[string]"
Expand All @@ -72,6 +78,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))
{
Expand Down
18 changes: 18 additions & 0 deletions .github/actions/publish-nuget/New-NugetPackages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
param([array] $Arguments)
0liver marked this conversation as resolved.
Show resolved Hide resolved

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
}
18 changes: 14 additions & 4 deletions .github/actions/publish-nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ runs:
shell: pwsh
run: dotnet restore -p:NuGetBuild=true --verbosity ${{ inputs.verbosity }}

- name: Generate nuspec file if needed
if: hashFiles('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:
Expand Down Expand Up @@ -82,6 +87,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:
Expand All @@ -92,19 +102,20 @@ 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') + @'
$noWarn = @('NU5104', 'NU5100') + @'
0liver marked this conversation as resolved.
Show resolved Hide resolved
0liver marked this conversation as resolved.
Show resolved Hide resolved
${{ inputs.dotnet-pack-ignore-warning }}
'@.Split() | ? { $_ }
0liver marked this conversation as resolved.
Show resolved Hide resolved

$arguments = @(
New-NugetPackages @(
0liver marked this conversation as resolved.
Show resolved Hide resolved
"--configuration:Release",
"--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 }}",
"-p:NuspecProperties=version=${{ steps.setup.outputs.publish-version }}",
"-p:GenerateDocumentationFile=True",
"-p:NoWarn=$($noWarn -join '%3B')",
0liver marked this conversation as resolved.
Show resolved Hide resolved
"-p:TreatWarningsAsErrors=true",
Expand All @@ -113,7 +124,6 @@ runs:
"-p:SymbolPackageFormat=snupkg",
"-p:NoDefaultExcludes=true"
)
dotnet pack @arguments

- name: Push with dotnet
shell: pwsh
Expand Down
10 changes: 8 additions & 2 deletions .github/actions/verify-submodule-pull-request/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
0liver marked this conversation as resolved.
Show resolved Hide resolved
- 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
2 changes: 1 addition & 1 deletion .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-analysis-failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
0liver marked this conversation as resolved.
Show resolved Hide resolved
with:
directory: ${{ inputs.build-directory }}
verbosity: quiet
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-submodule-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}