From 148788788533e25a761389d71b9eabcb96e85d73 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Mon, 14 Aug 2023 18:06:29 +0100 Subject: [PATCH] Fix failure to report errors in GitHub Actions PowerShell --- .github/workflows/CI.yml | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4e327d46a..4c3873b29 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -117,34 +117,47 @@ jobs: - name: Unit tests (Windows) run: | - $passed = $true + $AggregateExitCode = 0 npm run test-unit-edge - if ($LASTEXITCODE > 0) { $passed = $false } + $AggregateExitCode += $LastExitCode npm run test-unit-firefox - if ($LASTEXITCODE > 0) { $passed = $false } - if (!$passed) { exit 1 } + $AggregateExitCode += $LastExitCode + if ($AggregateExitCode -ne 0) { + echo " " + Write-Error "Number of failed tests: $AggregateExitCode" + } + exit $AggregateExitCode - name: End-to-end tests (Windows) env: GITHUB_ACTION: ${{ github.event_name }} run: | - $passed = $true + $AggregateExitCode = 0 Write-Verbose "Building the app..." -Verbose npm run build-min - if ($LASTEXITCODE > 0) { $passed = $false } + $AggregateExitCode += $LastExitCode + echo " " + Write-Verbose "Starting server..." -Verbose + npx http-server -p 8080 . & echo " " Write-Verbose "Testing on Edge Chromium..." -Verbose - npm run test-e2e-edge - if ($LASTEXITCODE > 0) { $passed = $false } + npx mocha ./tests/microsoftEdge.e2e.runner.js + $AggregateExitCode += $LastExitCode echo " " Write-Verbose "Testing on Firefox..." -Verbose - npm run test-e2e-firefox - if ($LASTEXITCODE > 0) { $passed = $false } + npx mocha ./tests/firefox.e2e.runner.js + $AggregateExitCode += $LastExitCode echo " " Write-Verbose "Testing on IE11..." -Verbose - npm run test-e2e-iemode - if ($LASTEXITCODE > 0) { $passed = $false } - if (!$passed) { exit 1 } + npx mocha ./tests/ieMode.e2e.runner.js + $AggregateExitCode += $LastExitCode + echo " " + if ($AggregateExitCode -gt 0) { + Write-Error "Total number of failed tests: $AggregateExitCode" + } else { + Write-Host "All e2e tests on Windows passed!" + } + exit $AggregateExitCode # tests-unit-mac: # if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository