45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: Pull Request
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "src/**"
|
|
jobs:
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
- name: Format code
|
|
run: dotnet format src --verify-no-changes --verbosity diagnostic
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
- name: Install report generator
|
|
run: |
|
|
dotnet tool install --tool-path ./.tools dotnet-reportgenerator-globaltool
|
|
echo "$PWD/.tools" >> "$GITHUB_PATH"
|
|
- name: Run tests
|
|
run: dotnet test src
|
|
- name: Merge coverage reports
|
|
run: reportgenerator "-reports:src/tests/*/TestResults/*/coverage.cobertura.xml" "-reporttypes:Html;Cobertura" "-targetdir:src/tests/TestResults/Coverage"
|
|
- name: Upload code coverage
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage-reports
|
|
path: src/tests/TestResults/Coverage
|