-
Notifications
You must be signed in to change notification settings - Fork 74
286 lines (224 loc) · 8.21 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
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
name: CI
on:
push:
branches: [ master ]
pull_request: ~
workflow_dispatch: ~
jobs:
lint:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools
run: make install install-styleguide
- name: Check style with dotnet-format
run: make lint
Roslyn_Static_Analysis:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools
run: make install install-styleguide
- name: Restore NuGet Packages
run: make 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: make analyze
Security_Code_Scan:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools and dependencies
run: make install
- name: Run security analysis
run: make scan
Coverage_Requirements:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools and dependencies
run: make install
- name: Check if test suite coverage meets requirements
run: make coverage-check
Upload_Coverage_Report:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up dotnet tools and dependencies
run: make install
- name: Generate coverage report
run: make coverage
- name: Upload lcov coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: coveragereport/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
Publish_Docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Install docfx
run: make install-tools
- name: Generate docs
run: make 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-2022
env:
EASYPOST_TEST_API_KEY: "123"
EASYPOST_PROD_API_KEY: "123"
strategy:
matrix:
name: [ 'NetStandard20', 'Net50', 'Net60', 'Net70', 'Net80' ]
include:
- name: NetStandard20
# can't run tests on .NET Standard, it's just a bridge between .NET Framework and .NET.
# So we'll target .NET Framework 4.6.2
# More notes at the bottom of this file
framework: net462
- name: Net50
framework: net5.0
- name: Net60
framework: net6.0
- name: Net70
framework: net7.0
- name: Net80
framework: net8.0
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
# .NET 5.0 is deprecated and removed from GitHub Actions, we need to manually install it
dotnet-version: |
5.x.x
8.x.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.2
- name: Setup Nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Load NuGet package cache
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Run the unit tests in a specific framework (verify that the library works in that framework)
- name: Run Tests
run: make unit-test fw=${{ matrix.framework }}
Integration_Tests:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.2
- name: Setup Nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.2
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Run the integration tests
- name: Run Tests
run: make integration-test fw=net7.0 # Always run integration tests on the latest framework
FSharp_Compatibility_Tests:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.2
- name: Setup Nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.2
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Run the compatibility tests
- name: Run Tests
run: make fs-compat-test fw=net7.0 # Always run compatibility tests on the latest framework
Visual_Basic_Compatibility_Test:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.2
- name: Setup Nuget
uses: NuGet/setup-nuget@v1.1.1
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.2
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Run the compatibility tests
- name: Run Tests
run: make vb-compat-test fw=net7.0 # Always run compatibility tests on the latest framework
# .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
# - NET Framework 4.6.1 is EOL after April 26, 2022, due to its security concerns (was affected by the SHA-1 crack): https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework
# - GitHub's Windows 2022 runner only supports minimum .NET Framework 4.6.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.Tests`, the code we're actually executing, targets .NET Framework 4.6.2
# - By extension, this is ensuring we are testing that the `EasyPost` source code can run in a .NET Framework environment