Skip to content

fix: Report SDK user error for invalid span name (#879) #657

fix: Report SDK user error for invalid span name (#879)

fix: Report SDK user error for invalid span name (#879) #657

# PR's only
name: "Node: Integrate"
on:
push:
branches: [main]
paths:
- node/**
- go/**
- proto/**
env:
FORCE_COLOR: 1
FORMAT_INSPECT_DEPTH: 20
jobs:
linuxNode16:
name: "[Linux] Node.js v16: Unit Tests"
runs-on: ubuntu-latest
outputs:
pathChangedAwsLambdaOtelExtension: ${{ steps.pathChanges.outputs.awsLambdaOtelExtension }}
pathChangedAwsLambdaSdk: ${{ steps.pathChanges.outputs.awsLambdaSdk }}
pathChangedSdk: ${{ steps.pathChanges.outputs.sdk}}
pathChangedSdkSchema: ${{ steps.pathChanges.outputs.sdkSchema}}
pathChangedTestGoDevMode: ${{ steps.pathChanges.outputs.testGoDevMode }}
pathChangedProto: ${{ steps.pathChanges.outputs.proto }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Resolve path filters
uses: dorny/paths-filter@v2
id: pathChanges
with:
filters: |
awsLambdaOtelExtension:
- 'node/packages/aws-lambda-otel-extension/**'
awsLambdaSdk:
- 'node/packages/aws-lambda-sdk/**'
sdk:
- 'node/packages/sdk/**'
sdkSchema:
- 'node/packages/sdk-schema/**'
testGoDevMode:
- 'go/packages/dev-mode/**'
- 'node/test/go/dev-mode/**'
proto:
- 'proto/**'
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/**package*.json') }}
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/package.json') }}
restore-keys: node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/node_modules
key: packages/aws-lambda-otel-extension/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/external/otel-extension-external/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionExternalOtelExtensionExternalNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/external/otel-extension-external/node_modules
key: packages/aws-lambda-otel-extension/external/otel-extension-external/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/external/otel-extension-external/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/external/otel-extension-external/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionInternalOtelExtensionIntrernalNodeNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node_modules
key: packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/test/fixtures/lambdas from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-otel-extension/test/fixtures/lambdas/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/test/fixtures/lambdas/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-sdk/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
id: cacheAwsLambdaSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/node_modules
key: packages/aws-lambda-sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/package.json') }}
restore-keys: packages/aws-lambda-sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-sdk/test/fixtures/lambdas from cache
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
id: cacheAwsLambdaSdkTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-sdk/test/fixtures/lambdas/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/test/fixtures/lambdas/package.json') }}
restore-keys: packages/aws-lambda-sdk/test/fixtures/lambdas/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/sdk/node_modules from cache
if: steps.pathChanges.outputs.sdk == 'true'
id: cacheSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/sdk/node_modules
key: packages/sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/sdk/package.json') }}
restore-keys: packages/sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/sdk-schema/node_modules from cache
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
id: cacheSdkSchemaNodeModules
uses: actions/cache@v2
with:
path: node/packages/sdk-schema/node_modules
key: packages/sdk-schema/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/sdk-schema/package.json') }}
restore-keys: packages/sdk-schema/node-modules-v16-${{ runner.os }}-${{ github.ref }}-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install main project dependencies
if: steps.cacheNodeModules.outputs.cache-hit != 'true'
run: |
cd node
npm update --save-dev --no-save
- name: Install packages/aws-lambda-otel-extension dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/external/otel-extension-external dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionExternalOtelExtensionExternalNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/external/otel-extension-external
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/internal/otel-extension-internal-node dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionInternalOtelExtensionInternalNodeNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/test/fixtures/lambdas dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionTestFixturesLambdasNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/test/fixtures/lambdas
npm update --no-save
- name: Install packages/aws-lambda-sdk dependencies
if: steps.pathChanges.outputs.awsLambdaSdk == 'true' && steps.cacheAwsLambdaSdkNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-sdk
npm update --no-save
- name: Install packages/aws-lambda-sdk/test/fixtures/lambdas dependencies
if: steps.pathChanges.outputs.awsLambdaSdk == 'true' && steps.cacheAwsLambdaSdkTestFixturesLambdasNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-sdk/test/fixtures/lambdas
npm update --no-save
- name: Install packages/sdk dependencies
if: steps.pathChanges.outputs.sdk == 'true' && steps.cacheSdkNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/sdk
npm update --no-save
- name: Install packages/sdk-schema dependencies
if: (steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true') && steps.cacheSdkSchemaNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/sdk-schema
npm update --no-save
- name: Unit tests /aws-lambda-otel-extension
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
run: |
cd node/packages/aws-lambda-otel-extension
npm test
- name: Unit tests /aws-lambda-sdk
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
run: |
cd node/packages/aws-lambda-sdk
npm test
- name: Unit tests /sdk
if: steps.pathChanges.outputs.sdk == 'true'
run: |
cd node/packages/sdk
npm test
- name: Buf Setup
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
uses: bufbuild/buf-setup-action@v1
- name: Buf Lint
if: steps.pathChanges.outputs.proto == 'true'
uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
- name: Build /sdk-schema
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
run: |
cd proto
buf build
buf generate
cd ../node/packages/sdk-schema
npm run build
- name: Unit tests /sdk-schema
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
run: |
cd node/packages/sdk-schema
npm test
linuxNode14:
name: "[Linux] Node.js v14: Isolated Unit Tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Resolve path filters
uses: dorny/paths-filter@v2
id: pathChanges
with:
filters: |
awsLambdaOtelExtension:
- 'node/packages/aws-lambda-otel-extension/**'
awsLambdaSdk:
- 'node/packages/aws-lambda-sdk/**'
sdk:
- 'node/packages/sdk/**'
sdkSchema:
- 'node/packages/sdk-schema/**'
testGoDevMode:
- 'go/packages/dev-mode/**'
- 'node/test/go/dev-mode/**'
proto:
- 'proto/**'
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/**package*.json') }}
restore-keys: npm-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/package.json') }}
restore-keys: node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/node_modules
key: packages/aws-lambda-otel-extension/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/external/otel-extension-external/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionExternalOtelExtensionExternalNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/external/otel-extension-external/node_modules
key: packages/aws-lambda-otel-extension/external/otel-extension-external/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/external/otel-extension-external/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/external/otel-extension-external/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionInternalOtelExtensionIntrernalNodeNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node_modules
key: packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/internal/otel-extension-internal-node/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-otel-extension/test/fixtures/lambdas from cache
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
id: cacheAwsLambdaOtelExtensionTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-otel-extension/test/fixtures/lambdas/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/package.json') }}
restore-keys: packages/aws-lambda-otel-extension/test/fixtures/lambdas/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-sdk/node_modules from cache
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
id: cacheAwsLambdaSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/node_modules
key: packages/aws-lambda-sdk/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/package.json') }}
restore-keys: packages/aws-lambda-sdk/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/aws-lambda-sdk/test/fixtures/lambdas from cache
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
id: cacheAwsLambdaSdkTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-sdk/test/fixtures/lambdas/node-modules-14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/test/fixtures/lambdas/package.json') }}
restore-keys: packages/aws-lambda-sdk/test/fixtures/lambdas/node-modules-v14-${{ runner.os }}-refs/heads/main-
- name: Retrieve packages/sdk/node_modules from cache
if: steps.pathChanges.outputs.sdk == 'true'
id: cacheSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/sdk/node_modules
key: packages/sdk/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/sdk/package.json') }}
restore-keys: packages/sdk/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Retrieve packages/sdk-schema/node_modules from cache
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
id: cacheSdkSchemaNodeModules
uses: actions/cache@v2
with:
path: node/packages/sdk-schema/node_modules
key: packages/sdk-schema/node-modules-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/sdk-schema/package.json') }}
restore-keys: packages/sdk-schema/node-modules-v14-${{ runner.os }}-${{ github.ref }}-
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install main project dependencies
if: steps.cacheNodeModules.outputs.cache-hit != 'true'
run: |
cd node
npm update --save-dev --no-save
- name: Install packages/aws-lambda-otel-extension dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/external/otel-extension-external dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionExternalOtelExtensionExternalNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/external/otel-extension-external
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/internal/otel-extension-internal-node dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionInternalOtelExtensionInternalNodeNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node
npm update --no-save
- name: Install packages/aws-lambda-otel-extension/test/fixtures/lambdas dependencies
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true' && steps.cacheAwsLambdaOtelExtensionTestFixturesLambdasNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-otel-extension/test/fixtures/lambdas
npm update --no-save
- name: Install packages/aws-lambda-sdk dependencies
if: steps.pathChanges.outputs.awsLambdaSdk == 'true' && steps.cacheAwsLambdaSdkNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-sdk
npm update --no-save
- name: Install packages/aws-lambda-sdk/test/fixtures/lambdas dependencies
if: steps.pathChanges.outputs.awsLambdaSdk == 'true' && steps.cacheAwsLambdaSdkTestFixturesLambdasNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/aws-lambda-sdk/test/fixtures/lambdas
npm update --no-save
- name: Install packages/sdk dependencies
if: steps.pathChanges.outputs.sdk == 'true' && steps.cacheSdkNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/sdk
npm update --no-save
- name: Install packages/sdk-schema dependencies
if: (steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true') && steps.cacheSdkSchemaNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/sdk-schema
npm update --no-save
- name: Unit tests aws-lambda-otel-extension
if: steps.pathChanges.outputs.awsLambdaOtelExtension == 'true'
run: |
# npm v6 doesn't add parent node_modules/.bin to PATH, workaround it
export PATH="$PWD/node/node_modules/.bin:$PATH"
cd node/packages/aws-lambda-otel-extension
npm run test:isolated
- name: Unit tests aws-lambda-sdk
if: steps.pathChanges.outputs.awsLambdaSdk == 'true'
run: |
# npm v6 doesn't add parent node_modules/.bin to PATH, workaround it
export PATH="$PWD/node/node_modules/.bin:$PATH"
cd node/packages/aws-lambda-sdk
npm run test:isolated
- name: Unit tests sdk
if: steps.pathChanges.outputs.sdk == 'true'
run: |
# npm v6 doesn't add parent node_modules/.bin to PATH, workaround it
export PATH="$PWD/node/node_modules/.bin:$PATH"
cd node/packages/sdk
npm run test:isolated
- name: Buf Setup
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
uses: bufbuild/buf-setup-action@v1
- name: Build /sdk-schema
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
run: |
# npm v6 doesn't add parent node_modules/.bin to PATH, workaround it
export PATH="$PWD/node/node_modules/.bin:$PATH"
cd proto
buf build
buf generate
cd ../node/packages/sdk-schema
npm run build
- name: Unit tests /sdk-schema
if: steps.pathChanges.outputs.sdkSchema == 'true' || steps.pathChanges.outputs.proto == 'true'
run: |
# npm v6 doesn't add parent node_modules/.bin to PATH, workaround it
export PATH="$PWD/node/node_modules/.bin:$PATH"
cd node/packages/sdk-schema
npm run test:isolated
integrateAwsLambdaOtelExtension:
name: Integrate @serverless/aws-lambda-otel-extension
runs-on: ubuntu-latest
needs: [linuxNode16, linuxNode14]
if: needs.linuxNode16.outputs.pathChangedAwsLambdaOtelExtension == 'true'
timeout-minutes: 5 # Default is 360
env:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SLS_ORG_NAME: test
SLS_ORG_TOKEN: ${{ secrets.SLS_ORG_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/**package*.json') }}
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/package.json') }}
- name: Retrieve packages/aws-lambda-otel-extension/node_modules from cache
id: cacheAwsLambdaOtelExtensionNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/node_modules
key: packages/aws-lambda-otel-extension/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/package.json') }}
- name: Retrieve packages/aws-lambda-otel-extension/test/fixtures/lambdas from cache
id: cacheAwsLambdaOtelExtensionTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-otel-extension/test/fixtures/lambdas/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-otel-extension/test/fixtures/lambdas/package.json') }}
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 16.x
# Note: No need to install dependencies for main packgages as we have retrieved cached
# `node_modules` for very same `package.json` as stored with previous job
- name: Install packages/aws-lambda-otel-extension/external/otel-extension-external dependencies
run: |
cd node/packages/aws-lambda-otel-extension/external/otel-extension-external
npm install
- name: Install packages/aws-lambda-otel-extension/internal/otel-extension-internal-node dependencies
run: |
cd node/packages/aws-lambda-otel-extension/internal/otel-extension-internal-node
npm install
- name: Integration tests
run: |
cd node/packages/aws-lambda-otel-extension
npm run test:integration
- name: Validate performancer
run: |
cd node/packages/aws-lambda-otel-extension
npm run test:performance
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} node/packages/aws-lambda-otel-extension/package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ] && [ $NEW_VERSION != "0.0.0" ];
then
git tag @serverless/aws-lambda-otel-extension@$NEW_VERSION
git push --tags
fi
integrateAwsLambdaSdk:
name: Integrate @serverless/aws-lambda-sdk
runs-on: ubuntu-latest
needs: [linuxNode16, linuxNode14]
if: needs.linuxNode16.outputs.pathChangedAwsLambdaSdk == 'true'
timeout-minutes: 5 # Default is 360
env:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SLS_ORG_ID: ${{ secrets.SLS_ORG_ID }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/**package*.json') }}
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/package.json') }}
- name: Retrieve packages/aws-lambda-sdk/node_modules from cache
id: cacheAwsLambdaSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/node_modules
key: packages/aws-lambda-sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/package.json') }}
- name: Retrieve packages/aws-lambda-sdk/test/fixtures/lambdas from cache
id: cacheAwsLambdaSdkTestFixturesLambdasNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/test/fixtures/lambdas/node_modules
key: packages/aws-lambda-sdk/test/fixtures/lambdas/node-modules-14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/test/fixtures/lambdas/package.json') }}
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install packages/aws-lambda-sdk dependencies
run: |
cd node/packages/aws-lambda-sdk
npm install
- name: Install packages/aws-lambda-sdk/test/fixtures/lambdas dependencies
run: |
cd node/packages/aws-lambda-sdk/test/fixtures/lambdas
npm install
- name: Integration tests
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
cd node/packages/aws-lambda-sdk
npm run test:integration
- name: Performance tests
run: |
cd node/packages/aws-lambda-sdk
npm run test:performance
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} node/packages/aws-lambda-sdk/package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ] && [ $NEW_VERSION != "0.0.0" ];
then
git tag @serverless/aws-lambda-sdk@$NEW_VERSION
git push --tags
fi
integrateSdk:
name: Integrate @serverless/sdk
runs-on: ubuntu-latest
needs: [linuxNode16, linuxNode14]
if: needs.linuxNode16.outputs.pathChangedSdk == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
# We should have real integration tests here, but for now we are just going to tag a release if unit tests pass
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} node/packages/sdk/package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ] && [ $NEW_VERSION != "0.0.0" ];
then
git tag @serverless/sdk@$NEW_VERSION
git push --tags
fi
integrateSdkSchema:
name: Integrate @serverless/sdk-schema
runs-on: ubuntu-latest
needs: [linuxNode16, linuxNode14]
if: needs.linuxNode16.outputs.pathChangedSdkSchema == 'true' || needs.linuxNode16.outputs.pathChangedProto == 'true'
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
# We should have real integration tests here, but for now we are just going to tag a release if unit tests pass
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} node/packages/sdk-schema/package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
if [ -n "$NEW_VERSION" ] && [ $NEW_VERSION != "0.0.0" ];
then
git tag @serverless/sdk-schema@$NEW_VERSION
git push --tags
fi
integrateTestGoDevMode:
name: Integrate Dev Mode Extension
runs-on: ubuntu-latest
needs: [linuxNode16, linuxNode14]
if: needs.linuxNode16.outputs.pathChangedTestGoDevMode == 'true'
timeout-minutes: 5 # Default is 360
env:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SLS_ORG_ID: ${{ secrets.SLS_ORG_ID }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# Ensure to have complete history of commits pushed with given push operation
# It's loose and imperfect assumption that no more than 30 commits will be pushed at once
fetch-depth: 30
# Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
# Hence we're passing 'serverless-ci' user authentication token
token: ${{ secrets.USER_GITHUB_TOKEN }}
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/**package*.json') }}
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/package.json') }}
- name: Retrieve packages/aws-lambda-sdk/node_modules from cache
id: cacheAwsLambdaSdkNodeModules
uses: actions/cache@v2
with:
path: node/packages/aws-lambda-sdk/node_modules
key: packages/aws-lambda-sdk/node-modules-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('node/packages/aws-lambda-sdk/package.json') }}
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install main project dependencies
if: steps.cacheNodeModules.outputs.cache-hit != 'true'
run: |
cd node
npm update --save-dev --no-save
- name: Install packages/aws-lambda-sdk dependencies
run: |
cd node/packages/aws-lambda-sdk
npm install
- name: Build Internal Extension Layer
run: |
cd node/packages/aws-lambda-sdk
npm run build
- name: Build Dev Mode Extension Layer
run: |
cd go/packages/dev-mode
make build_x86
- name: Integration tests
run: |
cd node
npm run test:dev-mode:integration
- name: Tag if new version
run: |
NEW_VERSION=`git diff -U0 ${{ github.event.before }} go/packages/dev-mode/version.txt | grep -oE "\+[0-9]+\.[0-9]+\.[0-9]+" | cut -c 2-` || :
if [ -n "$NEW_VERSION" ] && [ $NEW_VERSION != "0.0.0" ];
then
git tag go/sls-external-extension@$NEW_VERSION
git push --tags
fi