diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26434d38e..e7ff6f1c6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,8 +30,17 @@ jobs: - name: Build Duplicati run: dotnet build --no-restore Duplicati.sln - - name: Run unit tests - run: dotnet test --no-build --verbosity minimal --filter "Category!=Integration" Duplicati.sln + - name: Run unit tests with coverage + run: | + mkdir -p "$GITHUB_WORKSPACE/TestResults/unit" + dotnet test --no-build --verbosity minimal --filter "Category!=Integration" --collect:"XPlat Code Coverage" --results-directory "$GITHUB_WORKSPACE/TestResults/unit" Duplicati.sln + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ github.workspace }}/TestResults/integration/**/coverage.cobertura.xml + flags: unittest,${{ matrix.os }} integration_tests: name: Integration tests @@ -56,8 +65,17 @@ jobs: - name: Build Duplicati run: dotnet build --no-restore Duplicati.sln - - name: Run integration tests - run: dotnet test --no-build --verbosity minimal --filter "Category=Integration" Duplicati.sln + - name: Run integration tests with coverage + run: | + mkdir -p "$GITHUB_WORKSPACE/TestResults/integration" + dotnet test --no-build --verbosity minimal --filter "Category=Integration" --collect:"XPlat Code Coverage" --results-directory "$GITHUB_WORKSPACE/TestResults/integration" Duplicati.sln + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ github.workspace }}/TestResults/integration/**/coverage.cobertura.xml + flags: integration,${{ matrix.os }} # Disabled, as a new test needs to be written for the new UI # selenium: diff --git a/Duplicati/UnitTest/Duplicati.UnitTest.csproj b/Duplicati/UnitTest/Duplicati.UnitTest.csproj index a72fac4b3..812b45e3b 100644 --- a/Duplicati/UnitTest/Duplicati.UnitTest.csproj +++ b/Duplicati/UnitTest/Duplicati.UnitTest.csproj @@ -10,6 +10,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all +