Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-sam-cli-bot committed Mar 4, 2024
2 parents f81fc29 + 14fce21 commit 0e774da
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
# Changing version will trigger a new release!
# Please make the version change as the last step of your development.

__version__ = "1.46.0"
__version__ = "1.47.0"
RPC_PROTOCOL_VERSION = "0.3"
7 changes: 6 additions & 1 deletion aws_lambda_builders/workflows/go_modules/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def __init__(
handler = options.get("artifact_executable_name", None)
trim_go_path = options.get("trim_go_path", False)

output_path = osutils.joinpath(artifacts_dir, handler)
# For provided runtimes, the binary must be named "bootstrap"
output_path = (
osutils.joinpath(artifacts_dir, handler)
if runtime != "provided"
else osutils.joinpath(artifacts_dir, "bootstrap")
)

builder = GoModulesBuilder(
osutils,
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage==7.4.1
coverage==7.4.3
flake8==3.8.4
pytest-cov==4.1.0

Expand All @@ -9,4 +9,4 @@ pyelftools~=0.30 # Used to verify the generated Go binary architecture in integr

# formatter
black==24.2.0
ruff==0.2.1
ruff==0.2.2
17 changes: 17 additions & 0 deletions tests/integration/workflows/go_modules/test_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from pathlib2 import Path

from unittest import TestCase
from parameterized import parameterized


from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.exceptions import WorkflowFailedError
Expand Down Expand Up @@ -196,3 +198,18 @@ def test_builds_project_with_nested_dir(self):
expected_files = {"helloWorld"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("provided", "bootstrap"), ("go1.x", "helloWorld")])
def test_binary_named_bootstrap_for_provided_runtime(self, runtime, expected_binary):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps")
self.builder.build(
source_dir,
self.artifacts_dir,
self.scratch_dir,
os.path.join(source_dir, "go.mod"),
runtime=runtime,
options={"artifact_executable_name": "helloWorld"},
)
expected_files = {expected_binary}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)
15 changes: 15 additions & 0 deletions tests/unit/workflows/go_modules/test_workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from unittest import TestCase
from pathlib import Path

from aws_lambda_builders.workflows.go_modules.workflow import GoModulesWorkflow
from aws_lambda_builders.workflows.go_modules.actions import GoModulesBuildAction
Expand All @@ -24,6 +25,20 @@ def test_workflow_sets_up_builder_actions(self):
self.assertEqual(len(workflow.actions), 1)
self.assertIsInstance(workflow.actions[0], GoModulesBuildAction)

def test_workflow_sets_up_builder_actions_provided(self):
workflow = GoModulesWorkflow(
"source",
"artifacts",
"scratch_dir",
"manifest",
runtime="provided",
options={"artifact_executable_name": "main"},
)

self.assertEqual(len(workflow.actions), 1)
self.assertIsInstance(workflow.actions[0], GoModulesBuildAction)
self.assertEqual(workflow.actions[0].output_path, str(Path("artifacts", "bootstrap")))

def test_must_validate_architecture(self):
workflow = GoModulesWorkflow(
"source",
Expand Down

0 comments on commit 0e774da

Please sign in to comment.