From 98934038fa778b5ec53b6f6587f2baa9cb13aacc Mon Sep 17 00:00:00 2001 From: Jezz Santos Date: Fri, 21 Feb 2025 19:25:21 +1300 Subject: [PATCH] Fixed build script to fail on process fail, and split Website tess from API tests. --- .github/workflows/build.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 473a11b9..be5d6a5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,11 @@ env: DOTNET_VERSION: 8.0.302 NODEJS_VERSION: '22' +# We want failed commands to fail the pipeline on Windows +defaults: + run: + shell: bash + jobs: build: runs-on: windows-latest @@ -32,13 +37,13 @@ jobs: - name: Restore dependencies run: dotnet restore "${{env.SOLUTION_PATH}}" - name: Build (Backend) for Azure Testing - run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=HOSTEDONAZURE + run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAZURE - name: Build (Backend) for AWS Testing - run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=HOSTEDONAWS + run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAWS - name: Build (Backend) for Azure Deploy - run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=HOSTEDONAZURE + run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAZURE - name: Build (Backend) for AWS Deploy - run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=HOSTEDONAWS + run: dotnet build --configuration ${{env.DEPLOY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAWS - name: Build WebsiteHost (FrontEnd) for Deploy run: | cd src/WebsiteHost/ClientApp @@ -65,7 +70,7 @@ jobs: - name: Restore dependencies run: dotnet restore "${{env.SOLUTION_PATH}}" - name: Build for CI Testing (for Azure) - run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" /p:HostingPlatform=HOSTEDONAZURE + run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAZURE - name: Unit Test (Backend) continue-on-error: false run: > @@ -75,12 +80,21 @@ jobs: --logger:"trx" --logger:"junit;LogFileName={assembly}.junit.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --test-adapter-path:. "${{env.SOLUTION_PATH}}" - - name: Integration Test (Backend) - continue-on-error: true + - name: Integration Test (Backend API) + continue-on-error: false + run: > + dotnet test --no-build --verbosity normal + --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} + --filter:"Category=Integration.API" --collect:"XPlat Code Coverage" --results-directory:"src/TestResults/csharp" + --logger:"trx" + --logger:"junit;LogFileName={assembly}.junit.xml;MethodFormat=Class;FailureBodyFormat=Verbose" + --test-adapter-path:. "${{env.SOLUTION_PATH}}" + - name: Integration Test (Backend Website) + continue-on-error: true # These tests can be flaky sometimes run: > dotnet test --no-build --verbosity normal --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} - --filter:"Category=Integration.API|Category=Integration.Website" --collect:"XPlat Code Coverage" --results-directory:"src/TestResults/csharp" + --filter:"Category=Category=Integration.Website" --collect:"XPlat Code Coverage" --results-directory:"src/TestResults/csharp" --logger:"trx" --logger:"junit;LogFileName={assembly}.junit.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --test-adapter-path:. "${{env.SOLUTION_PATH}}"