-
Notifications
You must be signed in to change notification settings - Fork 18
187 lines (185 loc) · 7.97 KB
/
CI.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: CI
on:
push:
branches-ignore:
- "wip/**"
pull_request:
branches-ignore:
- "wip/**"
release:
types: [published]
jobs:
tests:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
dotnet: ["6.0.x", "8.0.x"]
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
${{ matrix.dotnet }}
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Compile
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Tests
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; details of failed tests
uses: actions/upload-artifact@v1
if: failure()
with:
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults
tests_netframework:
strategy:
matrix:
os: [windows-2019]
dotnet: [net48]
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Compile
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Tests
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; details of failed tests
uses: actions/upload-artifact@v1
if: failure()
with:
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults
code_coverage:
needs: [tests, tests_netframework]
if: github.event_name == 'release' || github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
name: Code coverage
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Analyze code coverage
run: pwsh build.ps1 --target codecoveragereport --dotnet 6.0.x --configuration debug --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; code coverage data
uses: actions/upload-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
path: artifacts/coverage/Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
- name: Upload artifact; code coverage summary
uses: actions/upload-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
- name: Upload artifact; code coverage report
if: github.event_name == 'release'
uses: actions/upload-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_report
nuget_package:
needs: [tests, tests_netframework]
if: github.event_name == 'release'
runs-on: ubuntu-latest
name: NuGet package
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Setup base dotnet sdk
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Create package
run: pwsh build.ps1 --target nugetpackage --dotnet 8.0.x --configuration release --commitsha ${{ github.sha }} --version ${{ env.VALIDOT_VERSION }}
- name: Upload artifact; nuget package
uses: actions/upload-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.nupkg
- name: Upload artifact; nuget package symbols
uses: actions/upload-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.snupkg
- name: Publish nuget package
run: pwsh build.ps1 --target publishnugetpackage --skip --dotnet 8.0.x --configuration release --version ${{ env.VALIDOT_VERSION }} --commitsha ${{ github.sha }} --nugetapikey ${{ secrets.NUGET_API_KEY }}
release_assets:
needs: [code_coverage, nuget_package]
if: github.event_name == 'release'
runs-on: ubuntu-latest
name: Upload release assets
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Init workflow variables
run: pwsh .github/workflows/Init-WorkflowVariables.ps1
- name: Download artifact; nuget package
uses: actions/download-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget
- name: Download artifact; nuget package symbols
uses: actions/download-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget
- name: Download artifact; code coverage data
uses: actions/download-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/data
- name: Download artifact; code coverage summary
uses: actions/download-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage
- name: Download artifact; code coverage report
uses: actions/download-artifact@v1
with:
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/report
- name: Zip artifacts
run: |
cd artifacts
zip -rX Validot.${{ env.VALIDOT_VERSION }}.nuget.zip Validot.${{ env.VALIDOT_VERSION }}.nuget
zip -rX Validot.${{ env.VALIDOT_VERSION }}.coverage.zip Validot.${{ env.VALIDOT_VERSION }}.coverage
- name: Upload release asset; nuget package with symbols
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget.zip
asset_name: Validot.${{ env.VALIDOT_VERSION }}.nuget.zip
asset_content_type: application/zip
- name: Upload release asset; code coverage data and reports
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage.zip
asset_name: Validot.${{ env.VALIDOT_VERSION }}.coverage.zip
asset_content_type: application/zip