Skip to content

build: add code coverage information to prs #3

build: add code coverage information to prs

build: add code coverage information to prs #3

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build and test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install workloads
run: dotnet workload install android
- name: Check format
run: |
dotnet tool restore
dotnet csharpier check .
- name: Restore dependencies
run: dotnet restore /p:EnableWindowsTargeting=true
- name: Build
run: dotnet build --no-restore --configuration Release /p:EnableWindowsTargeting=true
- name: Test
run: |
dotnet test ${{ env.SOLUTION_NAME }} --no-build --configuration Release \
--collect:"XPlat Code Coverage;Format=cobertura" \
--results-directory ./coverage-results
- name: Post Coverage Report
uses: rosslight/pr-code-coverage-visualizer@v2.2.0
with:
files: |
coverage-results/**/coverage.cobertura.xml
exclude-files: |
*.g.cs