refactor: exclude obsolete methods from code coverage (#504) #340
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build" | |
on: | |
push: | |
branches: [main] | |
jobs: | |
test-macos: | |
name: Test (MacOS) | |
runs-on: macos-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build solution | |
run: dotnet build /p:NetCoreOnly=True --configuration "Release" | |
- name: Run tests | |
uses: Wandalen/wretry.action@v1.4.10 | |
with: | |
command: dotnet test --no-build --collect:"XPlat Code Coverage" | |
attempt_limit: 2 | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Code coverage (MacOS) | |
path: "**/coverage.cobertura.xml" | |
test-ubuntu: | |
name: Test (Ubuntu) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build solution | |
run: dotnet build /p:NetCoreOnly=True --configuration "Release" | |
- name: Run tests | |
uses: Wandalen/wretry.action@v1.4.10 | |
with: | |
command: dotnet test --no-build --collect:"XPlat Code Coverage" | |
attempt_limit: 2 | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Code coverage (Ubuntu) | |
path: "**/coverage.cobertura.xml" | |
test-windows: | |
name: Test (Windows) | |
runs-on: windows-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build solution | |
run: dotnet build /p:NetCoreOnly=True --configuration "Release" | |
- name: Run tests | |
uses: Wandalen/wretry.action@v1.4.10 | |
with: | |
command: dotnet test --no-build --collect:"XPlat Code Coverage" | |
attempt_limit: 2 | |
- name: Upload coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Code coverage (Windows) | |
path: "**/coverage.cobertura.xml" | |
test-net-framework: | |
name: Test (.NET Framework) | |
runs-on: windows-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup VSTest | |
uses: darenm/Setup-VSTest@v1 | |
- name: Navigate to Workspace | |
run: cd $GITHUB_WORKSPACE | |
- name: Build solution | |
run: msbuild.exe Testably.Abstractions.sln /p:NetFrameworkOnly=True /p:platform="Any CPU" /p:configuration="Release" -t:restore,build -p:RestorePackagesConfig=true | |
- name: Run tests | |
run: vstest.console.exe .\Build\Tests\Testably.Abstractions.Tests\net48\Testably.Abstractions.Tests.dll .\Build\Tests\Testably.Abstractions.Parity.Tests\net48\Testably.Abstractions.Parity.Tests.dll .\Build\Tests\Testably.Abstractions.Testing.Tests\net48\Testably.Abstractions.Testing.Tests.dll | |
test-examples: | |
name: Test (Examples) | |
runs-on: windows-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build solution | |
run: dotnet build /p:NetCoreOnly=True --configuration "Release" | |
- name: Build example solution | |
run: dotnet build Examples /p:UseFileReferenceToTestablyLibraries=True | |
- name: Run example tests | |
uses: Wandalen/wretry.action@v1.4.10 | |
with: | |
command: dotnet test Examples --no-build | |
attempt_limit: 2 | |
upload-coverage: | |
name: Upload coverage to Codacy | |
needs: [test-macos, test-ubuntu, test-windows, test-net-framework] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
- name: Download code coverage files (MacOS) | |
uses: actions/download-artifact@v3 | |
with: | |
name: Code coverage (MacOS) | |
path: Coverage/MacOS | |
- name: Download code coverage files (Ubuntu) | |
uses: actions/download-artifact@v3 | |
with: | |
name: Code coverage (Ubuntu) | |
path: Coverage/Ubuntu | |
- name: Download code coverage files (Windows) | |
uses: actions/download-artifact@v3 | |
with: | |
name: Code coverage (Windows) | |
path: Coverage/Windows | |
- name: Generate coverage report | |
uses: danielpalme/ReportGenerator-GitHub-Action@5.2.3 | |
with: | |
reports: "Coverage/**/coverage.cobertura.xml" | |
targetdir: "coverage-report" | |
reporttypes: "Cobertura" | |
- name: Publish coverage report to Codacy | |
uses: codacy/codacy-coverage-reporter-action@master | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: coverage-report/Cobertura.xml |