Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into issue/VSIX-54
Browse files Browse the repository at this point in the history
  • Loading branch information
Piedone committed Nov 16, 2022
2 parents 6754c9d + f9d9963 commit a2167a6
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ param (

function ConvertTo-Array([string] $rawInput)
{
$rawInput.Replace("`r", "").Split("`n") | % { $_.Trim() } | ? { $_ }
$rawInput.Replace("`r", "").Split("`n") | ForEach-Object { $_.Trim() } | Where-Object { $_ }
}

Write-Output ".NET version number: $Version"
Expand All @@ -33,7 +33,7 @@ $buildSwitches = ConvertTo-Array @"
$Switches
"@

[array] $expectedErrorCodes = ConvertTo-Array $ExpectedCodeAnalysisErrors | % { $_.Split(':')[0] } | Sort-Object
[array] $expectedErrorCodes = ConvertTo-Array $ExpectedCodeAnalysisErrors | ForEach-Object { $_.Split(':')[0] } | Sort-Object
$noErrors = $expectedErrorCodes.Count -eq 0

if (Test-Path src/Utilities/Lombiq.Gulp.Extensions/Lombiq.Gulp.Extensions.csproj)
Expand All @@ -59,7 +59,7 @@ $errorLines = New-Object "System.Collections.Generic.List[string]"
$errorCodes = New-Object "System.Collections.Generic.List[string]"

$errorFormat = '^(.*)\((\d+),(\d+)\): error (.*)'
dotnet build $SolutionOrProject @buildSwitches 2>&1 | % {
dotnet build $SolutionOrProject @buildSwitches 2>&1 | ForEach-Object {
if ($_ -notmatch $errorFormat) { return $_ }

($null, $file, $line, $column, $message) = [regex]::Match($_, $errorFormat, 'Compiled').Groups.Value
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/build-dotnet/Write-CacheConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ if ($IsNuget) { $paths += ,'~/.nuget/packages' }
if ($IsNpm)
{
(Invoke-Maybe { pnpm store path }), (npm config get cache) |
? { -not [string]::IsNullOrEmpty($_) } |
% { $paths += $_ }
Where-Object { -not [string]::IsNullOrEmpty($_) } |
ForEach-Object { $paths += $_ }
}

# Ensure the paths exist.
$paths | % { New-Item -ItemType Directory -Force $_ } | Out-Null
$paths | ForEach-Object { New-Item -ItemType Directory -Force $_ } | Out-Null

# Multiple paths must be separated by "\n", but we can't include newline in the workflow command so we have to misuse
# the format function like this.
Expand Down
9 changes: 8 additions & 1 deletion .github/actions/cancel-workflow/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Cancel Workflow
description: >
Cancels the current workflow run, i.e. all jobs. Useful if you want to cancel the rest of the workflow when one job
fails.
fails. Note that this will cause the workflow to appear cancelled, not failed.
# Cancelling the workflow in a post-script (like this:
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost; can also be done with
# this action: https://github.com/webiny/action-post-run, see Git history of this file) wouldn't help the status, it
# would still be cancelled. It actually indeed is, but it would be nicer to set it to failed, but there seems to be no
# way to do this.

runs:
using: "composite"
Expand All @@ -11,6 +17,7 @@ runs:
if: github.event.pull_request == '' || github.event.pull_request.head.repo.fork == false
shell: pwsh
run: |
Write-Output "::error::Canceling workflow due to one of the jobs failing."
$url = "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel"
$headers = @{"Authorization" = "Bearer ${{ env.GITHUB_TOKEN }}"; "Accept" = "application/vnd.github+json"}
Invoke-WebRequest $url -Headers $headers -Method Post
11 changes: 0 additions & 11 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ ISetup
IShell
IShortcuts
ISmtp
ISmtp
ISql
ISql
IStore
ISystem
Expand Down Expand Up @@ -82,7 +80,6 @@ helppopulartopics
hostnames
inheritdoc
isignal
isignal
issetuprecipe
itest
johndoe
Expand Down Expand Up @@ -131,7 +128,6 @@ websites
whitelisted
would've
ASPNETCORE
ASPNETCORE
Activatable
Antiforgery
Autherization
Expand All @@ -157,12 +153,10 @@ IAuthorization
IBab
IBackground
ICaching
ICaching
ICant
IChange
IClass
IClock
IClock
ICollection
IColumn
ICompare
Expand Down Expand Up @@ -249,8 +243,6 @@ ISearch
ISecurity
ISerializable
IService
IService
ISession
ISession
ISet
IShape
Expand All @@ -260,12 +252,10 @@ IString
ITaxonomy
ITenant
ITest
ITest
ITested
ITracking
IUser
IWeb
IWeb
Intelli
IntelliSense
Interop
Expand All @@ -284,7 +274,6 @@ Rowling
Schoorstra
Serializer
Shouldly
Shouldly
Sipke
TClass
TGenerator
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Argb
Chro
Cloudflare
Cms
Cms
CDNs
EACCES
EULA
Expand Down Expand Up @@ -100,6 +99,7 @@ postclean
pragma
prebuild
preheader
publishsettings
pwsh
readdir
search'f
Expand Down Expand Up @@ -131,7 +131,6 @@ yaml
yml
Aig
Airi
Airi
BJRQ
BOHq
Bcc
Expand Down
28 changes: 18 additions & 10 deletions .github/actions/test-dotnet/Invoke-SolutionTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,47 @@ $tests = dotnet sln list |
Select-String "\.Tests\." |
Select-String -NotMatch "Lombiq.Tests.UI.csproj" |
Select-String -NotMatch "Lombiq.Tests.csproj" |
? {
Where-Object {
$result = dotnet test --no-restore --list-tests --verbosity $Verbosity $_ 2>&1 | Out-String -Width 9999
-not [string]::IsNullOrEmpty($result) -and $result.Contains("The following Tests are available")
}

Write-Output "Starting to execute tests from $($tests.Length) projects."

foreach ($test in $tests) {
# This could benefit from grouping, above the level of the potential groups created by the tests (the Lombiq UI
# Testing Toolbox adds per-test groups too). However, there's no nested grouping, see
# https://github.com/actions/runner/issues/1477. See the # c341ef145d2a0898c5900f64604b67b21d2ea5db commit for a
# nested grouping implementation.

Write-Output "Starting to execute tests from the $test project."

$dotnetTestSwitches = @(
'--configuration', 'Release'
'--no-restore',
'--no-build',
'--nologo',
'--logger', 'trx;LogFileName=test-results.trx'
# This is for xUnit ITestOutputHelper, see https://xunit.net/docs/capturing-output.
'--logger', 'console;verbosity=detailed'
'--verbosity', $Verbosity
$Filter ? '--filter' : ''
$Filter ? $Filter : ''
$test
)

dotnet test @dotnetTestSwitches 2>&1 >test.out
# Filtering is necessary for annoying messages coming from UI testing but only under Ubuntu. There are no actual
# errors.
dotnet test @dotnetTestSwitches 2>&1 |
Where-Object { $_ -notlike '*Connection refused [[]::ffff:127.0.0.1[]]*' -and $_ -notlike '*ChromeDriver was started successfully*' }

if ($?)
{
Write-Output "Test Successful: $test"
Write-Output "Test successful: $test"
continue
}

$needsGrouping = (Select-String "::group::" test.out).Length -eq 0

if ($needsGrouping) { Write-Output "::group::Test Failed: $test" }

bash -c "cat test.out | grep -v 'Connection refused \[::ffff:127.0.0.1\]' | grep -v 'ChromeDriver was started successfully'"

if ($needsGrouping) { Write-Output "::endgroup::" }
Write-Output "Test failed: $test"

exit 100
}
6 changes: 3 additions & 3 deletions .github/actions/test-dotnet/Merge-FailureDumps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ $testDirectory = "$Directory/test"
$rootDirectory = (Test-Path -Path $testDirectory) ? $testDirectory : $Directory

Get-ChildItem $rootDirectory -Recurse |
? { $_.Name -eq 'FailureDumps' } |
% { $_.GetDirectories() } |
% { Move-Item $_.FullName "$Directory/FailureDumps/${_.Name}" }
Where-Object { $_.Name -eq 'FailureDumps' } |
ForEach-Object { $_.GetDirectories() } |
ForEach-Object { Move-Item $_.FullName "$Directory/FailureDumps/${_.Name}" }
4 changes: 1 addition & 3 deletions .github/actions/test-dotnet/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ runs:
if: success() || failure()
with:
name: ui-test-failure-dump-${{ steps.setup.outputs.friendly-build-directory-name }}-${{ steps.setup.outputs.runner-suffix }}
path: |
${{ inputs.build-directory }}/FailureDumps/
test.out
path: ${{ inputs.build-directory }}/FailureDumps/
if-no-files-found: ignore

- name: Test Report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ param(
)

$url = "https://api.github.com/repos/$Repository/pulls?state=open&per_page=100"
$titles = curl -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | % { $_.title }
$titles = curl -s -H 'Accept: application/vnd.github.v3+json' $url | ConvertFrom-Json | ForEach-Object { $_.title }

$issueCode = $Title -replace '^\s*(\w+-\d+)\s*:.*$', '$1'
$lookFor = "${issueCode}:"
Expand Down

0 comments on commit a2167a6

Please sign in to comment.