name: Unit tests on: workflow_dispatch: pull_request: branches: - main - 'release/**' push: branches: - main - 'release/**' permissions: contents: read # Supersede in-flight runs of this workflow for the same pull request. Pushes to main and # release branches are excluded so every commit there still gets a full, recorded result. concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: test: name: ${{ matrix.display_name }} runs-on: windows-2025 timeout-minutes: 120 strategy: fail-fast: false matrix: include: - name: backend-bl display_name: Backend BL tests project: .\tests\backend\Centron.Tests.BL\Centron.Tests.BL.csproj results_directory: artifacts/tests/backend/bl - name: backend-dao display_name: Backend DAO tests project: .\tests\backend\Centron.Tests.DAO\Centron.Tests.DAO.csproj results_directory: artifacts/tests/backend/dao - name: shared-core display_name: Shared Core tests project: .\tests\shared\Centron.Tests.Core\Centron.Tests.Core.csproj results_directory: artifacts/tests/shared/core - name: nexus display_name: Nexus tests project: .\tests\CentronNexusTests\CentronNexusTests.csproj results_directory: artifacts/tests/nexus env: DOTNET_NOLOGO: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true CENTRON_BUILD_IS_DEV_BUILD: true DevExpress_License: ${{ secrets.DEVEXPRESS_LICENSE }} steps: - name: Check out repository uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up .NET SDK uses: actions/setup-dotnet@v5 with: dotnet-version: 10.0.x - name: Verify .NET SDK shell: pwsh run: | $sdkVersion = dotnet --version if ($LASTEXITCODE -ne 0 -or $sdkVersion -notmatch '^10\.0\.') { throw "Expected a .NET 10 SDK, but resolved '$sdkVersion'." } Write-Host "Resolved .NET SDK: $sdkVersion" - name: Set build version shell: pwsh run: | dotnet run ` --project ".\scripts\Centron.Scripts\Centron.Scripts.csproj" ` -- setup-versioning - name: Run tests shell: pwsh run: | dotnet test "${{ matrix.project }}" ` --configuration Release ` --framework net10.0 ` --logger "trx;LogFileName=TestResults.trx" ` --results-directory "${{ matrix.results_directory }}" ` -nodeReuse:false - name: Upload test results if: always() uses: actions/upload-artifact@v7 with: name: test-results-${{ matrix.name }} path: ${{ matrix.results_directory }}/TestResults.trx if-no-files-found: warn retention-days: 14