Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: upgrade framework and nuget #84

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 6 additions & 80 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on: [push]

jobs:
dot_net_framework_test:
name: .Net Framework 4.6.2
name: .Net Framework 8
runs-on: windows-latest
timeout-minutes: 10

Expand All @@ -23,7 +23,7 @@ jobs:
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-version: "5.x"
nuget-version: "6.x"

- name: Restore NuGet Packages
run: nuget restore shipengine-dotnet.sln
Expand All @@ -32,95 +32,21 @@ jobs:
run: msbuild shipengine-dotnet.sln /p:Configuration=Release

- name: Run Test
run: dotnet test ShipEngine.Tests/bin/Release/net462/ShipEngine.Tests.dll

dot_net_core_test:
name: .Net Core 2.1.x, 3.1.x, and .Net 5.0 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- windows-latest

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Setup dotnet 2.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x

- name: Setup dotnet 3.1.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Setup dotnet 5.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Dotnet tool restore
run: dotnet tool restore

- name: Lint
if: ${{ matrix.os == 'ubuntu-latest'}}
run: dotnet format --check

- name: Dotnet Build
run: dotnet build --configuration Release

- name: Run 2.1.x Tests
run: dotnet test -f netcoreapp2.1

- name: Run 3.1.x Tests
run: dotnet test -f netcoreapp3.1

- name: Run 5.0 Tests
run: dotnet test -f net5.0 --settings ShipEngine.Tests/coverage.runsettings

- name: Move generated lcov file to expected location
shell: bash
run: |
ls -Rlh ShipEngine.Tests/TestResults/*/coverage.info
cat ShipEngine.Tests/TestResults/*/coverage.info > ShipEngine.Tests/TestResults/lcov.info

- name: Send code coverage results to Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-${{ matrix.test_number }}
path-to-lcov: ShipEngine.Tests/TestResults/lcov.info

coverage:
name: Code Coverage
needs: dot_net_core_test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
run: dotnet test ShipEngine.Tests/bin/Release/net8.0/ShipEngine.Tests.dll

nuget-deploy:
runs-on: ubuntu-latest
needs: [dot_net_framework_test, dot_net_core_test]
needs: [dot_net_framework_test]
if: github.ref == 'refs/heads/main'
steps:
# Checkout code if release was created
- uses: actions/checkout@v2

# Setup Dotnet if release was created
- name: Setup dotnet 5.0.x
- name: Setup dotnet 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 8.0.x

- name: publish on version change
id: publish_nuget
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ Added support for requesting retail rates
### Changed

Added support LabelDownload to Package on CreateLabelFromShipment and CreateLabelFromRate

## 2.0.0

### Changed

Updated target framework to .NET 8.0, updated Nuget packages, formatting
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To build the project locally on your computer:
1. **Clone this repo**<br>
`git clone https://github.com/ShipEngine/shipengine-dotnet.git`

2. **Install [.NET 5.x](https://dotnet.microsoft.com/download)**
2. **Install [.NET 8.x](https://dotnet.microsoft.com/download)**

3. **Install dependencies**<br>
`dotnet restore`
Expand Down
4 changes: 2 additions & 2 deletions ShipEngine.Tests/ConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ConfigTest()
}

[Fact]
public async void ValidateDefaultTimeoutTest()
public async Task ValidateDefaultTimeoutTest()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";
var config = new Config(apiKeyString);
Expand Down Expand Up @@ -55,7 +55,7 @@ public async void ValidateDefaultTimeoutTest()
}

[Fact]
public async void ValidateCustomTimeout()
public async Task ValidateCustomTimeout()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
10 changes: 5 additions & 5 deletions ShipEngine.Tests/NetworkTimeoutsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public NetworkRetriesTest()
}

[Fact]
public async void RetryOnceByDefault()
public async Task RetryOnceByDefault()
{
var config = new Config(apiKey: "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk", timeout: TimeSpan.FromSeconds(2));
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -58,7 +58,7 @@ public async void RetryOnceByDefault()
}

[Fact]
public async void CustomRetriesSetting()
public async Task CustomRetriesSetting()
{
var config = new Config(apiKey: "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk", timeout: TimeSpan.FromSeconds(2), retries: 2);
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand All @@ -85,7 +85,7 @@ public async void CustomRetriesSetting()
}

