-
Notifications
You must be signed in to change notification settings - Fork 4
216 lines (172 loc) · 6.56 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
name: CI
on:
push:
branches: [ master ]
pull_request: ~
workflow_dispatch: ~
jobs:
lint:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools
run: make install-tools
- name: Check style with dotnet-format
run: make lint
Security_Code_Scan:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- 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@v3
- 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@v3
- 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 }}
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: [ 'net462', 'netstandard2.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0' ]
include:
- name: net462
framework: net462
- name: netstandard2.0
# 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: netcoreapp3.1
framework: netcoreapp3.1
- name: net5.0
framework: net5.0
- name: net6.0
framework: net6.0
- name: net7.0
framework: net7.0
- name: net8.0
framework: net8.0
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
# .NET Core 3.1 and .NET 5 are deprecated and removed from GitHub Actions, we need to manually install them
dotnet-version: |
3.1.x
5.x.x
8.x.x
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Setup Nuget
uses: NuGet/[email protected]
- 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 test-fw fw=${{ matrix.framework }}
FSharp_Compatibility:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Setup Nuget
uses: NuGet/[email protected]
- name: Setup VSTest
uses: darenm/[email protected]
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Build the test project
- name: Build Solution
run: make fs-compat-test fw=net8.0 # Always run compatibility tests on the latest framework
Visual_Basic_Compatibility:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Setup Nuget
uses: NuGet/[email protected]
- name: Setup VSTest
uses: darenm/[email protected]
- name: Restore NuGet Packages
run: make restore
# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install
# Build the test project
- name: Build Solution
run: make vb-compat-test fw=net8.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
# - `EasyVCR` 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 `EasyVCR` targets .NET Standard 2.0, `EasyVCR.Tests`, the code we're actually executing, targets .NET Framework 4.6.2
# - By extension, this is ensuring we are testing that the `EasyVCR` source code can run in a .NET Framework environment