diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 974b4fcab0..280539f094 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,6 +119,9 @@ jobs: - uses: ruby/setup-ruby@v1 with: ruby-version: "2.7" + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" - uses: actions/setup-node@v3 with: node-version: 18 diff --git a/samcli/commands/build/command.py b/samcli/commands/build/command.py index 8780b85069..b8ba89052a 100644 --- a/samcli/commands/build/command.py +++ b/samcli/commands/build/command.py @@ -38,7 +38,7 @@ """ DESCRIPTION = """ - Build AWS serverless function code to generate artifacts targeting + Build AWS serverless function code to generate artifacts targeting AWS Lambda execution environment.\n \b Supported Resource Types @@ -52,7 +52,7 @@ ------------------ 1. Python 3.7, 3.8, 3.9, 3.10 using PIP\n 2. Nodejs 18.x, 16.x, 14.x, 12.x using NPM\n - 3. Ruby 2.7 using Bundler\n + 3. Ruby 2.7, 3.2 using Bundler\n 4. Java 8, Java 11, Java 17 using Gradle and Maven\n 5. Dotnetcore 3.1, Dotnet6 using Dotnet CLI (without --use-container)\n 6. Go 1.x using Go Modules (without --use-container)\n diff --git a/samcli/lib/build/workflow_config.py b/samcli/lib/build/workflow_config.py index a6a9399f45..39ea1acad7 100644 --- a/samcli/lib/build/workflow_config.py +++ b/samcli/lib/build/workflow_config.py @@ -97,6 +97,7 @@ def get_layer_subfolder(build_workflow: str) -> str: "nodejs16.x": "nodejs", "nodejs18.x": "nodejs", "ruby2.7": "ruby/lib", + "ruby3.2": "ruby/lib", "java8": "java", "java11": "java", "java8.al2": "java", @@ -159,6 +160,7 @@ def get_workflow_config( "nodejs16.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG), "nodejs18.x": BasicWorkflowSelector(NODEJS_NPM_CONFIG), "ruby2.7": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG), + "ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG), "dotnetcore3.1": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG), "dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG), "go1.x": BasicWorkflowSelector(GO_MOD_CONFIG), diff --git a/samcli/lib/utils/architecture.py b/samcli/lib/utils/architecture.py index 05fb721a29..470754b2c1 100644 --- a/samcli/lib/utils/architecture.py +++ b/samcli/lib/utils/architecture.py @@ -23,6 +23,7 @@ "python3.9": [ARM64, X86_64], "python3.10": [ARM64, X86_64], "ruby2.7": [ARM64, X86_64], + "ruby3.2": [ARM64, X86_64], "java8": [X86_64], "java8.al2": [ARM64, X86_64], "java11": [ARM64, X86_64], diff --git a/samcli/lib/utils/preview_runtimes.py b/samcli/lib/utils/preview_runtimes.py index c17ae95cf8..17e15f456e 100644 --- a/samcli/lib/utils/preview_runtimes.py +++ b/samcli/lib/utils/preview_runtimes.py @@ -4,4 +4,4 @@ """ from typing import Set -PREVIEW_RUNTIMES: Set[str] = set() +PREVIEW_RUNTIMES: Set[str] = {"ruby3.2"} diff --git a/samcli/local/common/runtime_template.py b/samcli/local/common/runtime_template.py index 92f4d7bd6f..85eb282a90 100644 --- a/samcli/local/common/runtime_template.py +++ b/samcli/local/common/runtime_template.py @@ -24,7 +24,7 @@ ], "ruby": [ { - "runtimes": ["ruby2.7"], + "runtimes": ["ruby3.2", "ruby2.7"], "dependency_manager": "bundler", "init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-ruby"), "build": True, @@ -119,6 +119,7 @@ def get_local_lambda_images_location(mapping, runtime): "python3.8", "python3.7", # ruby runtimes in descending order + "ruby3.2", "ruby2.7", ] @@ -140,6 +141,7 @@ def get_local_lambda_images_location(mapping, runtime): "python3.9": "amazon/python3.9-base", "python3.8": "amazon/python3.8-base", "python3.7": "amazon/python3.7-base", + "ruby3.2": "amazon/ruby3.2-base", "ruby2.7": "amazon/ruby2.7-base", } diff --git a/samcli/local/docker/lambda_image.py b/samcli/local/docker/lambda_image.py index 922c18b0cb..309ff91346 100644 --- a/samcli/local/docker/lambda_image.py +++ b/samcli/local/docker/lambda_image.py @@ -39,6 +39,7 @@ class Runtime(Enum): python39 = "python3.9" python310 = "python3.10" ruby27 = "ruby2.7" + ruby32 = "ruby3.2" java8 = "java8" java8al2 = "java8.al2" java11 = "java11" diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py index e170456c06..e9e0f34d3d 100644 --- a/tests/integration/buildcmd/test_build_cmd.py +++ b/tests/integration/buildcmd/test_build_cmd.py @@ -637,13 +637,13 @@ def test_building_default_package_json(self, runtime, use_container, architectur class TestBuildCommand_RubyFunctions(BuildIntegRubyBase): - @parameterized.expand(["ruby2.7"]) + @parameterized.expand(["ruby2.7", "ruby3.2"]) @pytest.mark.flaky(reruns=3) @skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE) def test_building_ruby_in_container(self, runtime): self._test_with_default_gemfile(runtime, "use_container", "Ruby", self.test_data_path) - @parameterized.expand(["ruby2.7"]) + @parameterized.expand(["ruby2.7", "ruby3.2"]) @pytest.mark.flaky(reruns=3) def test_building_ruby_in_process(self, runtime): self._test_with_default_gemfile(runtime, False, "Ruby", self.test_data_path) @@ -652,13 +652,13 @@ def test_building_ruby_in_process(self, runtime): class TestBuildCommand_RubyFunctions_With_Architecture(BuildIntegRubyBase): template = "template_with_architecture.yaml" - @parameterized.expand(["ruby2.7", ("ruby2.7", "arm64")]) + @parameterized.expand(["ruby2.7", ("ruby2.7", "arm64"), "ruby3.2", ("ruby3.2", "arm64")]) @pytest.mark.flaky(reruns=3) @skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE) def test_building_ruby_in_container_with_specified_architecture(self, runtime, architecture="x86_64"): self._test_with_default_gemfile(runtime, "use_container", "Ruby", self.test_data_path, architecture) - @parameterized.expand(["ruby2.7", ("ruby2.7", "arm64")]) + @parameterized.expand(["ruby2.7", ("ruby2.7", "arm64"), "ruby3.2", ("ruby3.2", "arm64")]) @pytest.mark.flaky(reruns=3) def test_building_ruby_in_process_with_specified_architecture(self, runtime, architecture="x86_64"): self._test_with_default_gemfile(runtime, False, "Ruby", self.test_data_path, architecture) @@ -670,7 +670,7 @@ class TestBuildCommand_RubyFunctionsWithGemfileInTheRoot(BuildIntegRubyBase): This doesn't apply to containerized build, since it copies only the function folder to the container """ - @parameterized.expand([("ruby2.7")]) + @parameterized.expand([("ruby2.7"), ("ruby3.2")]) @pytest.mark.flaky(reruns=3) def test_building_ruby_in_process_with_root_gemfile(self, runtime): self._prepare_application_environment() diff --git a/tests/unit/commands/init/test_cli.py b/tests/unit/commands/init/test_cli.py index b936df87c1..65ff97a31b 100644 --- a/tests/unit/commands/init/test_cli.py +++ b/tests/unit/commands/init/test_cli.py @@ -2126,6 +2126,7 @@ def test_must_return_runtime_from_base_image_name(self): "amazon/python3.8-base", "amazon/ruby2.7-base", "amazon/go-provided.al2-base", + "amazon/ruby3.2-base", ] expected_runtime = [ @@ -2137,6 +2138,7 @@ def test_must_return_runtime_from_base_image_name(self): "python3.8", "ruby2.7", "go (provided.al2)", + "ruby3.2", ] for index, base_image in enumerate(base_images): @@ -2786,9 +2788,9 @@ def test_init_cli_generate_app_template_from_local_cli_templates( @patch("samcli.local.common.runtime_template.INIT_RUNTIMES") def test_must_remove_unsupported_runtime(self, init_runtime_mock): - runtime_option_list = ["python3.7", "ruby2.7", "java11", "unsupported_runtime", "dotnetcore3.1"] - init_runtime_mock.return_value = ["dotnetcore3.1", "go1.x", "java11", "python3.7", "ruby2.7"] - expect_result = ["dotnetcore3.1", "java11", "python3.7", "ruby2.7"] + runtime_option_list = ["python3.7", "ruby3.2", "ruby2.7", "java11", "unsupported_runtime", "dotnetcore3.1"] + init_runtime_mock.return_value = ["dotnetcore3.1", "go1.x", "java11", "python3.7", "ruby3.2", "ruby2.7"] + expect_result = ["dotnetcore3.1", "java11", "python3.7", "ruby3.2", "ruby2.7"] actual_result = get_sorted_runtimes(runtime_option_list) self.assertEqual(actual_result, expect_result) diff --git a/tests/unit/local/docker/test_lambda_image.py b/tests/unit/local/docker/test_lambda_image.py index f0f0c7fec0..3ad8a10c54 100644 --- a/tests/unit/local/docker/test_lambda_image.py +++ b/tests/unit/local/docker/test_lambda_image.py @@ -27,6 +27,7 @@ class TestRuntime(TestCase): ("python3.8", "python:3.8-x86_64"), ("python3.9", "python:3.9-x86_64"), ("ruby2.7", "ruby:2.7-x86_64"), + ("ruby3.2", "ruby:3.2-x86_64"), ("java8", "java:8"), ("java8.al2", "java:8.al2-x86_64"), ("java11", "java:11-x86_64"),