Bump Microsoft.NET.Test.Sdk in /tests/NHapi.Base.NUnit #300
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 Status | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-test: | |
name: Build And Test ${{matrix.os}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
- name: Restore nHapi (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
dotnet restore nHapi.sln --configfile build\.nuget\NuGet.config | |
- name: Restore nHapi (Non-Windows) | |
if: matrix.os != 'windows-latest' | |
run: | | |
dotnet restore nHapi.sln --configfile build/.nuget/NuGet.config | |
- name: Build nHapi | |
run: | | |
dotnet build nHapi.sln -c Release --no-restore | |
- name: Run tests for all target frameworks (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -r TestResults -c Release -f net461 --no-restore --no-build | |
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build | |
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build | |
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj -r TestResults -c Release -f net461 --no-restore --no-build | |
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj -r TestResults -c Release -f net6.0 --no-restore --no-build | |
- name: Run tests for all target frameworks (Non-Windows) | |
if: matrix.os != 'windows-latest' | |
run: | | |
dotnet test tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build | |
dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build | |
dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build | |
- name: Upload Code Coverage Report | |
if: always() && matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-reports | |
path: | | |
TestResults/ | |
publish-coverage-results: | |
needs: build-and-test | |
name: Publish Code Coverage Results | |
runs-on: ubuntu-latest | |
# the build-and-test job might be skipped, we don't need to run this job then | |
if: always() | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Download artifact' | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-reports | |
- name: Set Coverage Report Paths | |
id: coverage-paths | |
run: | | |
readarray -d '' coveragePathArray < <(find . -name "coverage.cobertura.xml" -print0) | |
coveragePaths=$(printf ",%s" "${coveragePathArray[@]}") | |
echo "::set-output name=COVERAGE_REPORT_PATHS::$coveragePaths" | |
- name: Publish Code Coverage Results | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }} |