feat: Add Lambda-Runtime-Invocation-Id support for cross-wiring prote… #400
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test-on-push-and-pr | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ '**' ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run 'pr' target | |
| run: make pr | |
| test-runtime-client: | |
| name: test runtime client | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # The tests in this job drive the compiled extension against a stub RAPID, | |
| # so unlike the unit tests they need the native code built first. | |
| - name: Install aws-lambda-cpp build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y g++ make cmake libcurl4-openssl-dev | |
| - name: Install requirements | |
| run: make init | |
| - name: Compile the runtime client extension and run its tests | |
| run: make test-runtime-client | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Alpine | |
| - distro: alpine | |
| distro_version: "3.19" | |
| runtime_version: "3.10" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.19" | |
| runtime_version: "3.11" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.19" | |
| runtime_version: "3.12" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.19" | |
| runtime_version: "3.13" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.20" | |
| runtime_version: "3.10" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.20" | |
| runtime_version: "3.11" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.20" | |
| runtime_version: "3.12" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.20" | |
| runtime_version: "3.13" | |
| python_location: /usr/local/bin/python | |
| - distro: alpine | |
| distro_version: "3.21" | |
| runtime_version: "3.14" | |
| python_location: /usr/local/bin/python | |
| # Debian | |
| - distro: debian | |
| distro_version: bookworm | |
| runtime_version: "3.10" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bookworm | |
| runtime_version: "3.11" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bookworm | |
| runtime_version: "3.12" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bookworm | |
| runtime_version: "3.13" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bookworm | |
| runtime_version: "3.14" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bullseye | |
| runtime_version: "3.10" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bullseye | |
| runtime_version: "3.11" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bullseye | |
| runtime_version: "3.12" | |
| python_location: /usr/local/bin/python | |
| - distro: debian | |
| distro_version: bullseye | |
| runtime_version: "3.13" | |
| python_location: /usr/local/bin/python | |
| # Amazon Linux 2 | |
| - distro: amazonlinux2 | |
| distro_version: "2" | |
| runtime_version: "3.10" | |
| python_location: /usr/local/bin/python3 | |
| - distro: amazonlinux2 | |
| distro_version: "2" | |
| runtime_version: "3.11" | |
| python_location: /usr/local/bin/python3 | |
| # Amazon Linux 2023 | |
| - distro: amazonlinux2023 | |
| distro_version: "2023" | |
| runtime_version: "3.12" | |
| python_location: /usr/local/bin/python3 | |
| - distro: amazonlinux2023 | |
| distro_version: "2023" | |
| runtime_version: "3.13" | |
| python_location: /usr/local/bin/python3 | |
| - distro: amazonlinux2023 | |
| distro_version: "2023" | |
| runtime_version: "3.14" | |
| python_location: /usr/local/bin/python3 | |
| # Ubuntu | |
| - distro: ubuntu | |
| distro_version: "22.04" | |
| runtime_version: "3.10" | |
| python_location: /usr/bin/python3.10 | |
| - distro: ubuntu | |
| distro_version: "22.04" | |
| runtime_version: "3.11" | |
| python_location: /usr/bin/python3.11 | |
| - distro: ubuntu | |
| distro_version: "22.04" | |
| runtime_version: "3.12" | |
| python_location: /usr/bin/python3.12 | |
| - distro: ubuntu | |
| distro_version: "22.04" | |
| runtime_version: "3.13" | |
| python_location: /usr/bin/python3.13 | |
| - distro: ubuntu | |
| distro_version: "22.04" | |
| runtime_version: "3.14" | |
| python_location: /usr/bin/python3.14 | |
| - distro: ubuntu | |
| distro_version: "24.04" | |
| runtime_version: "3.10" | |
| python_location: /usr/bin/python3.10 | |
| - distro: ubuntu | |
| distro_version: "24.04" | |
| runtime_version: "3.11" | |
| python_location: /usr/bin/python3.11 | |
| - distro: ubuntu | |
| distro_version: "24.04" | |
| runtime_version: "3.12" | |
| python_location: /usr/bin/python3.12 | |
| - distro: ubuntu | |
| distro_version: "24.04" | |
| runtime_version: "3.13" | |
| python_location: /usr/bin/python3.13 | |
| - distro: ubuntu | |
| distro_version: "24.04" | |
| runtime_version: "3.14" | |
| python_location: /usr/bin/python3.14 | |
| name: "${{ matrix.distro }} ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }}" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract RIE | |
| run: | | |
| mkdir -p .scratch | |
| ARCHITECTURE=$(arch) | |
| if [[ "$ARCHITECTURE" == "x86_64" ]]; then | |
| RIE="aws-lambda-rie" | |
| elif [[ "$ARCHITECTURE" == "aarch64" ]]; then | |
| RIE="aws-lambda-rie-arm64" | |
| else | |
| echo "Architecture $ARCHITECTURE is not currently supported." | |
| exit 1 | |
| fi | |
| tar -xvf tests/integration/resources/${RIE}.tar.gz --directory .scratch | |
| echo "RIE=${RIE}" >> "$GITHUB_ENV" | |
| - name: Build Docker image | |
| run: | | |
| DOCKERFILE="tests/integration/docker/Dockerfile.echo.${{ matrix.distro }}" | |
| TMPFILE=".scratch/Dockerfile.tmp" | |
| cp "$DOCKERFILE" "$TMPFILE" | |
| if [[ "${{ matrix.distro }}" == "alpine" ]]; then | |
| echo "RUN apk add curl" >> "$TMPFILE" | |
| fi | |
| echo "COPY .scratch/${RIE} /usr/bin/${RIE}" >> "$TMPFILE" | |
| docker build . \ | |
| -f "$TMPFILE" \ | |
| -t ric-test \ | |
| --build-arg RUNTIME_VERSION=${{ matrix.runtime_version }} \ | |
| --build-arg DISTRO_VERSION=${{ matrix.distro_version }} \ | |
| --build-arg ARCHITECTURE=$(arch) | |
| - name: Run integration test | |
| run: | | |
| TEST_NAME="ric-integ-test" | |
| docker network create "${TEST_NAME}-net" | |
| docker run \ | |
| --detach \ | |
| --name "${TEST_NAME}-app" \ | |
| --network "${TEST_NAME}-net" \ | |
| --entrypoint="" \ | |
| ric-test \ | |
| sh -c "/usr/bin/${RIE} ${{ matrix.python_location }} -m awslambdaric app.handler" | |
| sleep 2 | |
| docker run \ | |
| --name "${TEST_NAME}-tester" \ | |
| --env "TARGET=${TEST_NAME}-app" \ | |
| --network "${TEST_NAME}-net" \ | |
| --entrypoint="" \ | |
| ric-test \ | |
| sh -c 'curl -sS -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10' | |
| ACTUAL="$(docker logs --tail 1 "${TEST_NAME}-tester" | xargs)" | |
| EXPECTED="success" | |
| echo "Response: ${ACTUAL}" | |
| if [ "$ACTUAL" != "$EXPECTED" ]; then | |
| echo "FAIL: expected '${EXPECTED}', got '${ACTUAL}'" | |
| exit 1 | |
| fi | |
| echo "PASS" | |
| - name: Dump container logs | |
| if: always() | |
| run: | | |
| TEST_NAME="ric-integ-test" | |
| echo "=== App container logs ===" | |
| docker logs "${TEST_NAME}-app" 2>&1 || true | |
| echo "=== Tester container logs ===" | |
| docker logs "${TEST_NAME}-tester" 2>&1 || true | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| TEST_NAME="ric-integ-test" | |
| docker rm -f "${TEST_NAME}-app" "${TEST_NAME}-tester" 2>/dev/null || true | |
| docker network rm "${TEST_NAME}-net" 2>/dev/null || true |