Skip to content

Commit

Permalink
Upgrade to .NET 8 (#281)
Browse files Browse the repository at this point in the history
* Upgrade to .NET 8

Signed-off-by: Victor Chang <[email protected]>
  • Loading branch information
mocsharp committed Jan 2, 2024
1 parent e6d1220 commit 347c2ab
Show file tree
Hide file tree
Showing 28 changed files with 1,595 additions and 4,130 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Enable NuGet cache
uses: actions/[email protected]
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Enable Homebrew
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
Expand Down Expand Up @@ -123,11 +123,11 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Enable NuGet cache
uses: actions/[email protected]
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
working-directory: ./src/Plugins/MinIO/Tests

- name: Test
run: find ~+ -type f -name "*.Test.csproj" | xargs -L1 dotnet test -c ${{ env.BUILD_CONFIG }} -v=minimal -r "${{ env.TEST_RESULTS }}" --collect:"XPlat Code Coverage" --settings coverlet.runsettings
run: find ~+ -type f -name "*.Tests.csproj" | xargs -L1 dotnet test -c ${{ env.BUILD_CONFIG }} -v=minimal --results-directory "${{ env.TEST_RESULTS }}" --collect:"XPlat Code Coverage" --settings coverlet.runsettings
working-directory: ./src

- name: End SonarScanner
Expand All @@ -188,7 +188,7 @@ jobs:
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: "src/${{ env.TEST_RESULTS }}"
directory: "src/"
files: "**/coverage.opencover.xml"
flags: unittests
name: codecov-umbrella
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:

- uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"

- name: Enable NuGet cache
uses: actions/[email protected]
Expand Down Expand Up @@ -308,7 +308,7 @@ jobs:
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"
source-url: https://nuget.pkg.github.com/Project-MONAI/index.json

- name: Publish to GitHub
Expand All @@ -333,7 +333,7 @@ jobs:
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
dotnet-version: "6.0.x"
dotnet-version: "8.0.x"
source-url: https://nuget.pkg.github.com/Project-MONAI/index.json

- name: Publish to GitHub
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
14 changes: 3 additions & 11 deletions src/Plugins/AWSS3/Monai.Deploy.Storage.AWSS3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,18 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<RootNamespace>Monai.Deploy.Storage.AWSS3</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE" Link="LICENSE" PackagePath="" Pack="true" />
<None Include="..\..\..\third-party-licenses.md" Link="third-party-licenses.md" PackagePath="" Pack="true" />
</ItemGroup>

<PropertyGroup>
<PackageId>Monai.Deploy.Storage.AWSS3</PackageId>
<Version>0.1.0</Version>
Expand All @@ -42,18 +38,14 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.201.11" />
<PackageReference Include="AWSSDK.S3" Version="3.7.304.11" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\S3Policy\Monai.Deploy.Storage.S3Policy.csproj" />
<ProjectReference Include="..\..\Storage\Monai.Deploy.Storage.csproj" />
</ItemGroup>

</Project>
</Project>
7 changes: 4 additions & 3 deletions src/Plugins/MinIO/IMinIoClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

using Amazon.SecurityToken.Model;
using Minio;
using Minio.ApiEndpoints;

namespace Monai.Deploy.Storage.MinIO
{
public interface IMinIoClientFactory
{
MinioClient GetClient();
IMinioClient GetClient();

MinioClient GetClient(Credentials credentials);
IMinioClient GetClient(Credentials credentials);

MinioClient GetClient(Credentials credentials, string region);
IMinioClient GetClient(Credentials credentials, string region);

IObjectOperations GetObjectOperationsClient();

Expand Down
15 changes: 8 additions & 7 deletions src/Plugins/MinIO/MinIoClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Ardalis.GuardClauses;
using Microsoft.Extensions.Options;
using Minio;
using Minio.ApiEndpoints;
using Monai.Deploy.Storage.Configuration;

namespace Monai.Deploy.Storage.MinIO
Expand All @@ -27,7 +28,7 @@ public class MinIoClientFactory : IMinIoClientFactory
{
private static readonly string DefaultClient = "_DEFAULT_";
internal static readonly int DefaultTimeout = 2500;
private readonly ConcurrentDictionary<string, MinioClient> _clients;
private readonly ConcurrentDictionary<string, IMinioClient> _clients;

private StorageServiceConfiguration Options { get; }

Expand All @@ -40,10 +41,10 @@ public MinIoClientFactory(IOptions<StorageServiceConfiguration> options)

Options = configuration;

_clients = new ConcurrentDictionary<string, MinioClient>();
_clients = new ConcurrentDictionary<string, IMinioClient>();
}

public MinioClient GetClient()
public IMinioClient GetClient()
{
return _clients.GetOrAdd(DefaultClient, _ =>
{
Expand All @@ -55,12 +56,12 @@ public MinioClient GetClient()
});
}

public MinioClient GetClient(Credentials credentials)
public IMinioClient GetClient(Credentials credentials)
{
return GetClient(credentials, string.Empty);
}

public MinioClient GetClient(Credentials credentials, string region)
public IMinioClient GetClient(Credentials credentials, string region)
{
return GetClientInternal(credentials, region);
}
Expand Down Expand Up @@ -109,7 +110,7 @@ public IObjectOperations GetObjectOperationsClient(Credentials credentials, stri
return GetClientInternal(credentials, region);
}

private MinioClient CreateClient(string accessKey, string accessToken)
private IMinioClient CreateClient(string accessKey, string accessToken)
{
var endpoint = Options.Settings[ConfigurationKeys.EndPoint];
var securedConnection = Options.Settings[ConfigurationKeys.SecuredConnection];
Expand All @@ -133,7 +134,7 @@ private MinioClient CreateClient(string accessKey, string accessToken)
return client;
}

private MinioClient GetClientInternal(Credentials credentials, string region)
private IMinioClient GetClientInternal(Credentials credentials, string region)
{
Guard.Against.Null(credentials, nameof(credentials));
Guard.Against.NullOrWhiteSpace(credentials.AccessKeyId, nameof(credentials.AccessKeyId));
Expand Down
3 changes: 2 additions & 1 deletion src/Plugins/MinIO/MinIoStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Minio;
using Minio.ApiEndpoints;
using Minio.DataModel.Args;
using Monai.Deploy.Storage.Configuration;

namespace Monai.Deploy.Storage.MinIO
Expand Down
3 changes: 2 additions & 1 deletion src/Plugins/MinIO/MinIoStorageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
using Ardalis.GuardClauses;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Minio;
using Minio.ApiEndpoints;
using Minio.DataModel.Args;
using Minio.Exceptions;
using Monai.Deploy.Storage.API;
using Monai.Deploy.Storage.Configuration;
Expand Down
15 changes: 3 additions & 12 deletions src/Plugins/MinIO/Monai.Deploy.Storage.MinIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>Monai.Deploy.Storage.MinIO</RootNamespace>
Expand All @@ -26,12 +24,10 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE" Link="LICENSE" PackagePath="" Pack="true" />
<None Include="..\..\..\third-party-licenses.md" Link="third-party-licenses.md" PackagePath="" Pack="true" />
</ItemGroup>

<PropertyGroup>
<PackageId>Monai.Deploy.Storage.MinIO</PackageId>
<Version>0.1.0</Version>
Expand All @@ -45,24 +41,19 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Minio" Version="5.0.0" />
<PackageReference Include="Minio" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\S3Policy\Monai.Deploy.Storage.S3Policy.csproj" />
<ProjectReference Include="..\..\Storage\Monai.Deploy.Storage.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Tests\**" />
<EmbeddedResource Remove="Tests\**" />
<None Remove="Tests\**" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task CheckHealthAsync_WhenListBucketSucceeds_ReturnHealthy()

_minIoClientFactory.Setup(p => p.GetBucketOperationsClient()).Returns(minioClient);
var healthCheck = new MinIoHealthCheck(_minIoClientFactory.Object, _logger.Object);
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext()).ConfigureAwait(false);
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext());

Assert.Equal(HealthStatus.Healthy, results.Status);
Assert.Null(results.Exception);
Expand Down
3 changes: 2 additions & 1 deletion src/Plugins/MinIO/Tests/Integration/MinIoStorageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

using Microsoft.Extensions.Options;
using Minio;
using Minio.ApiEndpoints;
using Minio.DataModel.Args;
using Monai.Deploy.Storage.Configuration;
using Xunit;

Expand Down
Loading

0 comments on commit 347c2ab

Please sign in to comment.