Skip to content
Draft
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
115 changes: 115 additions & 0 deletions .github/workflows/test-on-push-and-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,118 @@ jobs:
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

# Builds awslambdaric from source and runs an end-to-end invoke through the
# Lambda RIE on every supported OS, pinned to the newest Python (3.14). The
# source install compiles the vendored aws-lambda-cpp (the backward.cpp /
# execinfo.h path), so the Alpine (musl) row guards the libexecinfo regression
# from issue #128. Reuses the per-OS Dockerfiles (ubuntu via deadsnakes,
# Amazon Linux builds Python from source) since there are no official
# python:3.14 images for those distros. Amazon Linux 2 is omitted as it does
# not provide Python 3.14.
pip-install-from-source:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- distro: alpine
distro_version: "3.21"
runtime_version: "3.14"
python_location: /usr/local/bin/python
- distro: debian
distro_version: bookworm
runtime_version: "3.14"
python_location: /usr/local/bin/python
- distro: ubuntu
distro_version: "24.04"
runtime_version: "3.14"
python_location: /usr/bin/python3.14
- distro: amazonlinux2023
distro_version: "2023"
runtime_version: "3.14"
python_location: /usr/local/bin/python3

name: "pip install + invoke / ${{ 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-piptest \
--build-arg RUNTIME_VERSION=${{ matrix.runtime_version }} \
--build-arg DISTRO_VERSION=${{ matrix.distro_version }} \
--build-arg ARCHITECTURE=$(arch)

- name: Run invoke test
run: |
TEST_NAME="ric-piptest"
docker network create "${TEST_NAME}-net"

docker run \
--detach \
--name "${TEST_NAME}-app" \
--network "${TEST_NAME}-net" \
--entrypoint="" \
ric-piptest \
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-piptest \
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-piptest"
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-piptest"
docker rm -f "${TEST_NAME}-app" "${TEST_NAME}-tester" 2>/dev/null || true
docker network rm "${TEST_NAME}-net" 2>/dev/null || true
Binary file modified deps/aws-lambda-cpp-0.2.6.tar.gz
Binary file not shown.
Loading