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 Jan 25, 2023
2 parents 2d5f583 + 40cbfa5 commit 036cbf5
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create an issue to report a bug for AWS Lambda Builders
title: "Bug: TITLE"
labels: ['type/bug', 'stage/needs-triage']
labels: ['stage/needs-triage']
assignees: ''

---
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "develop", main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "develop" ]
schedule:
- cron: '44 21 * * 2'

jobs:
analyze:
name: Analyze
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
statuses: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

# Changing version will trigger a new release!
# Please make the version change as the last step of your development.
__version__ = "1.24.0"
__version__ = "1.25.0"
RPC_PROTOCOL_VERSION = "0.3"
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def run(self, args, cwd=None):
SUPPORTED_ESBUILD_APIS_MULTI_VALUE = [
"external",
"loader",
"out_extension",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import tempfile
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch

from aws_lambda_builders.builder import LambdaBuilder
from aws_lambda_builders.exceptions import WorkflowFailedError
Expand Down Expand Up @@ -32,7 +31,7 @@ def setUp(self):
def _set_esbuild_binary_path(self):
npm = SubprocessNpm(self.osutils)
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
npm.run(["ci"], cwd=esbuild_dir)
npm.run(["install"], cwd=esbuild_dir)
self.root_path = npm.run(["root"], cwd=esbuild_dir)
self.binpath = Path(self.root_path, ".bin")

Expand Down Expand Up @@ -169,7 +168,7 @@ def test_bundles_project_without_dependencies(self, runtime):
osutils = OSUtils()
npm = SubprocessNpm(osutils)
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
npm.run(["ci"], cwd=esbuild_dir)
npm.run(["install"], cwd=esbuild_dir)
binpath = Path(npm.run(["root"], cwd=esbuild_dir), ".bin")

self.builder.build(
Expand All @@ -195,7 +194,7 @@ def test_builds_project_with_remote_dependencies_without_download_dependencies_w
osutils = OSUtils()
npm = SubprocessNpm(osutils)
esbuild_dir = os.path.join(self.TEST_DATA_FOLDER, "esbuild-binary")
npm.run(["ci"], cwd=esbuild_dir)
npm.run(["install"], cwd=esbuild_dir)
binpath = Path(npm.run(["root"], cwd=esbuild_dir), ".bin")

self.builder.build(
Expand Down Expand Up @@ -388,3 +387,23 @@ def test_includes_sourcemap_if_requested(self, runtime):
expected_files = {"included.js", "included.js.map"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)

@parameterized.expand([("nodejs12.x",), ("nodejs14.x",), ("nodejs16.x",), ("nodejs18.x",)])
def test_esbuild_produces_mjs_output_files(self, runtime):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps-esbuild")
options = {"entry_points": ["included.js"], "sourcemap": True, "out_extension": [".js=.mjs"]}

self.builder.build(
source_dir,
self.artifacts_dir,
self.scratch_dir,
os.path.join(source_dir, "package.json"),
runtime=runtime,
options=options,
experimental_flags=[],
executable_search_paths=[self.binpath],
)

expected_files = {"included.mjs", "included.mjs.map"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEqual(expected_files, output_files)
2 changes: 2 additions & 0 deletions tests/unit/workflows/nodejs_npm_esbuild/test_esbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def test_builds_args_from_config(self, osutils_mock):
"target": "node14",
"loader": [".proto=text", ".json=js"],
"external": ["aws-sdk", "axios"],
"out_extension": [".js=.mjs"],
"main_fields": "module,main",
}

Expand All @@ -219,6 +220,7 @@ def test_builds_args_from_config(self, osutils_mock):
"--external:axios",
"--loader:.proto=text",
"--loader:.json=js",
"--out-extension:.js=.mjs",
],
)

Expand Down

0 comments on commit 036cbf5

Please sign in to comment.