diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 494f4322..adeea206 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,11 +16,17 @@ jobs: - name: Build run: dotnet build src --configuration Release --no-restore - name: Test - run: dotnet test src --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}" + run: dotnet test --collect:"XPlat Code Coverage" --settings:src/DotNetStac.Test/coverlet.runsettings --results-directory:TestResults src + - uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + directory: TestResults + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) - name: Upload test results uses: actions/upload-artifact@v2 with: - name: dotnet-results-${{ matrix.dotnet-version }} - path: TestResults-${{ matrix.dotnet-version }} + name: dotnet-results #-${{ matrix.dotnet-version }} + path: TestResults #-${{ matrix.dotnet-version }} # Use always() to always run this step to publish test results when there are test failures if: ${{ always() }} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ffa93901..32fecc6b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,6 +21,27 @@ }, "problemMatcher": "$msCompile" }, + { + "label": "test with coverage", + "command": "dotnet", + "type": "shell", + "args": [ + "test", + // Ask dotnet build to generate full paths for file names. + "/property:GenerateFullPaths=true", + // Do not generate summary otherwise it leads to duplicate errors in Problems panel + "/consoleloggerparameters:NoSummary", + "--collect:\"XPlat Code Coverage\"", + "--settings:src/DotNetStac.Test/coverlet.runsettings", + "--results-directory:TestResults", + "src/DotNetStac.sln" + ], + "group": "build", + "presentation": { + "reveal": "silent" + }, + "problemMatcher": "$msCompile" + }, { "label": "pack", "command": "dotnet", diff --git a/src/DotNetStac.Test/DotNetStac.Test.csproj b/src/DotNetStac.Test/DotNetStac.Test.csproj index 9d5f4da3..8e705b1e 100644 --- a/src/DotNetStac.Test/DotNetStac.Test.csproj +++ b/src/DotNetStac.Test/DotNetStac.Test.csproj @@ -6,18 +6,18 @@ $(SolutionDir)StyleCop.ruleset - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/src/DotNetStac.Test/runsettings.xml b/src/DotNetStac.Test/coverlet.runsettings similarity index 100% rename from src/DotNetStac.Test/runsettings.xml rename to src/DotNetStac.Test/coverlet.runsettings diff --git a/src/DotNetStac/DotNetStac.csproj b/src/DotNetStac/DotNetStac.csproj index 09af7e54..ae1ac6c5 100644 --- a/src/DotNetStac/DotNetStac.csproj +++ b/src/DotNetStac/DotNetStac.csproj @@ -16,24 +16,26 @@ Copyright (c) 2010-2020 by Terradue $(SolutionDir)StyleCop.ruleset true + full - - - - - - - - - - - - + + + + + + + + + + + + + - - + + true true