Skip to content

Commit

Permalink
Merge pull request #36 from localstack-dotnet/net-8-upgrade
Browse files Browse the repository at this point in the history
Update for LocalStack.NET: .NET 8 support, new AWS services and more
  • Loading branch information
Blind-Striker authored Oct 11, 2024
2 parents e1233e1 + 95b7a33 commit 46b04de
Show file tree
Hide file tree
Showing 71 changed files with 1,750 additions and 614 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
build-and-test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Checkout
Expand All @@ -38,10 +38,10 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Install .NET 7
- name: Install .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
dotnet-version: "8.0.x"

- name: Build
run: ./build.sh --target build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Install .NET 7
- name: Install .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
dotnet-version: "8.0.x"

- name: Build
run: .\build.ps1 --target build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Install .NET 7
- name: Install .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
dotnet-version: "8.0.x"

- name: Build & Test
run: ./build.sh
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# LocalStack .NET Client Change Log

### [v1.5.0](https://github.com/localstack-dotnet/localstack-dotnet-client/releases/tag/v1.5.0)

#### 1. New Features

- **Added Endpoints from [Localstack Python Client](https://github.com/localstack/localstack-python-client) v2.7:**
- **RAM**
- **AppConfigData**
- **Pinpoint**
- **EventBridge Pipes**

#### 2. General

- **Framework Support Updates:**
- **.NET 8** support added.
- **Deprecated** support for **.NET 7** and **.NET 4.6.1**.
- Continued support for **.NET Standard 2.0** to maintain compatibility with older .NET versions.
- **Upcoming Changes:**
- In the next release, **.NET 6** support will be removed as it reaches end-of-life in November 2024.

- **Functional Tests Enhancements:**
- **Removed** tests for legacy LocalStack versions and versions **v2.0** and **v2.2**.
- **Note:** LocalStack.NET no longer guarantees compatibility with these versions.
- **Added** functional test support for LocalStack versions:
- **v2.3**
- **v3.4**
- **v3.7.1**
- **New Tests:**
- Introduced new tests for **CloudFormation**.

- **Package Updates:**
- **AWSSDK.Core** minimum version set to **3.7.400.30**.

- **Testing Compatibility:**
- Successfully tested against LocalStack versions:
- **v1.3.1**
- **v2.3**
- **v3.4**
- **v3.7.1**

#### 3. Warnings

- **Breaking Changes Postponed:**
- The planned breaking changes have been postponed to the next release.
- **Important:** Users should anticipate some breaking changes in the next release due to the removal of legacy support and configuration updates.

### [v1.4.1](https://github.com/localstack-dotnet/localstack-dotnet-client/releases/tag/v1.4.1)

#### 1. New Features
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Owners>LocalStack.NET</Owners>
<PackageProjectUrl>https://github.com/localstack-dotnet/localstack-dotnet-client</PackageProjectUrl>
<PackageIcon>localstack-dotnet-square.png</PackageIcon>
<PackageMainVersion>1.4.1</PackageMainVersion>
<PackageExtensionVersion>1.2.1</PackageExtensionVersion>
<PackageMainVersion>1.5.0</PackageMainVersion>
<PackageExtensionVersion>1.3.0</PackageExtensionVersion>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AnalysisLevel>latest</AnalysisLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
269 changes: 142 additions & 127 deletions Directory.Packages.props

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 LocalStack.NET
Copyright (c) 2024 LocalStack.NET

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions LocalStack.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
30 changes: 30 additions & 0 deletions LocalStack.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Solution>
<Folder Name="/build/">
<Project Path="build\LocalStack.Build\LocalStack.Build.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="tests\LocalStack.Client.Extensions.Tests\LocalStack.Client.Extensions.Tests.csproj" />
<Project Path="tests\LocalStack.Client.Functional.Tests\LocalStack.Client.Functional.Tests.csproj" />
<Project Path="tests\LocalStack.Client.Integration.Tests\LocalStack.Client.Integration.Tests.csproj" />
<Project Path="tests\LocalStack.Client.Tests\LocalStack.Client.Tests.csproj" />
</Folder>
<Folder Name="/test/common/">
<Project Path="tests\common\LocalStack.Tests.Common\LocalStack.Tests.Common.csproj" Type="Classic C#" />
</Folder>
<Folder Name="/test/sandboxes/">
<Project Path="tests\sandboxes\LocalStack.Client.Sandbox.DependencyInjection\LocalStack.Client.Sandbox.DependencyInjection.csproj" />
<Project Path="tests\sandboxes\LocalStack.Client.Sandbox.WithGenericHost\LocalStack.Client.Sandbox.WithGenericHost.csproj" />
<Project Path="tests\sandboxes\LocalStack.Client.Sandbox\LocalStack.Client.Sandbox.csproj" />
<Project Path="tests\sandboxes\LocalStack.Container\LocalStack.Container.csproj" />
</Folder>
<Folder Name="/_Solution Items/">
<File Path=".github\workflows\build-macos.yml" />
<File Path=".github\workflows\build-ubuntu.yml" />
<File Path=".github\workflows\build-windows.yml" />
<File Path="build.ps1" />
<File Path="build.sh" />
<File Path=".github\workflows\publish-nuget.yml" />
</Folder>
<Project Path="src\LocalStack.Client.Extensions\LocalStack.Client.Extensions.csproj" />
<Project Path="src\LocalStack.Client\LocalStack.Client.csproj" />
</Solution>
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ The `RegionName` is important as LocalStack creates resources based on the speci

## Known Issues

- **LocalStack Versions v2.0.1 - v2.2:** In versions v2.0.1 through v2.2 of LocalStack, the URL routing logic was changed, causing issues with SQS and S3 operations. Two issues were opened in LocalStack regarding this: [issue #8928](https://github.com/localstack/localstack/issues/8928) and [issue #8924](https://github.com/localstack/localstack/issues/8924). LocalStack addressed this problem with [PR #8962](https://github.com/localstack/localstack/pull/8962). Therefore, when using LocalStack.NET, either use version v2.0 of LocalStack (there are no issues with the v1 series as well) or the upcoming v2.3 version, or use the latest container from Docker Hub.
- **SNS with LocalStack v3.7.2 and v3.8.0:** During development on the new version, it was discovered that SNS functional tests are not working in LocalStack versions v3.7.2 and v3.8.0. This issue was reported in LocalStack [issue #11652](https://github.com/localstack/localstack/issues/11652). The LocalStack team identified a bug related to handling SNS URIs and resolved it in [PR #11653](https://github.com/localstack/localstack/pull/11653). The fix will be included in an upcoming release of LocalStack. In the meantime, if you're using SNS, it is recommended to stick to version v3.7.1 of LocalStack until the fix is available.

- **LocalStack Versions v2.0.1 - v2.2:** In versions v2.0.1 through v2.2 of LocalStack, the URL routing logic was changed, causing issues with SQS and S3 operations. Two issues were opened in LocalStack regarding this: [issue #8928](https://github.com/localstack/localstack/issues/8928) and [issue #8924](https://github.com/localstack/localstack/issues/8924). LocalStack addressed this problem with [PR #8962](https://github.com/localstack/localstack/pull/8962). Therefore, when using LocalStack.NET, either use version v2.0 of LocalStack (there are no issues with the v1 series as well) or the upcoming v2.3 version, or use the latest v3 series container from Docker Hub.

- **AWS_SERVICE_URL Environment Variable:** Unexpected behaviors might occur in LocalStack.NET when the `AWS_SERVICE_URL` environment variable is set. This environment variable is typically set by LocalStack in the container when using AWS Lambda, and AWS also uses this environment variable in the live environment. Soon, just like in LocalStack's official Python library, this environment variable will be prioritized by LocalStack.NET when configuring the LocalStack host, and there will be a general simplification in the configuration. You can follow this in the issues [issue #27](https://github.com/localstack-dotnet/localstack-dotnet-client/issues/27) and [issue #32](https://github.com/localstack-dotnet/localstack-dotnet-client/issues/32). You set the `AWS_SERVICE_URL` to empty string until this issue is resolved.

Expand All @@ -139,6 +141,8 @@ Environment.SetEnvironmentVariable("AWS_SERVICE_URL", string.Empty);

- **IAmazonLambda Operations:** There's a general issue with `IAmazonLambda` operations. This matter is currently under investigation.

- **AWSSDK.SQS Compatibility:** Starting from version `3.7.300.*` of `AWSSDK.SQS`, there are compatibility issues with LocalStack v1 and v2 series versions. The [v3](https://hub.docker.com/r/localstack/localstack/tags?page=&page_size=&ordering=&name=3.4) series of LocalStack does not have these issues. Therefore, it is recommended to either update your LocalStack container to the v3 series or downgrade your `AWSSDK.SQS` to version `3.7.200.*` if you are using LocalStack v1 or v2 series containers. It is important to note that this is not a problem related to LocalStack.NET, but rather an issue with the LocalStack container and the AWS SDK for .NET.

## Developing

We appreciate contributions in the form of feedback, bug reports, and pull requests.
Expand Down
10 changes: 5 additions & 5 deletions build/LocalStack.Build/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void InstallXUnitNugetPackage()

var nugetInstallSettings = new NuGetInstallSettings
{
Version = "2.4.1", Verbosity = NuGetVerbosity.Normal, OutputDirectory = "testrunner", WorkingDirectory = "."
Version = "2.8.1", Verbosity = NuGetVerbosity.Normal, OutputDirectory = "testrunner", WorkingDirectory = "."
};

this.NuGetInstall("xunit.runner.console", nugetInstallSettings);
Expand All @@ -111,7 +111,7 @@ public IEnumerable<ProjMetadata> GetProjMetadata()
.Where(fp => fp.FullPath.EndsWith("Tests.csproj", StringComparison.InvariantCulture))
.ToList();

IList<ProjMetadata> projMetadata = new List<ProjMetadata>();
var projMetadata = new List<ProjMetadata>();

foreach (FilePath csProj in csProjFile)
{
Expand All @@ -131,7 +131,7 @@ public IEnumerable<ProjMetadata> GetProjMetadata()
public void RunXUnitUsingMono(string targetFramework, string assemblyPath)
{
int exitCode = this.StartProcess(
"mono", new ProcessSettings { Arguments = $"./testrunner/xunit.runner.console.2.4.1/tools/{targetFramework}/xunit.console.exe {assemblyPath}" });
"mono", new ProcessSettings { Arguments = $"./testrunner/xunit.runner.console.2.8.1/tools/{targetFramework}/xunit.console.exe {assemblyPath}" });

if (exitCode != 0)
{
Expand Down Expand Up @@ -171,7 +171,7 @@ public string GetExtensionProjectVersion()
return version;
}

private IEnumerable<string> GetProjectTargetFrameworks(string csprojPath)
private string[] GetProjectTargetFrameworks(string csprojPath)
{
FilePath file = this.File(csprojPath);
string project = File.ReadAllText(file.FullPath, Encoding.UTF8);
Expand Down Expand Up @@ -206,7 +206,7 @@ private string GetAssemblyName(string csprojPath)
}
else
{
int startIndex = csprojPath.LastIndexOf("/", StringComparison.Ordinal) + 1;
int startIndex = csprojPath.LastIndexOf('/') + 1;
int endIndex = csprojPath.IndexOf(".csproj", startIndex, StringComparison.Ordinal);

assemblyName = csprojPath.Substring(startIndex, endIndex - startIndex);
Expand Down
2 changes: 1 addition & 1 deletion build/LocalStack.Build/LocalStack.Build.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<LangVersion>latest</LangVersion>
<NoWarn>
Expand Down
56 changes: 19 additions & 37 deletions build/LocalStack.Build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
return new CakeHost()
.UseContext<BuildContext>()
.Run(args);
return new CakeHost().UseContext<BuildContext>().Run(args);

[TaskName("Default"), IsDependentOn(typeof(TestTask))]
public class DefaultTask : FrostingTask
Expand All @@ -12,25 +10,16 @@ public sealed class InitTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.StartProcess("dotnet", new ProcessSettings
{
Arguments = "--info"
});
context.StartProcess("dotnet", new ProcessSettings { Arguments = "--info" });

if (!context.IsRunningOnUnix())
{
return;
}

context.StartProcess("git", new ProcessSettings
{
Arguments = "config --global core.autocrlf true"
});
context.StartProcess("git", new ProcessSettings { Arguments = "config --global core.autocrlf true" });

context.StartProcess("mono", new ProcessSettings
{
Arguments = "--version"
});
context.StartProcess("mono", new ProcessSettings { Arguments = "--version" });

context.InstallXUnitNugetPackage();
}
Expand All @@ -41,11 +30,7 @@ public sealed class BuildTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.DotNetBuild(context.SlnFilePath,
new DotNetBuildSettings
{
Configuration = context.BuildConfiguration
});
context.DotNetBuild(context.SlnFilePath, new DotNetBuildSettings { Configuration = context.BuildConfiguration });
}
}

Expand All @@ -58,10 +43,7 @@ public override void Run(BuildContext context)

var settings = new DotNetTestSettings
{
NoRestore = !context.ForceRestore,
NoBuild = !context.ForceBuild,
Configuration = context.BuildConfiguration,
Blame = true
NoRestore = !context.ForceRestore, NoBuild = !context.ForceBuild, Configuration = context.BuildConfiguration, Blame = true
};

IEnumerable<ProjMetadata> projMetadata = context.GetProjMetadata();
Expand All @@ -78,10 +60,12 @@ public override void Run(BuildContext context)
if (context.SkipFunctionalTest && testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
{
context.Warning("Skipping Functional Tests");

continue;
}

context.Warning($"=============Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}=============");
context.Warning(
$"=============Running {targetFramework.ToUpper(System.Globalization.CultureInfo.CurrentCulture)} tests for {testProj.AssemblyName}=============");
settings.Framework = targetFramework;

if (testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
Expand All @@ -90,13 +74,13 @@ public override void Run(BuildContext context)

try
{
string psOutput = context.DockerPs(new DockerContainerPsSettings() { All = true, Quiet = true});
string psOutput = context.DockerPs(new DockerContainerPsSettings() { All = true, Quiet = true });

if (!string.IsNullOrEmpty(psOutput))
{
context.Warning(psOutput);

string[] containers = psOutput.Split(new[]{ Environment.NewLine }, StringSplitOptions.None);
string[] containers = psOutput.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
context.DockerRm(containers);
}
}
Expand All @@ -106,8 +90,11 @@ public override void Run(BuildContext context)
}
}


if (context.IsRunningOnUnix() && targetFramework == "net461")
if (context.IsRunningOnLinux() && targetFramework == "net462")
{
context.Warning("Temporarily disabled running net462 tests on Linux because of a problem in mono runtime");
}
else if (context.IsRunningOnMacOs() && targetFramework == "net462")
{
context.RunXUnitUsingMono(targetFramework, $"{testProj.DirectoryPath}/bin/{context.BuildConfiguration}/{targetFramework}/{testProj.AssemblyName}.dll");
}
Expand All @@ -117,6 +104,7 @@ public override void Run(BuildContext context)
settings.ArgumentCustomization = args => args.Append($" --logger \"trx;LogFileName={testFilePrefix}_{testResults}\"");
context.DotNetTest(testProjectPath, settings);
}

context.Warning("==============================================================");
}
}
Expand All @@ -139,9 +127,7 @@ public override void Run(BuildContext context)

var settings = new DotNetPackSettings
{
Configuration = context.BuildConfiguration,
OutputDirectory = context.ArtifactOutput,
MSBuildSettings = new DotNetMSBuildSettings()
Configuration = context.BuildConfiguration, OutputDirectory = context.ArtifactOutput, MSBuildSettings = new DotNetMSBuildSettings()
};

settings.MSBuildSettings.SetVersion(context.PackageVersion);
Expand Down Expand Up @@ -201,10 +187,6 @@ public override void Run(BuildContext context)
string packageSecret = context.PackageSecret;
string packageSource = context.PackageSourceMap[context.PackageSource];

context.DotNetNuGetPush(packageFile.Path.FullPath, new DotNetNuGetPushSettings()
{
ApiKey = packageSecret,
Source = packageSource,
});
context.DotNetNuGetPush(packageFile.Path.FullPath, new DotNetNuGetPushSettings() { ApiKey = packageSecret, Source = packageSource, });
}
}
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.400",
"version": "8.0.402",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
Loading

0 comments on commit 46b04de

Please sign in to comment.