Skip to content

Commit f4c825d

Browse files
authored
Merge pull request #71 from EasyPost/fix_ci
chore: cleanup CI
2 parents e72e083 + 55450a1 commit f4c825d

File tree

8 files changed

+71
-174
lines changed

8 files changed

+71
-174
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request: ~
77
workflow_dispatch: ~
88

99
jobs:
1010
lint:
11-
runs-on: windows-2022
11+
runs-on: windows-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- name: Install .NET SDK
16-
uses: actions/setup-dotnet@v3
16+
uses: actions/setup-dotnet@v4
1717
with:
1818
dotnet-version: 9.x.x
1919

@@ -26,10 +26,10 @@ jobs:
2626
Security_Code_Scan:
2727
runs-on: windows-latest
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030

3131
- name: Install .NET SDK
32-
uses: actions/setup-dotnet@v3
32+
uses: actions/setup-dotnet@v4
3333
with:
3434
dotnet-version: 9.x.x
3535

@@ -40,12 +40,12 @@ jobs:
4040
run: make scan
4141

4242
Coverage_Requirements:
43-
runs-on: ubuntu-22.04
43+
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4646

4747
- name: Install .NET SDK
48-
uses: actions/setup-dotnet@v3
48+
uses: actions/setup-dotnet@v4
4949
with:
5050
dotnet-version: 9.x.x
5151

@@ -57,9 +57,14 @@ jobs:
5757

5858
Upload_Coverage_Report:
5959
if: github.ref == 'refs/heads/master'
60-
runs-on: ubuntu-22.04
60+
runs-on: ubuntu-latest
6161
steps:
62-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
63+
64+
- name: Install .NET SDK
65+
uses: actions/setup-dotnet@v4
66+
with:
67+
dotnet-version: 9.x.x
6368

6469
- name: Set up dotnet tools and dependencies
6570
run: make install
@@ -75,58 +80,56 @@ jobs:
7580

7681
NET_Tests:
7782
# derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
78-
runs-on: windows-2022
79-
env:
80-
EASYPOST_TEST_API_KEY: "123"
81-
EASYPOST_PROD_API_KEY: "123"
83+
runs-on: windows-latest
8284
strategy:
8385
matrix:
84-
name: [ 'net462', 'netstandard2.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0' ]
86+
name: ['net462', 'netstandard2.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0', 'net8.0', 'net9.0']
8587
include:
8688
- name: net462
8789
framework: net462
90+
dotnet-version: null
8891
- name: netstandard2.0
8992
# can't run tests on .NET Standard, it's just a bridge between .NET Framework and .NET.
9093
# So we'll target .NET Framework 4.6.2
9194
# More notes at the bottom of this file
9295
framework: net462
96+
dotnet-version: null
9397
- name: netcoreapp3.1
9498
framework: netcoreapp3.1
99+
dotnet-version: 3.1.x
95100
- name: net5.0
96101
framework: net5.0
102+
dotnet-version: 5.x.x
97103
- name: net6.0
98104
framework: net6.0
105+
dotnet-version: 6.x.x
99106
- name: net7.0
100107
framework: net7.0
108+
dotnet-version: 7.x.x
101109
- name: net8.0
102110
framework: net8.0
111+
dotnet-version: 8.x.x
103112
- name: net9.0
104113
framework: net9.0
114+
dotnet-version: 9.x.x
105115
steps:
106-
- uses: actions/checkout@v3
116+
- uses: actions/checkout@v4
107117
with:
108118
submodules: true
109119

110120
- name: Install .NET SDK
111-
uses: actions/setup-dotnet@v3
121+
uses: actions/setup-dotnet@v4
112122
with:
113-
# Some versions of .NET Core and .NET 5 are deprecated and removed from GitHub Actions, we need to manually install them
114-
dotnet-version: |
115-
3.1.x
116-
5.x.x
117-
6.x.x
118-
7.x.x
119-
8.x.x
120-
9.x.x
123+
dotnet-version: ${{ matrix.dotnet-version}}
121124

122125
- name: Setup MSBuild
123-
uses: microsoft/setup-msbuild@v1.1.2
126+
uses: microsoft/setup-msbuild@v2
124127

125128
- name: Setup Nuget
126-
uses: NuGet/setup-nuget@v1.1.1
129+
uses: NuGet/setup-nuget@v2
127130

128131
- name: Load NuGet package cache
129-
uses: actions/cache@v3
132+
uses: actions/cache@v4
130133
with:
131134
path: ~/.nuget/packages
132135
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
@@ -145,25 +148,25 @@ jobs:
145148
run: make test-fw fw=${{ matrix.framework }}
146149

147150
FSharp_Compatibility:
148-
runs-on: windows-2022
151+
runs-on: windows-latest
149152
steps:
150-
- uses: actions/checkout@v3
153+
- uses: actions/checkout@v4
151154
with:
152155
submodules: true
153156

154157
- name: Install .NET SDK
155-
uses: actions/setup-dotnet@v3
158+
uses: actions/setup-dotnet@v4
156159
with:
157160
dotnet-version: 9.x.x
158161

159162
- name: Setup MSBuild
160-
uses: microsoft/setup-msbuild@v1.1.2
163+
uses: microsoft/setup-msbuild@v2
161164

162165
- name: Setup Nuget
163-
uses: NuGet/setup-nuget@v1.1.1
166+
uses: NuGet/setup-nuget@v2
164167

165168
- name: Setup VSTest
166-
uses: darenm/Setup-VSTest@v1.2
169+
uses: darenm/Setup-VSTest@v1.3
167170

168171
- name: Restore NuGet Packages
169172
run: make restore
@@ -174,29 +177,28 @@ jobs:
174177

