Skip to content

Commit 3257a8f

Browse files
authored
Merge pull request #315 from aws/develop
release: 1.10.0
2 parents b3c5d7d + f95a043 commit 3257a8f

File tree

8 files changed

+88
-4
lines changed

8 files changed

+88
-4
lines changed

.github/labeler.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
area/workflow/dotnet_clipackage:
2+
- aws_lambda_builders/workflows/dotnet_clipacakge/*
3+
- aws_lambda_builders/workflows/dotnet_clipacakge/**/*
4+
5+
area/workflow/go_modules:
6+
- aws_lambda_builders/workflows/go_modules/*
7+
- aws_lambda_builders/workflows/go_modules/**/*
8+
9+
area/workflow/java_gradle:
10+
- aws_lambda_builders/workflows/java_gradle/*
11+
- aws_lambda_builders/workflows/java_gradle/**/*
12+
13+
area/workflow/java_maven:
14+
- aws_lambda_builders/workflows/java_maven/*
15+
- aws_lambda_builders/workflows/java_maven/**/*
16+
17+
area/workflow/node_npm:
18+
- aws_lambda_builders/workflows/nodejs_npm/*
19+
- aws_lambda_builders/workflows/nodejs_npm/**/*
20+
21+
area/workflow/python_pip:
22+
- aws_lambda_builders/workflows/python_pip/*
23+
- aws_lambda_builders/workflows/python_pip/**/*
24+
25+
area/workflow/ruby_bundler:
26+
- aws_lambda_builders/workflows/ruby_bundler/*
27+
- aws_lambda_builders/workflows/ruby_bundler/**/*

.github/workflows/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This folder has Github Actions for this repo.
2+
3+
** pr-labler **
4+
5+
This is responsible for tagging our prs automattically. The primary thing it does is tags internal vs external (to the team) PRs. It will
6+
also tag PRs with `area/*` tags based upon the files being changes in the PR. This is run on `pull_request_target` which only runs what is
7+
in the repo not what is in the Pull Request. This is done to help guard against a PR running and changing. For this, the Action should NEVER
8+
download or checkout the PR. It is purely for tagging/labeling not CI.

.github/workflows/pr-labeler.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
pull_request_target:
4+
types: [opened]
5+
6+
jobs:
7+
apply-file-based-labels:
8+
permissions:
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@v3
13+
with:
14+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
15+
apply-internal-external-label:
16+
permissions:
17+
pull-requests: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/github-script@v5
21+
with:
22+
github-token: ${{secrets.GITHUB_TOKEN}}
23+
script: |
24+
const maintainers = ['jfuss', 'c2tarun', 'hoffa', 'awood45', 'CoshUS', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko', 'wchengru', 'mingkun2020', 'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1']
25+
if (maintainers.includes(context.payload.sender.login)) {
26+
github.rest.issues.addLabels({
27+
issue_number: context.issue.number,
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
labels: ['pr/internal']
31+
})
32+
} else {
33+
github.rest.issues.addLabels({
34+
issue_number: context.issue.number,
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
labels: ['pr/external']
38+
})
39+
}

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
22
AWS Lambda Builder Library
33
"""
4-
__version__ = "1.9.0"
4+
__version__ = "1.10.0"
55
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/actions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def execute(self):
136136
if os.path.isdir(dependencies_source):
137137
copytree(dependencies_source, new_destination)
138138
else:
139+
os.makedirs(os.path.dirname(dependencies_source), exist_ok=True)
139140
shutil.copy2(dependencies_source, new_destination)
140141

141142

aws_lambda_builders/workflows/java/actions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def _move_dependencies(self):
5959
Move the entire lib directory from artifact folder to dependencies folder
6060
"""
6161
try:
62+
dependencies_lib_dir = os.path.join(self.dependencies_dir, "lib")
6263
lib_folder = os.path.join(self.artifacts_dir, "lib")
63-
self.os_utils.move(lib_folder, self.dependencies_dir)
64+
self.os_utils.move(lib_folder, dependencies_lib_dir)
6465
except Exception as ex:
6566
raise ActionFailedError(str(ex))

tests/unit/test_actions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,32 @@ def test_must_copy(self, copytree_mock):
6262

6363

6464
class TestCopyDependenciesAction_execute(TestCase):
65+
@patch("aws_lambda_builders.actions.os.makedirs")
66+
@patch("aws_lambda_builders.actions.os.path.dirname")
6567
@patch("aws_lambda_builders.actions.shutil.copy2")
6668
@patch("aws_lambda_builders.actions.copytree")
6769
@patch("aws_lambda_builders.actions.os.path.isdir")
6870
@patch("aws_lambda_builders.actions.os.listdir")
6971
@patch("aws_lambda_builders.actions.os.path.join")
70-
def test_must_copy(self, path_mock, listdir_mock, isdir_mock, copytree_mock, copy2_mock):
72+
def test_must_copy(
73+
self, path_mock, listdir_mock, isdir_mock, copytree_mock, copy2_mock, dirname_mock, makedirs_mock
74+
):
7175
source_dir = "source"
7276
artifact_dir = "artifact"
7377
dest_dir = "dest"
7478

7579
listdir_mock.side_effect = [[1], [1, 2, 3]]
7680
path_mock.side_effect = ["dir1", "dir2", "file1", "file2"]
7781
isdir_mock.side_effect = [True, False]
82+
dirname_mock.side_effect = ["parent_dir_1"]
7883
action = CopyDependenciesAction(source_dir, artifact_dir, dest_dir)
7984
action.execute()
8085

8186
listdir_mock.assert_any_call(source_dir)
8287
listdir_mock.assert_any_call(artifact_dir)
8388
copytree_mock.assert_called_once_with("dir1", "dir2")
8489
copy2_mock.assert_called_once_with("file1", "file2")
90+
makedirs_mock.assert_called_once_with("parent_dir_1", exist_ok=True)
8591

8692

8793
class TestMoveDependenciesAction_execute(TestCase):

tests/unit/workflows/java/test_actions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def test_copies_artifacts(self):
4646
action = JavaMoveDependenciesAction(self.artifacts_dir, self.dependencies_dir, self.os_utils)
4747
action.execute()
4848

49-
self.os_utils.move.assert_called_with(os.path.join(self.artifacts_dir, "lib"), self.dependencies_dir)
49+
self.os_utils.move.assert_called_with(
50+
os.path.join(self.artifacts_dir, "lib"), os.path.join(self.dependencies_dir, "lib")
51+
)
5052

5153
def test_error_in_artifact_copy_raises_action_error(self):
5254
self.os_utils.move.side_effect = Exception("scandir failed!")

0 commit comments

Comments
 (0)