Skip to content

Commit

Permalink
chore(tools): add a tool to update lambda integration test cases to t…
Browse files Browse the repository at this point in the history
…est runtime build images (#32267)

### Reason for this change

This change to auto update the integration test cases for Lambda functions to make sure that SAM Build images we use to build functions are available.

### Description of changes

- Add a tool to check Lambda function runtimes, and update Python, NodeJs, and Go lambda function test cases to test new runtimes.
- Add a Github action to run this tool to auto update the Lambda functions test cases to make sure it will be updated even if contributors missed to execute it.
- 
### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
moelasmar authored Nov 26, 2024
1 parent c77536f commit 0153da4
Show file tree
Hide file tree
Showing 50 changed files with 78,145 additions and 15,294 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/lambda-runtime-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lambda Runtime Tests Update
on:
pull_request:
paths:
- 'packages/aws-cdk-lib/aws-lambda/lib/runtime.ts'

jobs:
update-lambda-tests:
if: github.repository == 'aws/aws-cdk'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "*"
env:
NODE_OPTIONS: "--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"

- name: Install dependencies
run: yarn install --frozen-lockfile && cd tools/@aws-cdk/lambda-integration-test-updater && yarn build+test

- name: Update Lambda Runtime Tests
run: |
cd tools/@aws-cdk/lambda-integration-test-updater
./bin/update-lambda-runtimestes-integ-testing
- name: Check for changes
id: git-check
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit & Push changes
if: steps.git-check.outputs.changes == 'true'
run: |
git config --global user.name 'aws-cdk-automation'
git config --global user.email 'aws-cdk-automation@users.noreply.github.com'
git add .
git commit -m "chore: update lambda runtime integration tests"
git push origin ${{ github.event.pull_request.head.ref }}
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"tools/@aws-cdk/spec2cdk",
"tools/@aws-cdk/yarn-cling",
"tools/@aws-cdk/lazify",
"tools/@aws-cdk/lambda-integration-test-updater",
"scripts/@aws-cdk/script-tests"
],
"rejectCycles": true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"tools/@aws-cdk/spec2cdk",
"tools/@aws-cdk/yarn-cling",
"tools/@aws-cdk/lazify",
"tools/@aws-cdk/lambda-integration-test-updater",
"scripts/@aws-cdk/script-tests"
],
"nohoist": [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0153da4

Please sign in to comment.