-
Notifications
You must be signed in to change notification settings - Fork 75
332 lines (270 loc) · 9.59 KB
/
Copy pathci.yml
File metadata and controls
332 lines (270 loc) · 9.59 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
name: CI
on:
push:
branches: [master]
pull_request: ~
workflow_dispatch: ~
jobs:
lint:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Set up dotnet tools
run: just install install-styleguide
- name: Check style with dotnet-format
run: just lint
Roslyn_Static_Analysis:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Set up dotnet tools
run: just install install-styleguide
- name: Restore NuGet Packages
run: just restore
# This Make step is configured to treat all warnings as errors, so it will fail if any warnings are found
- name: Run static analysis
run: just analyze
Security_Code_Scan:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
# v6 is needed for the tool to run
dotnet-version: |
10.x.x
6.x.x
- name: Set up dotnet tools and dependencies
run: just install
- name: Run security analysis
run: just scan
Coverage_Requirements:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Set up dotnet tools and dependencies
run: just install
- name: Check if test suite coverage meets requirements
run: just coverage-check
Upload_Coverage_Report:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Set up dotnet tools and dependencies
run: just install
- name: Run tests
run: just coverage
- name: Coverage
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
Publish_Docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Install docfx
run: just install-tools
- name: Generate docs
run: just docs
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
NET_Tests:
# derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
runs-on: windows-latest
env:
EASYPOST_TEST_API_KEY: '123'
EASYPOST_PROD_API_KEY: '123'
strategy:
matrix:
name: ['Net60', 'Net70', 'Net80', 'Net90', 'Net100']
include:
- name: Net60
framework: net6.0
dotnet-version: 6.x.x
- name: Net70
framework: net7.0
dotnet-version: 7.x.x
- name: Net80
framework: net8.0
dotnet-version: 8.x.x
- name: Net90
framework: net9.0
dotnet-version: 9.x.x
- name: Net100
framework: net10.0
dotnet-version: 10.x.x
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
10.x.x
${{ matrix.dotnet-version }}
- name: Specify .NET SDK version to use since GitHub runners have multiple installed
run: |
echo '{"sdk":{"version": "${{ matrix.dotnet-version }}"}}' > ./global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget
uses: NuGet/setup-nuget@v2
- name: Load NuGet package cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore NuGet Packages
run: just restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: just install
# Run the unit tests in a specific framework (verify that the library works in that framework)
- name: Run Tests
run: just unit-test ${{ matrix.framework }}
Integration_Tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget
uses: NuGet/setup-nuget@v2
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.3
- name: Restore NuGet Packages
run: just restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: just install
# Run the integration tests
- name: Run Tests
run: just integration-test
# .NET Standard notes:
# - NET Standard 2.0 is compatible with minimum .NET Framework 4.6.1: https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
# - GitHub's Windows 2022 runner only supports minimum .NET Framework 4.7.2 anyway: https://github.com/actions/virtual-environments/issues/5055#issuecomment-1040757930
# - .NET Standard is not a framework, but a set of shared APIs between the old .NET Framework and new .NET/.NET Core
# - `EasyPost` targets .NET Standard 2.0, meaning it is compatible with specific versions of both .NET and .NET Framework: https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
# - When you want to actually run code, however, you can't run it in .NET Standard. You have to run it in either .NET or .NET Framework: https://stackoverflow.com/a/48885500/13343799
# - So, while `EasyPost` targets .NET Standard 2.0, `EasyPost.Compatibility.NetStandard`, the code we're actually executing, targets .NET Framework 4.7.2
# - By extension, this is ensuring we are testing that the `EasyPost` source code can run in a .NET Framework environment
NetStandard_Compatibility_Tests:
# Need windows-2022 for .NET Framework 4.7.2 support
runs-on: windows-2022
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
id: setupid
with:
dotnet-version: 10.x.x
- name: Specify .NET SDK version to use since GitHub runners have multiple installed
run: |
echo '{"sdk":{"version": "${{ steps.setupid.outputs.dotnet-version }}"}}' > ./global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget
uses: NuGet/setup-nuget@v2
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.3
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: just install
- name: Restore NuGet Packages
run: just restore build
# Run the compatibility tests
- name: Run Tests
run: just netstandard-compat-test net472
FSharp_Compatibility_Tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
id: setupid
with:
dotnet-version: 10.x.x
- name: Specify .NET SDK version to use since GitHub runners have multiple installed
run: |
echo '{"sdk":{"version": "${{ steps.setupid.outputs.dotnet-version }}"}}' > ./global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget
uses: NuGet/setup-nuget@v2
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.3
- name: Restore NuGet Packages
run: just restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: just install
# Run the compatibility tests
- name: Run Tests
run: just fs-compat-test
Visual_Basic_Compatibility_Test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: extractions/setup-just@v3
- uses: actions/setup-dotnet@v5
id: setupid
with:
dotnet-version: 10.x.x
- name: Specify .NET SDK version to use since GitHub runners have multiple installed
run: |
echo '{"sdk":{"version": "${{ steps.setupid.outputs.dotnet-version }}"}}' > ./global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup Nuget
uses: NuGet/setup-nuget@v2
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.3
- name: Restore NuGet Packages
run: just restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: just install
# Run the compatibility tests
- name: Run Tests
run: just vb-compat-test