[Fact]
public async void RetriesDisabled()
public async Task RetriesDisabled()
{
var config = new Config(apiKey: "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk", timeout: TimeSpan.FromSeconds(2), retries: 0);
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -117,7 +117,7 @@ public async void RetriesDisabled()

// Retry after is set to 2 seconds. Total elapsed time should be greater
[Fact]
public async void RetriesWaitTheCorrectAmountOfTime()
public async Task RetriesWaitTheCorrectAmountOfTime()
{
var config = new Config(apiKey: "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk", timeout: TimeSpan.FromSeconds(2));
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -146,7 +146,7 @@ public async void RetriesWaitTheCorrectAmountOfTime()
}

[Fact]
public async void RetryAfterIsGreaterThanTimeoutSetting()
public async Task RetryAfterIsGreaterThanTimeoutSetting()
{
var config = new Config(apiKey: "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk", timeout: TimeSpan.FromSeconds(0.5));
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down
27 changes: 12 additions & 15 deletions ShipEngine.Tests/ShipEngine.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;net462</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />

<PackageReference Include="Moq" Version="4.14.7" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ShipEngine\ShipEngine.csproj" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties httpresponsemocks_4createimplicitmanifest200response_1json__JsonSchema="{" /></VisualStudio></ProjectExtensions>

</Project>
<ProjectExtensions>
<VisualStudio>
<UserProperties httpresponsemocks_4createimplicitmanifest200response_1json__JsonSchema="{" />
</VisualStudio>
</ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CreateLabelFromRateTest()
}

[Fact]
public async void ValidCreateLabelFromRateTest()
public async Task ValidCreateLabelFromRateTest()
{
var config = new Config("TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk");
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -112,7 +112,7 @@ public async void ValidCreateLabelFromRateTest()
}

[Fact]
public async void ValidateCustomSettingsAtMethodLevel()
public async Task ValidateCustomSettingsAtMethodLevel()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down Expand Up @@ -148,7 +148,7 @@ public async void ValidateCustomSettingsAtMethodLevel()
}

[Fact]
public async void InvalidRetriesInMethodCall()
public async Task InvalidRetriesInMethodCall()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public CreateLabelFromShipmentDetailsTest()
}

[Fact]
public async void ValidCreateLabelFromShipmentDetailsTest()
public async Task ValidCreateLabelFromShipmentDetailsTest()
{
var config = new Config("TEST_ycvJAgX6tLB1Awm9WGJmD8mpZ8wXiQ20WhqFowCk32s");

Expand Down Expand Up @@ -173,7 +173,7 @@ public void TestParamsSerialization()


[Fact]
public async void ValidateCustomSettingsAtMethodLevel()
public async Task ValidateCustomSettingsAtMethodLevel()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down Expand Up @@ -209,7 +209,7 @@ public async void ValidateCustomSettingsAtMethodLevel()
}

[Fact]
public async void InvalidRetriesInMethodCall()
public async Task InvalidRetriesInMethodCall()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public GetRatesFromShipmentTest()
}

[Fact]
public async void ValidCreateLabelFromShipmentDetailsTest()
public async Task ValidCreateLabelFromShipmentDetailsTest()
{

var config = new Config("TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk");
Expand Down Expand Up @@ -198,7 +198,7 @@ public async void ValidCreateLabelFromShipmentDetailsTest()
}

[Fact]
public async void ValidateCustomSettingsAtMethodLevel()
public async Task ValidateCustomSettingsAtMethodLevel()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down Expand Up @@ -234,7 +234,7 @@ public async void ValidateCustomSettingsAtMethodLevel()
}

[Fact]
public async void InvalidRetriesInMethodCall()
public async Task InvalidRetriesInMethodCall()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
6 changes: 3 additions & 3 deletions ShipEngine.Tests/ShipEngineMethodTests/ListCarriersTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ListCarriers()
}

[Fact]
public async void ValidListCarriersTest()
public async Task ValidListCarriersTest()
{
var config = new Config("TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk");
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -85,7 +85,7 @@ public async void ValidListCarriersTest()

[Fact]
// Check that both API Key and timeout can be set at the method level
public async void ValidateCustomSettingsAtMethodLevel()
public async Task ValidateCustomSettingsAtMethodLevel()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down Expand Up @@ -121,7 +121,7 @@ public async void ValidateCustomSettingsAtMethodLevel()
}

[Fact]
public async void InvalidRetriesInMethodCall()
public async Task InvalidRetriesInMethodCall()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public TrackUsingCarrierCodeAndTrackingNumberTest()
}

[Fact]
public async void ValidTrackUsingCarrierCodeAndTrackingNumberTest()
public async Task ValidTrackUsingCarrierCodeAndTrackingNumberTest()
{
var config = new Config("TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk");
var mockShipEngineFixture = new MockShipEngineFixture(config);
Expand Down Expand Up @@ -77,7 +77,7 @@ public async void ValidTrackUsingCarrierCodeAndTrackingNumberTest()

[Fact]
// Check that both API Key and timeout can be set at the method level
public async void ValidateCustomSettingsAtMethodLevel()
public async Task ValidateCustomSettingsAtMethodLevel()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down Expand Up @@ -113,7 +113,7 @@ public async void ValidateCustomSettingsAtMethodLevel()
}

[Fact]
public async void InvalidRetriesInMethodCall()
public async Task InvalidRetriesInMethodCall()
{
var apiKeyString = "TEST_bTYAskEX6tD7vv6u/cZ/M4LaUSWBJ219+8S1jgFcnkk";

Expand Down
Loading
Loading