Branded LoopCar #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: [ push, pull_request ] | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: write | |
| env: | |
| IS_CI_BUILD: 'true' | |
| SOLUTION_PATH: 'src/SaaStack-evaluate.sln' | |
| TESTINGONLY_BUILD_CONFIGURATION: 'Release' | |
| DEPLOY_BUILD_CONFIGURATION: 'ReleaseForDeploy' | |
| DOTNET_VERSION: 8.0.413 | |
| NODEJS_VERSION: '22' | |
| # We want failed commands to fail the pipeline on Windows | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - name: Enable long paths | |
| run: git config --system core.longpaths true | |
| - uses: actions/checkout@v3 | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: ${{env.DOTNET_VERSION}} | |
| - name: Install NodeJs | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{env.NODEJS_VERSION}} | |
| - name: Build (Backend) for AWS Testing | |
| run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAWS | |
| - name: Build (Backend) for Azure Testing | |
| run: dotnet build --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} "${{env.SOLUTION_PATH}}" -p:HostingPlatform=HOSTEDONAZURE | |
| - name: Build (Backend) for Azure Deploy | |
| 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 | |
| - name: Unit Test (Backend) | |
| uses: nick-fields/retry@v2 | |
| with: | |
| max_attempts: 3 | |
| timeout_minutes: 30 | |
| retry_on: error | |
| command: > | |
| dotnet test --no-build --verbosity normal | |
| --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} | |
| --filter:"Category=Unit|Category=Unit.Tooling" --collect:"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 API) | |
| uses: nick-fields/retry@v2 | |
| with: | |
| max_attempts: 3 | |
| timeout_minutes: 30 | |
| retry_on: error | |
| command: > | |
| 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) | |
| uses: nick-fields/retry@v2 | |
| with: | |
| max_attempts: 3 | |
| timeout_minutes: 30 | |
| retry_on: error | |
| command: > | |
| dotnet test --no-build --verbosity normal | |
| --configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} | |
| --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}}" | |
| - name: Test WebsiteHost (FrontEnd) | |
| continue-on-error: false | |
| run: | | |
| cd src/Hosts/WebsiteHost/ClientApp | |
| npm ci --cache .npm --prefer-offline | |
| npm run build:releasefordeploy | |
| npm run build-storybook | |
| npm run test:ci | |
| - name: Testing Report | |
| uses: dorny/[email protected] | |
| if: success() || failure() | |
| with: | |
| name: All Tests | |
| path: 'src/TestResults/csharp/**/*.trx' | |
| reporter: dotnet-trx | |
| fail-on-error: 'false' |