Restructured web testing projects #393
This file contains 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.sln' | |
TESTINGONLY_BUILD_CONFIGURATION: 'Release' | |
DEPLOY_BUILD_CONFIGURATION: 'ReleaseForDeploy' | |
DOTNET_VERSION: 8.0.302 | |
jobs: | |
build: | |
runs-on: windows-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- 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 | |
- 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 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: Build WebsiteHost (FrontEnd) | |
run: | | |
cd src/WebsiteHost/ClientApp | |
cp .env.example .env | |
npm ci --cache .npm --prefer-offline | |
npm run build:releasefordeploy | |
test: | |
runs-on: windows-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- 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 | |
- name: Unit Test (Backend) | |
continue-on-error: false | |
run: > | |
dotnet test --no-build --verbosity normal | |
--configuration ${{env.TESTINGONLY_BUILD_CONFIGURATION}} | |
--filter:"Category=Unit|Category=Unit.Tooling|Category=Unit.Architecture" --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) | |
continue-on-error: true | |
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" | |
--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/WebsiteHost/ClientApp | |
cp .env.example .env | |
npm ci --cache .npm --prefer-offline | |
npm run build:releasefordeploy | |
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' |