diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a0828b142..50baa95f9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -302,7 +302,7 @@ jobs:
- run: pytest -vv tests/integration/workflows/ruby_bundler
dotnet-integration:
- name: ${{ matrix.os }} / ${{ matrix.python }} / dotnet
+ name: ${{ matrix.os }} / ${{ matrix.python }} / dotnet ${{ matrix.dotnet }}
if: github.repository_owner == 'aws'
runs-on: ${{ matrix.os }}
strategy:
@@ -313,11 +313,18 @@ jobs:
- windows-latest
python:
- "3.13"
+ dotnet:
+ - "6.0.x"
+ - "8.0.x"
+ - "10.0.x"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
+ - uses: actions/setup-dotnet@v5
+ with:
+ dotnet-version: ${{ matrix.dotnet }}
- run: make init
- run: pytest -vv tests/integration/workflows/dotnet_clipackage
diff --git a/aws_lambda_builders/supported_runtimes.py b/aws_lambda_builders/supported_runtimes.py
index 5cf237bbe..9ccb832bf 100644
--- a/aws_lambda_builders/supported_runtimes.py
+++ b/aws_lambda_builders/supported_runtimes.py
@@ -52,6 +52,7 @@
DOTNET_RUNTIMES = [
"dotnet6",
"dotnet8",
+ "dotnet10",
]
# Custom runtimes
diff --git a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
index 2e85e902d..ac9f4b6ab 100644
--- a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
+++ b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
@@ -13,6 +13,34 @@
from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.architecture import ARM64, X86_64
+from aws_lambda_builders.supported_runtimes import DOTNET_RUNTIMES
+
+
+def get_dotnet_test_params():
+ """Generate test parameters from DOTNET_RUNTIMES for standard Lambda functions."""
+ params = []
+ for runtime in DOTNET_RUNTIMES:
+ version_num = runtime.replace("dotnet", "")
+ version = f"{version_num}.0"
+ test_project = f"WithDefaultsFile{version_num}"
+ params.append((runtime, version, test_project))
+ return params
+
+
+def get_custom_runtime_test_params():
+ """Generate test parameters from DOTNET_RUNTIMES for custom runtime builds.
+
+ Note: dotnet6 is excluded as it doesn't support custom runtime in the same way.
+ """
+ params = []
+ for runtime in DOTNET_RUNTIMES:
+ if runtime == "dotnet6":
+ continue
+ version_num = runtime.replace("dotnet", "")
+ version = f"{version_num}.0"
+ test_project = f"CustomRuntime{version_num}"
+ params.append((runtime, version, test_project))
+ return params
class TestDotnetBase(TestCase):
@@ -57,12 +85,7 @@ class TestDotnet(TestDotnetBase):
def setUp(self):
super(TestDotnet, self).setUp()
- @parameterized.expand(
- [
- ("dotnet6", "6.0", "WithDefaultsFile6"),
- ("dotnet8", "8.0", "WithDefaultsFile8"),
- ]
- )
+ @parameterized.expand(get_dotnet_test_params())
def test_with_defaults_file(self, runtime, version, test_project):
source_dir = os.path.join(self.TEST_DATA_FOLDER, test_project)
@@ -83,12 +106,7 @@ def test_with_defaults_file(self, runtime, version, test_project):
self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version)
- @parameterized.expand(
- [
- ("dotnet6", "6.0", "WithDefaultsFile6"),
- ("dotnet8", "8.0", "WithDefaultsFile8"),
- ]
- )
+ @parameterized.expand(get_dotnet_test_params())
def test_with_defaults_file_x86(self, runtime, version, test_project):
source_dir = os.path.join(self.TEST_DATA_FOLDER, test_project)
@@ -109,12 +127,7 @@ def test_with_defaults_file_x86(self, runtime, version, test_project):
self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version)
- @parameterized.expand(
- [
- ("dotnet6", "6.0", "WithDefaultsFile6"),
- ("dotnet8", "8.0", "WithDefaultsFile8"),
- ]
- )
+ @parameterized.expand(get_dotnet_test_params())
def test_with_defaults_file_arm64(self, runtime, version, test_project):
source_dir = os.path.join(self.TEST_DATA_FOLDER, test_project)
@@ -135,12 +148,7 @@ def test_with_defaults_file_arm64(self, runtime, version, test_project):
self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64", version)
- @parameterized.expand(
- [
- # ("dotnet6", "6.0", "CustomRuntime6"),
- ("dotnet8", "8.0", "CustomRuntime8"),
- ]
- )
+ @parameterized.expand(get_custom_runtime_test_params())
def test_with_custom_runtime(self, runtime, version, test_project):
source_dir = os.path.join(self.TEST_DATA_FOLDER, test_project)
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/CustomRuntime10.csproj b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/CustomRuntime10.csproj
new file mode 100644
index 000000000..86c19ed69
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/CustomRuntime10.csproj
@@ -0,0 +1,17 @@
+
+
+ Exe
+ net10.0
+ enable
+ enable
+ Lambda
+ bootstrap
+ true
+ true
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/Function.cs b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/Function.cs
new file mode 100644
index 000000000..4067b0e22
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/Function.cs
@@ -0,0 +1,21 @@
+using Amazon.Lambda.Core;
+using Amazon.Lambda.RuntimeSupport;
+using Amazon.Lambda.Serialization.SystemTextJson;
+
+namespace CustomRuntime10;
+
+public class Function
+{
+ private static async Task Main(string[] args)
+ {
+ Func handler = FunctionHandler;
+ await LambdaBootstrapBuilder.Create(handler, new DefaultLambdaJsonSerializer())
+ .Build()
+ .RunAsync();
+ }
+
+ public static string FunctionHandler(string input, ILambdaContext context)
+ {
+ return input.ToUpper();
+ }
+}
\ No newline at end of file
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/aws-lambda-tools-defaults.json b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/aws-lambda-tools-defaults.json
new file mode 100644
index 000000000..bbac6be41
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime10/aws-lambda-tools-defaults.json
@@ -0,0 +1,16 @@
+{
+ "Information": [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+ "dotnet lambda help",
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+ "profile": "",
+ "region": "",
+ "configuration": "Release",
+ "function-runtime": "provided.al2023",
+ "function-memory-size": 256,
+ "function-timeout": 30,
+ "function-handler": "bootstrap",
+ "msbuild-parameters": "--self-contained true"
+}
\ No newline at end of file
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime8/Function.cs b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime8/Function.cs
index 0bbad05ac..1e58321f7 100644
--- a/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime8/Function.cs
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/CustomRuntime8/Function.cs
@@ -2,7 +2,7 @@
using Amazon.Lambda.RuntimeSupport;
using Amazon.Lambda.Serialization.SystemTextJson;
-namespace CustomRuntime6;
+namespace CustomRuntime8;
public class Function
{
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/Function.cs b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/Function.cs
new file mode 100644
index 000000000..23fc86994
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/Function.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+using Amazon.Lambda.Core;
+
+// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
+[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
+
+namespace WithDefaultsFile
+{
+ public class Function
+ {
+
+ ///
+ /// A simple function that takes a string and does a ToUpper
+ ///
+ ///
+ ///
+ ///
+ public string FunctionHandler(string input, ILambdaContext context)
+ {
+ return input?.ToUpper();
+ }
+ }
+}
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/WithDefaultsFile.csproj b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/WithDefaultsFile.csproj
new file mode 100644
index 000000000..36d1bbb87
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/WithDefaultsFile.csproj
@@ -0,0 +1,11 @@
+
+
+ net10.0
+ true
+ Lambda
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/aws-lambda-tools-defaults.json b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/aws-lambda-tools-defaults.json
new file mode 100644
index 000000000..c9e3e935b
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile10/aws-lambda-tools-defaults.json
@@ -0,0 +1,16 @@
+{
+ "Information": [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+ "dotnet lambda help",
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+ "profile": "",
+ "region": "",
+ "configuration": "Release",
+ "framework": "net10.0",
+ "function-runtime": "dotnet10",
+ "function-memory-size": 256,
+ "function-timeout": 30,
+ "function-handler": "WithDefaultsFile::WithDefaultsFile.Function::FunctionHandler"
+}
\ No newline at end of file