From b41b957c9b57952038b4813bb10074cee1737a47 Mon Sep 17 00:00:00 2001 From: Sahil Bondre Date: Thu, 4 Dec 2025 15:37:38 +0000 Subject: [PATCH 1/2] ci: Update CI workflow and expand build documentation --- .github/workflows/test-on-push-and-pr.yml | 31 ++++--- README.md | 106 ++++++++++++++++++---- 2 files changed, 107 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test-on-push-and-pr.yml b/.github/workflows/test-on-push-and-pr.yml index e7f9ebf..718f332 100644 --- a/.github/workflows/test-on-push-and-pr.yml +++ b/.github/workflows/test-on-push-and-pr.yml @@ -1,24 +1,27 @@ -name: test-on-push-and-pr +name: CI on: push: - branches: [ nodejs22.x ] + branches: [nodejs24.x] pull_request: - branches: [ '*' ] + branches: [nodejs24.x] jobs: - unit-test: + build-and-test: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [18, 20, 22] - steps: - - uses: actions/checkout@v5 - - name: Build and run tests for Node.js ${{ matrix.node-version }} - run: | - docker build -f test/unit/Dockerfile.nodejs${{ matrix.node-version }}.x -t unit/nodejs.${{ matrix.node-version }}x . - docker run unit/nodejs.${{ matrix.node-version }}x + - uses: actions/checkout@v5 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci --ignore-scripts + + - name: Build and test + run: npm run build diff --git a/README.md b/README.md index 8489e90..d914fb4 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,56 @@ docker run -p 9000:8080 my-lambda-function curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"message":"test"}' ``` +### Building on Custom Linux Distributions + +You can build and run Lambda functions with the RIC on your own platform. Here's a minimal Dockerfile example: + +```dockerfile +FROM quay.io/centos/centos:stream9 AS build-image + +ARG NODE_VERSION=22.14.0 +ARG FUNCTION_DIR="/function" + +# Install build dependencies +RUN dnf -y install \ + autoconf \ + automake \ + cmake \ + gcc \ + gcc-c++ \ + libtool \ + make \ + python3 \ + xz \ + && dnf clean all + +# Install Node.js +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" = "x86_64" ]; then NODE_ARCH="x64"; else NODE_ARCH="arm64"; fi && \ + curl -fsSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz | \ + tar -xJ -C /usr/local --strip-components=1 + +# Create function directory +RUN mkdir -p ${FUNCTION_DIR} +WORKDIR ${FUNCTION_DIR} + +RUN npm install aws-lambda-ric + +ENTRYPOINT ["npx", "aws-lambda-ric"] +CMD ["index.handler"] +``` + +Build and run locally with RIE: + +```bash +docker build -t my-lambda . +docker run -p 9000:8080 \ + -e AWS_LAMBDA_FUNCTION_NAME=test \ + -v ~/.aws-lambda-rie:/aws-lambda \ + --entrypoint /aws-lambda/aws-lambda-rie \ + my-lambda npx aws-lambda-ric index.handler +``` + ## Building from Source ### Prerequisites @@ -73,7 +123,6 @@ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d - Node.js 22.x or later - npm - Docker (for container builds) -- Make ### Local Development @@ -85,44 +134,56 @@ cd aws-lambda-nodejs-runtime-interface-client # Install dependencies npm install -# Run tests +# Run all tests with coverage and linting npm test +# Run unit tests only +npm run test:unit + +# Run integration tests only +npm run test:integ + # Run linter npm run lint # Fix linting issues npm run lint:fix -``` -### Build Modes +# Clean build artifacts +npm run clean +``` -The project supports multiple build modes: +### Build Commands -#### Metal Build (Local Development) +#### Local Build -Fast build for local development and quick iterations: +Build TypeScript and package for distribution: ```bash -npm run build:metal +npm run build ``` -- TypeScript compilation only -- No native module compilation -- ~5 seconds build time +This runs tests, compiles TypeScript, and packages the output. + +Individual steps: +```bash +npm run compile # TypeScript compilation only +npm run pkg # Package with esbuild +``` #### Container Build (Full Build) -Complete build including native module compilation: +Complete build including native module compilation for Linux: ```bash npm run build:container ``` - Builds using Docker on AL2023 base image -- Compiles native C++ dependencies -- Produces deployable artifacts -- ~2-3 minutes build time +- Compiles native C++ dependencies (curl, aws-lambda-cpp) +- Produces deployable artifacts in `build-artifacts/` +- Targets `linux/amd64` by default for Lambda compatibility +- Use `PLATFORM=linux/arm64 npm run build:container` for ARM64 Lambda ### Testing with RIE @@ -139,6 +200,19 @@ npm run peek:rie curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"message":"test"}' ``` +For multi-concurrent testing: +```bash +npm run peek:rie:mc +``` + +### Interactive Container Testing + +To explore the built package in an interactive container: + +```bash +npm run peek:container +``` + ### Testing in Lambda using Container Image To deploy and test as a Lambda container function: @@ -149,7 +223,7 @@ npm run build:container # Review and update variables in scripts/lambda-build.sh -# Build and deploy +# Build and deploy (requires AWS credentials) npm run peek:lambda ``` From ab51bb02de72811f5c49bc1ccf2123236378b936 Mon Sep 17 00:00:00 2001 From: Sahil Bondre Date: Thu, 4 Dec 2025 15:44:05 +0000 Subject: [PATCH 2/2] docs: Update release changelog for v4.0.0 release --- RELEASE.CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE.CHANGELOG.md b/RELEASE.CHANGELOG.md index 078a3cf..c386761 100644 --- a/RELEASE.CHANGELOG.md +++ b/RELEASE.CHANGELOG.md @@ -1,3 +1,7 @@ +### Dec 4, 2025 +`4.0.0` +- Initial release of `v4` AWS Lambda Runtime Interface Client for NodeJS with typescript and multiconcurrency support for Node.js 24 and Lambda Managed Instances. + ### May 21, 2025 `3.3.0` - Add support for multi tenancy ([#128](https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/pull/128))