Skip to content

Commit f18b9ca

Browse files
authored
feat: add ruby4.0 runtime (#8931)
* feat: add ruby4.0 runtime * fix: add extra ruby4.0 references
1 parent fdf769d commit f18b9ca

8 files changed

Lines changed: 21 additions & 12 deletions

File tree

samcli/commands/build/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
------------------
6060
1. Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 using PIP\n
6161
2. Nodejs 24.x, 22.x, 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
62-
3. Ruby 3.2, 3.3, 3.4 using Bundler\n
62+
3. Ruby 3.2, 3.3, 3.4, 4.0 using Bundler\n
6363
4. Java 8, Java 11, Java 17, Java 21, Java 25 using Gradle and Maven\n
6464
5. Dotnet6, Dotnet8, Dotnet10 using Dotnet CLI\n
6565
6. Go 1.x using Go Modules (without --use-container)\n

samcli/lib/build/workflow_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def get_layer_subfolder(build_workflow: str) -> str:
102102
"ruby3.2": "ruby/lib",
103103
"ruby3.3": "ruby/lib",
104104
"ruby3.4": "ruby/lib",
105+
"ruby4.0": "ruby/lib",
105106
"java11": "java",
106107
"java8.al2": "java",
107108
"java17": "java",
@@ -175,6 +176,7 @@ def get_workflow_config(
175176
"ruby3.2": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
176177
"ruby3.3": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
177178
"ruby3.4": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
179+
"ruby4.0": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
178180
"dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
179181
"dotnet8": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
180182
"dotnet10": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),

samcli/lib/utils/architecture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"ruby3.2": [ARM64, X86_64],
3131
"ruby3.3": [ARM64, X86_64],
3232
"ruby3.4": [ARM64, X86_64],
33+
"ruby4.0": [ARM64, X86_64],
3334
"java8.al2": [ARM64, X86_64],
3435
"java11": [ARM64, X86_64],
3536
"java17": [ARM64, X86_64],

samcli/local/common/runtime_template.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
],
3333
"ruby": [
3434
{
35-
"runtimes": ["ruby3.4", "ruby3.3", "ruby3.2"],
35+
"runtimes": ["ruby4.0", "ruby3.4", "ruby3.3", "ruby3.2"],
3636
"dependency_manager": "bundler",
3737
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-ruby"),
3838
"build": True,
@@ -137,6 +137,7 @@ def get_local_lambda_images_location(mapping, runtime):
137137
"python3.9",
138138
"python3.8",
139139
# ruby runtimes in descending order
140+
"ruby4.0",
140141
"ruby3.4",
141142
"ruby3.3",
142143
"ruby3.2",
@@ -167,6 +168,7 @@ def get_local_lambda_images_location(mapping, runtime):
167168
"python3.10": "amazon/python3.10-base",
168169
"python3.9": "amazon/python3.9-base",
169170
"python3.8": "amazon/python3.8-base",
171+
"ruby4.0": "amazon/ruby4.0-base",
170172
"ruby3.4": "amazon/ruby3.4-base",
171173
"ruby3.3": "amazon/ruby3.3-base",
172174
"ruby3.2": "amazon/ruby3.2-base",

samcli/local/docker/lambda_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Runtime(Enum):
5656
ruby32 = "ruby3.2"
5757
ruby33 = "ruby3.3"
5858
ruby34 = "ruby3.4"
59+
ruby40 = "ruby4.0"
5960
java8al2 = "java8.al2"
6061
java11 = "java11"
6162
java17 = "java17"

schema/samcli.json

Lines changed: 11 additions & 8 deletions
Large diffs are not rendered by default.

tests/integration/buildcmd/test_build_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def _prepare_application_environment(self, runtime):
395395
└── template.yaml
396396
"""
397397
# copy .ruby-version to the root of the project
398-
ruby_runtime_path = runtime.replace(".", "").title() # ruby3.X to Ruby3X
398+
ruby_runtime_path = runtime.replace(".", "").title() # rubyX.Y to RubyXY
399399
shutil.copyfile(
400400
Path(self.template_path).parent.joinpath(ruby_runtime_path, ".ruby-version"),
401401
Path(self.working_dir).joinpath(".ruby-version"),

tests/unit/lib/build_module/test_workflow_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_raise_exception_for_bad_specified_workflow(self, runtime):
121121
with self.assertRaises(UnsupportedBuilderException):
122122
get_workflow_config(runtime, self.code_dir, self.project_dir, specified_workflow="Wrong")
123123

124-
@parameterized.expand([("ruby3.2",), ("ruby3.3",), ("ruby3.4",)])
124+
@parameterized.expand([("ruby3.2",), ("ruby3.3",), ("ruby3.4",), ("ruby4.0",)])
125125
def test_must_work_for_ruby(self, runtime):
126126
result = get_workflow_config(runtime, self.code_dir, self.project_dir)
127127
self.assertEqual(result.language, "ruby")

0 commit comments

Comments
 (0)