-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (89 loc) · 2.42 KB
/
build.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
name: Build & test & publish
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
jobs:
# Build packages & run tests
build:
name: Build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build project
run: ./build.sh -Target All
- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-results
path: test-results
if-no-files-found: error
retention-days: 7
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages
path: artifacts/*.nupkg
if-no-files-found: error
retention-days: 7
# Report tests
test-report:
name: Report tests
runs-on: ubuntu-latest
needs: [ build ]
if: ${{ always() }}
permissions:
contents: read
actions: read
checks: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: test-results/
- name: Report tests
uses: dorny/test-reporter@v1
if: ${{ always() }}
with:
name: .NET Tests
path: ./test-results/**/*.trx
reporter: dotnet-trx
- name: Upload code coverage report
uses: codecov/codecov-action@v5
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./test-results/
fail_ci_if_error: true
# Publish packages to nuget.org
publish-to-nuget-org:
name: Publish to NuGet.org
needs: [ build ]
environment: NuGet.org
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Download packages
uses: actions/download-artifact@v4
with:
name: packages
path: packages/
- name: Publish packages
run: dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} packages/*.nupkg