Skip to content

Fix(build): e2e workflow failing #1047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,40 @@ jobs:
matrix:
version: [12, 14, 16]
steps:
- name: "Checkout"
- name: Checkout
uses: actions/checkout@v3
- name: "Use NodeJS 14"
- name: Use NodeJS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the house keeping!

uses: actions/setup-node@v3
with:
# Always use version 16 as we use TypeScript target es2020
node-version: 16
- name: "Install [email protected]"
- name: Install [email protected]
run: npm i -g npm@next-8
- name: "Configure AWS credentials"
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: eu-west-1
- name: Cache node modules for commons
id: cache-node-modules
uses: actions/cache@v3
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
# if one of them changes the cache is invalidated/discarded
key: ${{ matrix.version }}-cache-utils-node-modules-${{ hashFiles('./package-lock.json') }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

- name: Install dependencies
# We can skip the install if there was a cache hit
if: steps.cache-node-modules.outputs.cache-hit != 'true'
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
run: npm ci --foreground-scripts
- name: Build packages
# If there's a cache hit we still need to manually build the packages
# this would otherwise have been done automatically as a part of the
# postinstall npm hook
if: steps.cache-node-modules.outputs.cache-hit == 'true'
run: |
npm run build -w packages/commons
- name: "Run layer integration tests"
run: |
npm ci --foreground-scripts
Expand Down
3 changes: 1 addition & 2 deletions layer-publisher/tests/e2e/happy-case.test.lambda.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Logger } from '@aws-lambda-powertools/logger';
import { Metrics } from '@aws-lambda-powertools/metrics';
import { Tracer } from '@aws-lambda-powertools/tracer';
import { Context } from 'aws-lambda';
import fs from 'fs';

const SERVICE_NAME = 'e2e-tests-layer-consumer';
const logger = new Logger({ serviceName: SERVICE_NAME, logLevel: 'DEBUG' });
const metrics = new Metrics({ serviceName: SERVICE_NAME });
const tracer = new Tracer({ serviceName: SERVICE_NAME });

exports.handler = function (_event: never, _ctx: Context): void {
exports.handler = function (_event: never, _ctx: unknown): void {
// check logger lib access
logger.injectLambdaContext();
logger.debug('Hello World!');
Expand Down
10 changes: 9 additions & 1 deletion layer-publisher/tests/e2e/happy-case.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const layerStack = new LayerPublisher.LayerPublisherStack(
{
layerName: `e2e-tests-layer-${runtime.name.split('.')[0]}`,
powerToolsPackageVersion: powerToolsPackageVersion,
ssmParameterLayerArn: '/e2e-tests-layertools-layer-arn',
ssmParameterLayerArn: `/e2e-tests-layertools-layer-arn-${runtime.name.split('.')[0]}`,
}
);

Expand Down Expand Up @@ -70,6 +70,14 @@ const createSampleLambda = (runtime: cdk.aws_lambda.Runtime): { consumerStack: c
handler: 'handler',
functionName,
runtime: runtime,
bundling: {
externalModules: [
'@aws-lambda-powertools/commons',
'@aws-lambda-powertools/logger',
'@aws-lambda-powertools/metrics',
'@aws-lambda-powertools/tracer'
]
},
environment: {
POWERTOOLS_PACKAGE_VERSION: powerToolsPackageVersion,
},
Expand Down