From e9aee85861bd78368202b8e01e85c4c2e3c20e06 Mon Sep 17 00:00:00 2001 From: Alex Hyett Date: Mon, 10 Jul 2023 12:12:15 +0100 Subject: [PATCH] Try copy files --- .github/workflows/build-and-test.yml | 8 ++++++-- .../GitHubActionsDemo.Api.Integration.Tests.csproj | 2 +- .../IntegrationTests.cs | 2 +- .../AuthorsControllerTests.cs | 1 + .../GitHubActionsDemo.Api.Unit.Tests.csproj | 2 +- .../GitHubActionsDemo.Service.Unit.Tests.csproj | 2 +- .../LibraryServiceTests.cs | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index d675122..455c8d3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -17,14 +17,18 @@ jobs: - name: Build run: dotnet build - name: Run Unit Tests - run: dotnet test --filter Unit --no-restore --verbosity normal + run: dotnet test --filter Category=Unit --no-restore --verbosity normal + - uses: canastro/copy-file-action@master + with: + source: "test/**/TestResults/*UnitTests.trx" + target: "TestResults" - name: Start containers run: docker-compose -f "docker-compose.yml" up -d --build - name: Wait for docker containers to setup run: sleep 30s shell: bash - name: Run Integration Tests - run: dotnet test --filter Integration --no-restore --verbosity normal + run: dotnet test --filter Category=Integration --no-restore --verbosity normal - name: Test Report uses: dorny/test-reporter@v1 if: success() || failure() diff --git a/test/GitHubActionsDemo.Api.Integration.Tests/GitHubActionsDemo.Api.Integration.Tests.csproj b/test/GitHubActionsDemo.Api.Integration.Tests/GitHubActionsDemo.Api.Integration.Tests.csproj index 2ed849a..da0bf24 100644 --- a/test/GitHubActionsDemo.Api.Integration.Tests/GitHubActionsDemo.Api.Integration.Tests.csproj +++ b/test/GitHubActionsDemo.Api.Integration.Tests/GitHubActionsDemo.Api.Integration.Tests.csproj @@ -29,7 +29,7 @@ trx%3bLogFileName=$(MSBuildProjectName).trx - $(SolutionDir)/TestResults + $(MSBuildThisFileDirectory)/TestResults diff --git a/test/GitHubActionsDemo.Api.Integration.Tests/IntegrationTests.cs b/test/GitHubActionsDemo.Api.Integration.Tests/IntegrationTests.cs index 9a1eeef..2a9b23a 100644 --- a/test/GitHubActionsDemo.Api.Integration.Tests/IntegrationTests.cs +++ b/test/GitHubActionsDemo.Api.Integration.Tests/IntegrationTests.cs @@ -1,4 +1,3 @@ - using GitHubActionsDemo.Api.Sdk.Authors; using GitHubActionsDemo.Api.Sdk.Books; using Refit; @@ -6,6 +5,7 @@ using Shouldly; namespace GitHubActionsDemo.Api.Integration.Tests; +[Trait("Category", "Integration")] public class IntegrationTests { private const string BaseUri = "http://localhost:5275"; diff --git a/test/GitHubActionsDemo.Api.Unit.Tests/AuthorsControllerTests.cs b/test/GitHubActionsDemo.Api.Unit.Tests/AuthorsControllerTests.cs index ef3464a..a2ab4f0 100644 --- a/test/GitHubActionsDemo.Api.Unit.Tests/AuthorsControllerTests.cs +++ b/test/GitHubActionsDemo.Api.Unit.Tests/AuthorsControllerTests.cs @@ -10,6 +10,7 @@ using GitHubActionsDemo.Api.Sdk.Shared; namespace GitHubActionsDemo.Api.Unit.Tests; +[Trait("Category", "Unit")] public class AuthorsControllerTests { private readonly Mock _libraryService; diff --git a/test/GitHubActionsDemo.Api.Unit.Tests/GitHubActionsDemo.Api.Unit.Tests.csproj b/test/GitHubActionsDemo.Api.Unit.Tests/GitHubActionsDemo.Api.Unit.Tests.csproj index d5e8165..bb98e64 100644 --- a/test/GitHubActionsDemo.Api.Unit.Tests/GitHubActionsDemo.Api.Unit.Tests.csproj +++ b/test/GitHubActionsDemo.Api.Unit.Tests/GitHubActionsDemo.Api.Unit.Tests.csproj @@ -30,7 +30,7 @@ trx%3bLogFileName=$(MSBuildProjectName).trx - $(SolutionDir)/TestResults + $(MSBuildThisFileDirectory)/TestResults diff --git a/test/GitHubActionsDemo.Service.Unit.Tests/GitHubActionsDemo.Service.Unit.Tests.csproj b/test/GitHubActionsDemo.Service.Unit.Tests/GitHubActionsDemo.Service.Unit.Tests.csproj index 5f2fe7e..ce394f4 100644 --- a/test/GitHubActionsDemo.Service.Unit.Tests/GitHubActionsDemo.Service.Unit.Tests.csproj +++ b/test/GitHubActionsDemo.Service.Unit.Tests/GitHubActionsDemo.Service.Unit.Tests.csproj @@ -30,6 +30,6 @@ trx%3bLogFileName=$(MSBuildProjectName).trx - $(SolutionDir)/TestResults + $(MSBuildThisFileDirectory)/TestResults diff --git a/test/GitHubActionsDemo.Service.Unit.Tests/LibraryServiceTests.cs b/test/GitHubActionsDemo.Service.Unit.Tests/LibraryServiceTests.cs index 5aa2440..de2c989 100644 --- a/test/GitHubActionsDemo.Service.Unit.Tests/LibraryServiceTests.cs +++ b/test/GitHubActionsDemo.Service.Unit.Tests/LibraryServiceTests.cs @@ -1,4 +1,3 @@ -using System; using GitHubActionsDemo.Persistance; using GitHubActionsDemo.Persistance.Models; using GitHubActionsDemo.Service.Models; @@ -6,6 +5,7 @@ using Microsoft.Extensions.Logging; namespace GitHubActionsDemo.Service.Unit.Tests; +[Trait("Category", "Unit")] public class LibraryServiceTests { private readonly Mock _libraryRespository;