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 Nov 10, 2023
2 parents 7d004a7 + b2609a3 commit 69cd0ca
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 45 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ concurrency:
jobs:
run-workflow:
name: PR Workflow
if: always()
# If any dependent jobs fails, this WF skips which won't block merging PRs
# calling always() is required for this WF to run all the time
if: github.repository_owner == 'aws' && always()
runs-on: ubuntu-latest
needs:
- unit-functional
Expand Down Expand Up @@ -98,9 +100,9 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- if: ${{ matrix.npm }}
run: npm install -g npm@${{ matrix.npm }}
- run: npm --version
Expand Down Expand Up @@ -131,9 +133,9 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- if: ${{ matrix.npm }}
run: npm install -g npm@${{ matrix.npm }}
- run: npm --version
Expand Down
3 changes: 2 additions & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

# Changing version will trigger a new release!
# Please make the version change as the last step of your development.
__version__ = "1.40.0"

__version__ = "1.41.0"
RPC_PROTOCOL_VERSION = "0.3"
1 change: 1 addition & 0 deletions aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"nodejs14.x": [ARM64, X86_64],
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
"python3.7": [X86_64],
"python3.8": [ARM64, X86_64],
"python3.9": [ARM64, X86_64],
Expand Down
19 changes: 16 additions & 3 deletions aws_lambda_builders/workflows/ruby_bundler/bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import logging
from os import linesep

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -54,7 +55,7 @@ def run(self, args, cwd=None):

p = self.osutils.popen(invoke_bundler, stdout=self.osutils.pipe, stderr=self.osutils.pipe, cwd=cwd)

out, _ = p.communicate()
out, err = p.communicate()

if p.returncode != 0:
if p.returncode == GEMFILE_NOT_FOUND:
Expand All @@ -65,7 +66,19 @@ def run(self, args, cwd=None):
if self.osutils.directory_exists(check_dir):
self.osutils.remove_directory(check_dir)
else:
# Bundler has relevant information in stdout, not stderr.
raise BundlerExecutionError(message=out.decode("utf8").strip())
# Bundler can contain information in both stdout and stderr so we check and log both
err_str = err.decode("utf8").strip()
out_str = out.decode("utf8").strip()
if out_str and err_str:
message_out = f"{out_str}{linesep}{err_str}"
LOG.debug(f"Bundler output: {out_str}")
LOG.debug(f"Bundler error: {err_str}")
elif out_str:
message_out = out_str
LOG.debug(f"Bundler output: {out_str}")
else:
message_out = err_str
LOG.debug(f"Bundler error: {err_str}")
raise BundlerExecutionError(message=message_out)

return out.decode("utf8").strip()
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ pyelftools~=0.30 # Used to verify the generated Go binary architecture in integr

# formatter
black==22.6.0; python_version < "3.8"
black==23.9.1; python_version >= "3.8"
ruff==0.0.292
black==23.10.1; python_version >= "3.8"
ruff==0.1.4
33 changes: 18 additions & 15 deletions tests/integration/workflows/nodejs_npm/test_nodejs_npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def tearDown(self):
shutil.rmtree(self.dependencies_dir)
shutil.rmtree(self.temp_dir)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_without_dependencies(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps")

Expand All @@ -57,7 +57,7 @@ def test_builds_project_without_dependencies(self, runtime):
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_without_manifest(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-manifest")

Expand All @@ -75,7 +75,7 @@ def test_builds_project_without_manifest(self, runtime):
mock_warning.assert_called_once_with("package.json file not found. Continuing the build without dependencies.")
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_and_excludes_hidden_aws_sam(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "excluded-files")

Expand All @@ -91,7 +91,7 @@ def test_builds_project_and_excludes_hidden_aws_sam(self, runtime):
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_remote_dependencies(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps")

Expand All @@ -111,7 +111,7 @@ def test_builds_project_with_remote_dependencies(self, runtime):
output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules")))
self.assertEqual(expected_modules, output_modules)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_npmrc(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npmrc")

Expand All @@ -138,14 +138,17 @@ def test_builds_project_with_npmrc(self, runtime):
("nodejs14.x", "package-lock"),
("nodejs16.x", "package-lock"),
("nodejs18.x", "package-lock"),
("nodejs20.x", "package-lock"),
("nodejs12.x", "shrinkwrap"),
("nodejs14.x", "shrinkwrap"),
("nodejs16.x", "shrinkwrap"),
("nodejs18.x", "shrinkwrap"),
("nodejs20.x", "shrinkwrap"),
("nodejs12.x", "package-lock-and-shrinkwrap"),
("nodejs14.x", "package-lock-and-shrinkwrap"),
("nodejs16.x", "package-lock-and-shrinkwrap"),
("nodejs18.x", "package-lock-and-shrinkwrap"),
("nodejs20.x", "package-lock-and-shrinkwrap"),
]
)
def test_builds_project_with_lockfile(self, runtime, dir_name):
Expand All @@ -172,7 +175,7 @@ def test_builds_project_with_lockfile(self, runtime, dir_name):

self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_fails_if_npm_cannot_resolve_dependencies(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "broken-deps")

Expand All @@ -187,7 +190,7 @@ def test_fails_if_npm_cannot_resolve_dependencies(self, runtime):

self.assertIn("No matching version found for aws-sdk@2.997.999", str(ctx.exception))

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_remote_dependencies_without_download_dependencies_with_dependencies_dir(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps")

Expand All @@ -205,7 +208,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_remote_dependencies_with_download_dependencies_and_dependencies_dir(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps")

Expand Down Expand Up @@ -235,7 +238,7 @@ def test_builds_project_with_remote_dependencies_with_download_dependencies_and_
output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir)))
self.assertNotIn(expected_dependencies_files, output_dependencies_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_remote_dependencies_without_download_dependencies_without_dependencies_dir(
self, runtime
):
Expand All @@ -256,7 +259,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_without_combine_dependencies(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps")

Expand All @@ -283,7 +286,7 @@ def test_builds_project_without_combine_dependencies(self, runtime):
output_dependencies_files = set(os.listdir(os.path.join(self.dependencies_dir)))
self.assertNotIn(expected_dependencies_files, output_dependencies_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_with_download_dependencies(self, runtime):
source_dir = os.path.join(self.temp_testdata_dir, "npm-deps")

Expand Down Expand Up @@ -312,7 +315,7 @@ def test_build_in_source_with_download_dependencies(self, runtime):
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_with_download_dependencies_local_dependency(self, runtime):
source_dir = os.path.join(self.temp_testdata_dir, "with-local-dependency")

Expand Down Expand Up @@ -341,7 +344,7 @@ def test_build_in_source_with_download_dependencies_local_dependency(self, runti
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_with_download_dependencies_and_dependencies_dir(self, runtime):
source_dir = os.path.join(self.temp_testdata_dir, "npm-deps")

Expand Down Expand Up @@ -376,7 +379,7 @@ def test_build_in_source_with_download_dependencies_and_dependencies_dir(self, r
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_with_download_dependencies_and_dependencies_dir_without_combine_dependencies(
self, runtime
):
Expand Down Expand Up @@ -409,7 +412,7 @@ def test_build_in_source_with_download_dependencies_and_dependencies_dir_without
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_reuse_saved_dependencies_dir(self, runtime):
source_dir = os.path.join(self.temp_testdata_dir, "npm-deps")

Expand Down
Loading

0 comments on commit 69cd0ca

Please sign in to comment.