175178
# Build the test project
176179
- name: Build Solution
177-
run: make fs-compat-test fw=net8.0 # Always run compatibility tests on the latest framework
178-
180+
run: make fs-compat-test
181+
179182
Visual_Basic_Compatibility:
180-
runs-on: windows-2022
183+
runs-on: windows-latest
181184
steps:
182-
183-
- uses: actions/checkout@v3
185+
- uses: actions/checkout@v4
184186
with:
185187
submodules: true
186188

187189
- name: Install .NET SDK
188-
uses: actions/setup-dotnet@v3
190+
uses: actions/setup-dotnet@v4
189191
with:
190192
dotnet-version: 9.x.x
191193

192194
- name: Setup MSBuild
193-
uses: microsoft/setup-msbuild@v1.1.2
195+
uses: microsoft/setup-msbuild@v2
194196

195197
- name: Setup Nuget
196-
uses: NuGet/setup-nuget@v1.1.1
198+
uses: NuGet/setup-nuget@v2
197199

198200
- name: Setup VSTest
199-
uses: darenm/Setup-VSTest@v1.2
201+
uses: darenm/Setup-VSTest@v1.3
200202

201203
- name: Restore NuGet Packages
202204
run: make restore
@@ -207,8 +209,7 @@ jobs:
207209

208210
# Build the test project
209211
- name: Build Solution
210-
run: make vb-compat-test fw=net8.0 # Always run compatibility tests on the latest framework
211-
212+
run: make vb-compat-test
212213
# .NET Standard notes:
213214
# - 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
214215
# - 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/workflows/release.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
release:
5-
types: [ published ]
5+
types: [published]
66
workflow_dispatch:
77

88
jobs:
@@ -14,16 +14,18 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Install .NET SDK
17-
uses: actions/setup-dotnet@v3
17+
uses: actions/setup-dotnet@v4
1818
with:
19-
# .NET Core 3.1 and .NET 5 are deprecated and removed from GitHub Actions, we need to manually install it
2019
dotnet-version: |
2120
3.1.x
2221
5.x.x
22+
6.x.x
23+
7.x.x
2324
8.x.x
25+
9.x.x
2426
2527
- name: Setup Nuget
26-
uses: NuGet/setup-nuget@v1.1.1
28+
uses: NuGet/setup-nuget@v2
2729

2830
- name: Restore NuGet Packages
2931
run: make restore
@@ -75,6 +77,5 @@ jobs:
7577
if: github.event_name == 'release'
7678
uses: AButler/upload-release-assets@v3.0
7779
with:
78-
files: "*.nupkg"
80+
files: '*.nupkg'
7981
repo-token: ${{ secrets.GITHUB_TOKEN }}
80-

EasyVCR.Tests/ClientTest.cs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using EasyVCR.Handlers;
1010
using EasyVCR.RequestElements;
1111
using Microsoft.VisualStudio.TestTools.UnitTesting;
12-
using RestSharp;
1312

1413
// ReSharper disable InconsistentNaming
1514

@@ -47,40 +46,6 @@ public async Task TestClientClone()
4746
var handler = client.VcrHandler;
4847
var clonedHandler = clonedClient.VcrHandler;
4948
Assert.AreEqual(handler, clonedHandler);
50-
51-
// lock the original client into a request (internally, RestClient will pass/lock the options to the HttpClient, which is what causes this issue)
52-
var options = new RestClientOptions
53-
{
54-
MaxTimeout = 60000,
55-
UserAgent = "EasyVCR Test Client",
56-
BaseUrl = new Uri("https://httpbin.org"),
57-
};
58-
59-
var restClient = new RestClient(client, options);
60-
var request = new RestRequest("https://www.google.com");
61-
var _ = await restClient.ExecuteAsync(request);
62-
63-
// now, if we try to reuse the client in another RestClient, it will throw an exception that the HttpClient is already in use
64-
Assert.ThrowsException<InvalidOperationException>(() => new RestClient(client, options));
65-
66-
// even if we try with a different set of options
67-
var options2 = new RestClientOptions
68-
{
69-
MaxTimeout = 30000,
70-
UserAgent = "EasyVCR Test Client 2",
71-
BaseUrl = new Uri("https://example.com"),
72-
};
73-
Assert.ThrowsException<InvalidOperationException>(() => new RestClient(client, options2));
74-
75-
// if we use the cloned client, it will work
76-
var restClient3 = new RestClient(clonedClient, options);
77-
var request3 = new RestRequest("https://www.google.com");
78-
_ = await restClient3.ExecuteAsync(request3);
79-
80-
// side-note, you CAN re-use the original client if you don't have any options (it's the RestClientOptions that's causing this issue)
81-
var restClient4 = new RestClient(client);
82-
var request4 = new RestRequest("https://www.google.com");
83-
_ = await restClient4.ExecuteAsync(request4);
8449
}
8550

8651
[TestMethod]
@@ -750,4 +715,4 @@ public async Task TestStrictRequestMatching()
750715
return await fakeDataService.GetJsonData();
751716
}
752717
}
753-
}
718+
}

EasyVCR.Tests/EasyVCR.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
2222
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
2323
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
24-
<PackageReference Include="RestSharp" Version="108.0.2" />
2524
<PackageReference Include="coverlet.collector" Version="[3.1.2, 4.0.0)">
2625
<PrivateAssets>all</PrivateAssets>
2726
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2827
</PackageReference>
2928
</ItemGroup>
3029
<ItemGroup>
31-
<Reference Include="System.Web" />
30+
<Reference Include="System.Web" />
3231
</ItemGroup>
3332
</Project>

0 commit comments

Comments
 (0)