-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (115 loc) · 3.46 KB
/
dotnet-test.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Dotnet Build and Test
on:
- push
- workflow_dispatch
permissions:
contents: read
actions: read
checks: write
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build
- uses: actions/upload-artifact@v4
with:
name: build
path: |
src
test
retention-days: 1
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
version:
- "8.0"
- "9.0"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.version }}.x
- uses: actions/download-artifact@v4
with:
name: build
- name: Install tools
run: |
dotnet tool restore --tool-manifest .config/dotnet-tools-ci.json
- name: Tests with Coverage
run: >
dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml -f cobertura -s coverage.runsettings
dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ matrix.version }}.trx" --framework "net${{ matrix.version }}"
- name: Generate Coverage Report
if: always()
run: >
dotnet reportgenerator
-reports:${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml
-targetdir:"${{ github.workspace }}/coverage/"
-reporttypes:'MarkdownSummaryGithub;Html'
- name: Tests and Coverage Summary
id: coverage
if: always()
run: pwsh make-summary.ps1
- name: Tests Report
uses: dorny/test-reporter@v1
if: always()
with:
name: DotNET Tests (${{ matrix.version }})
path: "**/TestResults-${{ matrix.version }}.trx"
reporter: dotnet-trx
- name: Coverage Report
uses: LouisBrunner/[email protected]
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: DotNET Coverage (${{ matrix.version }})
conclusion: success
output: '{"summary":"${{ steps.coverage.outputs.coverage_badge }}"}'
output_text_description_file: coverage/SummaryGithub.md
- name: Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: coverage/SummaryGithub.md
- name: Upload Tests artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: tests-${{ matrix.version }}
path: "**/TestResults-${{ matrix.version }}.trx"
- name: Upload Coverage artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-${{ matrix.version }}
path: coverage/
- name: Upload Pages artifact
if: matrix.version == '9.0'
uses: actions/upload-pages-artifact@v3
with:
path: test/Html
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: tests
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4