-
Notifications
You must be signed in to change notification settings - Fork 39
58 lines (47 loc) · 1.88 KB
/
dotnetcore.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
name: eShopOnWeb Build and Test
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
include-prerelease: true
- name: Build with dotnet
run: dotnet build ./eShopOnWeb.sln --configuration Release
# See https://josh-ops.com/posts/github-code-coverage/
# Add coverlet.collector nuget package to test project - 'dotnet add <TestProject.cspoj> package coverlet
- name: Test with dotnet
run: dotnet test ./eShopOnWeb.sln --no-restore --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage
- name: Copy Coverage To Predictable Location
run: find coverage -type f -name coverage.cobertura.xml -exec cp -p {} coverage/coverage.cobertura.xml \;
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: coverage/coverage.cobertura.xml
badge: true
format: 'markdown'
output: 'both'
- name: Upload code coverage results artifact
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: code-coverage-results
path: code-coverage-results.md
retention-days: 1
- name: Save the PR number in an artifact
if: github.event_name == 'pull_request' && (success() || failure())
shell: bash
env:
PR_NUMBER: ${{ github.event.number }}
run: echo $PR_NUMBER > pr-number.txt
- name: Upload the PR number
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request' && (success() || failure())
with:
name: pr-number
path: ./pr-number.txt
retention-days: 1