-
Notifications
You must be signed in to change notification settings - Fork 11
64 lines (58 loc) · 2.11 KB
/
test-and-analyze-fork.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Code test and analysis (fork)
on:
pull_request:
jobs:
test:
if: github.repository_owner == 'Altinn' && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
name: Build and Test
runs-on: windows-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: dotnet build
run: dotnet build AppLibDotnet.sln -v m
- name: dotnet test
run: dotnet test AppLibDotnet.sln --results-directory TestResults/ --collect:"XPlat Code Coverage" -v m
- name: Generate coverage results
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
reportgenerator -reports:TestResults/**/coverage.cobertura.xml -targetdir:TestResults/Output/CoverageReport -reporttypes:Cobertura
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: TestResults/Output/CoverageReport/
code-coverage:
if: github.repository_owner == 'Altinn' && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
name: Report code coverage
runs-on: ubuntu-latest
needs: test
steps:
- name: Download Coverage Results
uses: actions/download-artifact@master
with:
name: code-coverage-report
path: dist/
- name: Create Coverage Summary Report
uses: irongut/[email protected]
with:
filename: dist/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md