Skip to content

Commit

Permalink
chore: Deprecate nodejs12.x and nodejs14.x (#614)
Browse files Browse the repository at this point in the history
* chore: Deprecate nodejs12.x and nodejs14.x

* Update esbuild targets to node20
  • Loading branch information
mildaniel authored Feb 7, 2024
1 parent f11d2a5 commit 1c3a0d2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 64 deletions.
2 changes: 0 additions & 2 deletions aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
LOG = logging.getLogger(__name__)

SUPPORTED_RUNTIMES = {
"nodejs12.x": [ARM64, X86_64],
"nodejs14.x": [ARM64, X86_64],
"nodejs16.x": [ARM64, X86_64],
"nodejs18.x": [ARM64, X86_64],
"nodejs20.x": [ARM64, X86_64],
Expand Down
54 changes: 24 additions & 30 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",), ("nodejs20.x",)])
@parameterized.expand([("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",), ("nodejs20.x",)])
@parameterized.expand([("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",), ("nodejs20.x",)])
@parameterized.expand([("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",), ("nodejs20.x",)])
@parameterized.expand([("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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -134,18 +134,12 @@ def test_builds_project_with_npmrc(self, runtime):

@parameterized.expand(
[
("nodejs12.x", "package-lock"),
("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"),
Expand Down Expand Up @@ -175,7 +169,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -190,7 +184,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -208,7 +202,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -238,7 +232,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",), ("nodejs20.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_remote_dependencies_without_download_dependencies_without_dependencies_dir(
self, runtime
):
Expand All @@ -259,7 +253,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -286,7 +280,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -315,7 +309,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",), ("nodejs20.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_build_in_source_with_removed_dependencies(self, runtime):
# run a build with default requirements and confirm dependencies are downloaded
source_dir = os.path.join(self.temp_testdata_dir, "npm-deps")
Expand Down Expand Up @@ -355,7 +349,7 @@ def test_build_in_source_with_removed_dependencies(self, runtime):
self.assertIn(".package-lock.json", set(os.listdir(source_node_modules)))
self.assertNotIn("minimal-request-promise", set(os.listdir(source_node_modules)))

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -384,7 +378,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -419,7 +413,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",), ("nodejs20.x",)])
@parameterized.expand([("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 @@ -452,7 +446,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",), ("nodejs20.x",)])
@parameterized.expand([("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 Expand Up @@ -508,7 +502,7 @@ def test_build_in_source_reuse_saved_dependencies_dir(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([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root(self, runtime):
base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root")
source_dir = os.path.join(base_dir, "src")
Expand All @@ -531,7 +525,7 @@ def test_builds_project_with_manifest_outside_root(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([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_with_reuse_saved_dependencies_dir(self, runtime):
base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root")
source_dir = os.path.join(base_dir, "src")
Expand Down Expand Up @@ -578,7 +572,7 @@ def test_builds_project_with_manifest_outside_root_with_reuse_saved_dependencies
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([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_not_combine(self, runtime):
base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root")
source_dir = os.path.join(base_dir, "src")
Expand All @@ -603,7 +597,7 @@ def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_not
dependencies_dir_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules")))
self.assertEqual(expected_modules, dependencies_dir_modules)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_combine(self, runtime):
base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root")
source_dir = os.path.join(base_dir, "src")
Expand Down Expand Up @@ -632,7 +626,7 @@ def test_builds_project_with_manifest_outside_root_with_dependencies_dir_and_com
dependencies_dir_modules = set(os.listdir(os.path.join(self.dependencies_dir, "node_modules")))
self.assertEqual(expected_modules, dependencies_dir_modules)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_and_local_dependencies(self, runtime):
base_dir = os.path.join(self.temp_testdata_dir, "manifest-outside-root-with-local-dependency")
source_dir = os.path.join(base_dir, "src")
Expand Down Expand Up @@ -660,7 +654,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies(self,
source_modules = set(os.listdir(os.path.join(source_dir, "node_modules")))
self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules))

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_reuse_saved_dependencies_dir(
self, runtime
):
Expand Down Expand Up @@ -715,7 +709,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_r
source_modules = set(os.listdir(os.path.join(source_dir, "node_modules")))
self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules))

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_dependencies_dir_and_not_combine(
self, runtime
):
Expand Down Expand Up @@ -747,7 +741,7 @@ def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_d
source_modules = set(os.listdir(os.path.join(source_dir, "node_modules")))
self.assertTrue(all(expected_module in source_modules for expected_module in expected_modules))

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
@parameterized.expand([("nodejs16.x",), ("nodejs18.x",), ("nodejs20.x",)])
def test_builds_project_with_manifest_outside_root_and_local_dependencies_with_dependencies_dir_and_combine(
self, runtime
):
Expand Down
Loading

0 comments on commit 1c3a0d2

Please sign in to comment.