From 53b0aee7d112f0d6f5b0359bea9fb8e82eb469fd Mon Sep 17 00:00:00 2001 From: Laurents Meyer Date: Fri, 27 Oct 2023 05:50:17 +0200 Subject: [PATCH] Publish test results as GitHub Checks. (#168) --- .github/workflows/pull_request.yml | 27 ++++++++++++++++----------- .github/workflows/push.yml | 27 ++++++++++++++++----------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7ec9833..09fb997 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,7 +14,7 @@ env: skipTests: false deterministicTests: true autoCommitGreenTests: true - uploadTestResults: false + uploadTestResults: true jobs: Preconditions: runs-on: ubuntu-latest @@ -213,33 +213,38 @@ jobs: run: | & '${{ env.dotnetExecutable }}' build --configuration '${{ env.buildConfiguration }}' - name: 'Run Tests: EFCore.Jet.Data.Tests' - if: env.skipTests != 'true' + if: always() && env.skipTests != 'true' shell: pwsh run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Data.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m + - name: 'Run Tests: EFCore.Jet.Tests' + if: always() && env.skipTests != 'true' + shell: pwsh + run: | + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m - name: 'Run Tests: EFCore.Jet.FunctionalTests' - if: env.skipTests != 'true' + if: always() && env.skipTests != 'true' shell: pwsh run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m exit 0 - - name: 'Run Tests: EFCore.Jet.Tests' - if: env.skipTests != 'true' + - name: 'Rename Test Results' + if: always() && env.skipTests != 'true' shell: pwsh run: | - $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m + Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' - if: env.skipTests != 'true' && env.uploadTestResults == 'true' + if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' uses: actions/upload-artifact@v3 with: name: test-results path: | - test\EFCore.Jet.Data.Tests\TestResults - test\EFCore.Jet.FunctionalTests\TestResults - test\EFCore.Jet.Tests\TestResults + test\EFCore.Jet.Data.Tests\TestResults\*.trx + test\EFCore.Jet.FunctionalTests\TestResults\*.trx + test\EFCore.Jet.Tests\TestResults\*.trx - name: 'Check Tests: EFCore.Jet.FunctionalTests' if: env.skipTests != 'true' shell: pwsh diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b178930..f8e0f0c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -13,7 +13,7 @@ env: buildConfiguration: 'Debug' skipTests: false deterministicTests: true - uploadTestResults: false + uploadTestResults: true jobs: Preconditions: runs-on: ubuntu-latest @@ -212,33 +212,38 @@ jobs: run: | & '${{ env.dotnetExecutable }}' build --configuration '${{ env.buildConfiguration }}' - name: 'Run Tests: EFCore.Jet.Data.Tests' - if: env.skipTests != 'true' + if: always() && env.skipTests != 'true' shell: pwsh run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Data.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m + - name: 'Run Tests: EFCore.Jet.Tests' + if: always() && env.skipTests != 'true' + shell: pwsh + run: | + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m - name: 'Run Tests: EFCore.Jet.FunctionalTests' - if: env.skipTests != 'true' + if: always() && env.skipTests != 'true' shell: pwsh run: | $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m exit 0 - - name: 'Run Tests: EFCore.Jet.Tests' - if: env.skipTests != 'true' + - name: 'Rename Test Results' + if: always() && env.skipTests != 'true' shell: pwsh run: | - $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.Tests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m + Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' - if: env.skipTests != 'true' && env.uploadTestResults == 'true' + if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' uses: actions/upload-artifact@v3 with: name: test-results path: | - test\EFCore.Jet.Data.Tests\TestResults - test\EFCore.Jet.FunctionalTests\TestResults - test\EFCore.Jet.Tests\TestResults + test\EFCore.Jet.Data.Tests\TestResults\*.trx + test\EFCore.Jet.FunctionalTests\TestResults\*.trx + test\EFCore.Jet.Tests\TestResults\*.trx - name: 'Check Tests: EFCore.Jet.FunctionalTests' if: env.skipTests != 'true' shell: pwsh