diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build-and-test.yml similarity index 55% rename from .github/workflows/dotnet.yml rename to .github/workflows/build-and-test.yml index 09becf2e..eafaa0a8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build-and-test.yml @@ -1,7 +1,4 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: .NET +name: Build and test on: push: @@ -12,11 +9,10 @@ on: jobs: build: name: "Build" - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache uses: actions/cache@v3 @@ -36,12 +32,26 @@ jobs: run: dotnet build --no-restore --configuration Release - name: Test - run: dotnet test --no-build --no-restore --configuration Release --logger "trx;LogFileName=TestResults.trx" + run: dotnet test --no-build --no-restore --configuration Release --logger "junit;LogFilePath=results/tests.xml" - # as per https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories - - name: Test Report + - name: Publish + run: dotnet publish src/WebApi/WebApi.csproj --no-build --no-restore --configuration Release --output ./publish + + - name: Upload Artifact uses: actions/upload-artifact@v3 - if: success() || failure() # run this step even if previous step failed with: - name: test-results - path: "**/*.trx" + name: published-files + path: ./publish + + - name: Test Report + uses: test-summary/action@v2 + if: success() || failure() + with: + paths: results/**/*.xml + output: test-summary.md + - name: Output job summary + if: success() || failure() + run: | + cat test-summary.md >> $GITHUB_STEP_SUMMARY + + \ No newline at end of file diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml deleted file mode 100644 index 905ea1d8..00000000 --- a/.github/workflows/test-report.yml +++ /dev/null @@ -1,24 +0,0 @@ -# as per https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories -name: 'Test Report' - -on: - workflow_run: - workflows: ['.NET'] # runs after .NET workflow - types: - - completed - -permissions: - contents: read - actions: read - checks: write - -jobs: - report: - runs-on: ubuntu-latest - steps: - - uses: dorny/test-reporter@v1 - with: - artifact: test-results # artifact name - name: Tests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results \ No newline at end of file diff --git a/tests/Architecture.Tests/Architecture.Tests.csproj b/tests/Architecture.Tests/Architecture.Tests.csproj index d14de8b3..8ffdeaa7 100644 --- a/tests/Architecture.Tests/Architecture.Tests.csproj +++ b/tests/Architecture.Tests/Architecture.Tests.csproj @@ -14,6 +14,7 @@ all + diff --git a/tests/Directory.Packages.props b/tests/Directory.Packages.props index ac1f1b08..b495f97e 100644 --- a/tests/Directory.Packages.props +++ b/tests/Directory.Packages.props @@ -1,23 +1,22 @@ - - - true - - - - - - - - - - - - - - - - - - - + + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/Domain.UnitTests/Domain.UnitTests.csproj b/tests/Domain.UnitTests/Domain.UnitTests.csproj index 1fdcb853..1e4dfaa8 100644 --- a/tests/Domain.UnitTests/Domain.UnitTests.csproj +++ b/tests/Domain.UnitTests/Domain.UnitTests.csproj @@ -14,6 +14,7 @@ all + diff --git a/tests/Domain.UnitTests/TodoItems/TodoItemTests.cs b/tests/Domain.UnitTests/TodoItems/TodoItemTests.cs index 5a884341..b354b362 100644 --- a/tests/Domain.UnitTests/TodoItems/TodoItemTests.cs +++ b/tests/Domain.UnitTests/TodoItems/TodoItemTests.cs @@ -4,6 +4,12 @@ namespace SSW.CleanArchitecture.Domain.UnitTests.TodoItems; public class TodoItemTests { + [Fact] + public void AlwaysFail() + { + true.Should().BeFalse(); + } + [Fact] public void Create_Should_Succeed_When_Title_Valid() { diff --git a/tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csproj b/tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csproj index 346b3dd0..df6c4c83 100644 --- a/tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csproj +++ b/tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csproj @@ -10,20 +10,21 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - - - - + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -32,7 +33,7 @@ - +