Skip to content

Merge pull request #108 from Amberg/workitems/NugetUpdate #261

Merge pull request #108 from Amberg/workitems/NugetUpdate

Merge pull request #108 from Amberg/workitems/NugetUpdate #261

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'DocxTemplater.sln'
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4 #Fetch all history for all tags and branches
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
10.x.x
9.x.x
8.x.x
- name: Restore
run: dotnet restore $SOLUTION
- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore
- name: Run tests
run: |
dotnet test $SOLUTION -c $BUILD_CONFIG --no-restore --no-build --verbosity normal \
--logger "trx;LogFileName=test-results.trx" \
--collect:"XPlat Code Coverage" \
--results-directory ./TestResults \
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
- name: Test Report
uses: dorny/test-reporter@v2
if: always()
with:
name: .NET Tests
path: "TestResults/*.trx"
reporter: dotnet-trx
list-suites: all
list-tests: failed
- name: Install ReportGenerator
run: dotnet tool install -g dotnet-reportgenerator-globaltool || true
- name: Generate Coverage Report
run: |
reportgenerator -reports:./TestResults/**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:"Html;MarkdownSummary"
- name: Add coverage to GitHub summary
run: |
echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
cat CoverageReport/Summary.md >> $GITHUB_STEP_SUMMARY
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: test-results
path: ./TestResults/*.trx
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./CoverageReport/