Skip to content

Commit 457aa5e

Browse files
authored
[chore] Account for Apple Silicon in development (#519)
- Check for Apple Silicon in dotnet setup script - Clarify Apple Silicon compatibility for unit tests
1 parent 330c055 commit 457aa5e

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace example
3535
static async Task Main()
3636
{
3737
Client client = new Client(new ClientConfiguration(Environment.GetEnvironmentVariable("EASYPOST_API_KEY")));
38-
38+
3939
Parameters.Shipment.Create createParameters = new() {
4040
ToAddress = new Parameters.Address.Create {
4141
Name = "Dr. Steve Brule",
@@ -67,9 +67,9 @@ namespace example
6767
}
6868

6969
Shipment shipment = await client.Shipment.Create(parameters);
70-
70+
7171
Rate rate = shipment.LowestRate();
72-
72+
7373
Paramaters.Shipment.Buy buyParameters = new(rate);
7474

7575
Shipment purchasedShipment = await client.Shipment.Buy(shipment.Id, buyParameters);
@@ -191,12 +191,12 @@ void OnRequestExecutingHandler(object? sender, OnRequestExecutingEventArgs args)
191191
// Interact with details about the HttpRequestMessage here via args
192192
System.Console.WriteLine($"Making HTTP call to {args.RequestUri}");
193193
}
194-
194+
195195
void OnRequestResponseReceivedHandler(object? sender, OnRequestResponseReceivedEventArgs args) {
196196
// Interact with details about the HttpResponseMessage here via args
197197
System.Console.WriteLine($"Received HTTP response with status code {args.ResponseStatusCode}");
198198
}
199-
199+
200200
Client client = new Client(new ClientConfiguration("EASYPOST_API_KEY")
201201
{
202202
Hooks = new Hooks {
@@ -303,6 +303,15 @@ otherwise):
303303
Some tests may require a user with a particular set of enabled features such as a `Partner` user when creating
304304
referrals. We have attempted to call out these functions in their respective docstrings.
305305

306+
**NOTE** .NET Framework/.NET Standard unit tests cannot currently be run on Apple Silicon (M1, M2, etc.). Instead, run
307+
unit tests in one framework at a time with, e.g `make unit-test fw=net7.0`. Valid frameworks:
308+
309+
- `net462` (.NET Framework 4.6.2, will not run on Apple Silicon)
310+
- `netcoreapp3.1` (.NET Core 3.1)
311+
- `net5.0` (.NET 5.0)
312+
- `net6.0` (.NET 6.0)
313+
- `net7.0` (.NET 7.0)
314+
306315
#### Test Coverage
307316

308317
Unit test coverage reports can be generated by running the `generate_test_reports.sh` Bash script from the root of this

scripts/unix/setup.sh

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

33
# This script is used to download and install the required .NET versions
44

5+
# If running Apple Silicon, use brew instead
6+
if [[ $(sysctl -n machdep.cpu.brand_string) =~ "Apple" ]]; then
7+
echo "Apple Silicon detected, using brew to install .NET..."
8+
brew install dotnet
9+
exit 0
10+
fi
11+
512
# .NET versions we want to install
613
declare -a NetVersions=("Current" "7.0" "6.0" "5.0" "3.1")
714

0 commit comments

Comments
 (0)