Skip to content

Bump Microsoft.NET.Test.Sdk in /tests/NHapi.Base.NUnit #393

Bump Microsoft.NET.Test.Sdk in /tests/NHapi.Base.NUnit

Bump Microsoft.NET.Test.Sdk in /tests/NHapi.Base.NUnit #393

Workflow file for this run

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@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
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 --results-directory TestResults -c Release -f net462 --no-restore --no-build
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net462 --no-restore --no-build
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
- name: Run Benchmatks (Windows)
if: matrix.os == 'windows-latest'
run: |
dotnet run -c Release --project tests\NHapi.Benchmarks\NHapi.Benchmarks.csproj -f net8.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" --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" --results-directory TestResults -c Release -f net8.0 --no-restore --no-build
- name: Upload Benchmark Results
if: always() && matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: BenchmarkDotNet.Artifacts\results
- name: Upload Code Coverage Report
if: always() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
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@v4
- name: "Download artifact"
uses: actions/download-artifact@v4
with:
name: coverage-reports
- name: Set Coverage Report Paths
id: coverage-paths
run: |
readarray -d '' coveragePathArray < <(find . -name "coverage.cobertura.xml" -print0)
coveragePaths=$(printf -- "-r %s " "${coveragePathArray[@]}")
echo "COVERAGE_REPORT_PATHS=$coveragePaths" >> $GITHUB_OUTPUT
- name: Publish Code Coverage Results
run: |
auth="--project-token ${{ secrets.CODACY_PROJECT_TOKEN }}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report $auth \
${{ steps.coverage-paths.outputs.COVERAGE_REPORT_PATHS }} --partial &&\
bash <(curl -Ls https://coverage.codacy.com/get.sh) final $auth
report-benchmark-results:
needs: build-and-test
name: Report Benchmark 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:
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: benchmark-results
- name: 'Report benchmark result'
run: cat ./NHapi.Benchmarks.LargeEmbeddedFileTest-report-github.md >> $GITHUB_STEP_SUMMARY