Skip to content

Commit 113d147

Browse files
author
Mohammed Ehab
committed
ci: reduce pip-install matrix to all OSs at python 3.14
Per review feedback, collapse the per-Alpine-version matrix into a single representative row per OS family, pinned to the newest Python (3.14): alpine 3.21, debian bookworm, ubuntu 24.04, amazonlinux2023. Reuses the per-OS Dockerfiles + RIE invoke. The Alpine (musl) row still guards the libexecinfo/execinfo.h regression from #128. Amazon Linux 2 is omitted as it does not provide Python 3.14.
1 parent df849c8 commit 113d147

1 file changed

Lines changed: 94 additions & 53 deletions

File tree

.github/workflows/test-on-push-and-pr.yml

Lines changed: 94 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -246,76 +246,117 @@ jobs:
246246
docker rm -f "${TEST_NAME}-app" "${TEST_NAME}-tester" 2>/dev/null || true
247247
docker network rm "${TEST_NAME}-net" 2>/dev/null || true
248248
249-
# Verifies the documented end-user `pip install` source build works, including
250-
# the native aws-lambda-cpp compile triggered by scripts/preinstall.sh (i.e. a
251-
# real install where BUILD is NOT set, so the C++ extension is actually built).
252-
#
253-
# This specifically guards the Alpine/musl regression in issue #128: Alpine 3.17
254-
# removed the libexecinfo-dev package (no execinfo.h on musl), which broke the
255-
# backward.cpp compile. These jobs intentionally do NOT install libexecinfo-dev
256-
# and cover the full affected Alpine range (3.17+), which the integration-test
257-
# matrix above does not (it starts at 3.19).
249+
# Builds awslambdaric from source and runs an end-to-end invoke through the
250+
# Lambda RIE on every supported OS, pinned to the newest Python (3.14). The
251+
# source install compiles the vendored aws-lambda-cpp (the backward.cpp /
252+
# execinfo.h path), so the Alpine (musl) row guards the libexecinfo regression
253+
# from issue #128. Reuses the per-OS Dockerfiles (ubuntu via deadsnakes,
254+
# Amazon Linux builds Python from source) since there are no official
255+
# python:3.14 images for those distros. Amazon Linux 2 is omitted as it does
256+
# not provide Python 3.14.
258257
pip-install-from-source:
259258
runs-on: ubuntu-latest
260259
strategy:
261260
fail-fast: false
262261
matrix:
263262
include:
264-
# Alpine (musl) - full range that dropped libexecinfo-dev (3.17+)
265-
- distro: alpine
266-
distro_version: "3.17"
267-
runtime_version: "3.11"
268-
- distro: alpine
269-
distro_version: "3.18"
270-
runtime_version: "3.11"
271-
- distro: alpine
272-
distro_version: "3.19"
273-
runtime_version: "3.12"
274-
- distro: alpine
275-
distro_version: "3.20"
276-
runtime_version: "3.13"
277263
- distro: alpine
278264
distro_version: "3.21"
279-
runtime_version: "3.13"
280-
# Debian (glibc) - ensure execinfo.h is still detected and stack
281-
# traces remain compiled in (no regression on glibc systems).
265+
runtime_version: "3.14"
266+
python_location: /usr/local/bin/python
282267
- distro: debian
283268
distro_version: bookworm
284-
runtime_version: "3.12"
269+
runtime_version: "3.14"
270+
python_location: /usr/local/bin/python
271+
- distro: ubuntu
272+
distro_version: "24.04"
273+
runtime_version: "3.14"
274+
python_location: /usr/bin/python3.14
275+
- distro: amazonlinux2023
276+
distro_version: "2023"
277+
runtime_version: "3.14"
278+
python_location: /usr/local/bin/python3
285279

286-
name: "pip install / ${{ matrix.distro }} ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }}"
280+
name: "pip install + invoke / ${{ matrix.distro }} ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }}"
287281

288282
steps:
289283
- uses: actions/checkout@v4
290284

291-
- name: pip install from source and import native extension
285+
- name: Extract RIE
292286
run: |
293-
set -euo pipefail
294-
295-
if [ "${{ matrix.distro }}" = "alpine" ]; then
296-
IMAGE="public.ecr.aws/docker/library/python:${{ matrix.runtime_version }}-alpine${{ matrix.distro_version }}"
297-
# Build deps per README/Dockerfile.echo.alpine. Note: libexecinfo-dev
298-
# is deliberately omitted - the fix must build without it.
299-
INSTALL_DEPS="apk add --no-cache build-base libtool autoconf automake elfutils-dev make cmake libcurl"
287+
mkdir -p .scratch
288+
ARCHITECTURE=$(arch)
289+
if [[ "$ARCHITECTURE" == "x86_64" ]]; then
290+
RIE="aws-lambda-rie"
291+
elif [[ "$ARCHITECTURE" == "aarch64" ]]; then
292+
RIE="aws-lambda-rie-arm64"
300293
else
301-
IMAGE="public.ecr.aws/docker/library/python:${{ matrix.runtime_version }}-${{ matrix.distro_version }}"
302-
INSTALL_DEPS="apt-get update && apt-get install -y --no-install-recommends g++ make cmake libcurl4-openssl-dev"
294+
echo "Architecture $ARCHITECTURE is not currently supported."
295+
exit 1
303296
fi
297+
tar -xvf tests/integration/resources/${RIE}.tar.gz --directory .scratch
298+
echo "RIE=${RIE}" >> "$GITHUB_ENV"
304299
305-
echo "Testing 'pip install .' on ${IMAGE}"
300+
- name: Build Docker image
301+
run: |
302+
DOCKERFILE="tests/integration/docker/Dockerfile.echo.${{ matrix.distro }}"
303+
TMPFILE=".scratch/Dockerfile.tmp"
304+
cp "$DOCKERFILE" "$TMPFILE"
305+
if [[ "${{ matrix.distro }}" == "alpine" ]]; then
306+
echo "RUN apk add curl" >> "$TMPFILE"
307+
fi
308+
echo "COPY .scratch/${RIE} /usr/bin/${RIE}" >> "$TMPFILE"
309+
docker build . \
310+
-f "$TMPFILE" \
311+
-t ric-piptest \
312+
--build-arg RUNTIME_VERSION=${{ matrix.runtime_version }} \
313+
--build-arg DISTRO_VERSION=${{ matrix.distro_version }} \
314+
--build-arg ARCHITECTURE=$(arch)
315+
316+
- name: Run invoke test
317+
run: |
318+
TEST_NAME="ric-piptest"
319+
docker network create "${TEST_NAME}-net"
320+
321+
docker run \
322+
--detach \
323+
--name "${TEST_NAME}-app" \
324+
--network "${TEST_NAME}-net" \
325+
--entrypoint="" \
326+
ric-piptest \
327+
sh -c "/usr/bin/${RIE} ${{ matrix.python_location }} -m awslambdaric app.handler"
328+
329+
sleep 2
330+
331+
docker run \
332+
--name "${TEST_NAME}-tester" \
333+
--env "TARGET=${TEST_NAME}-app" \
334+
--network "${TEST_NAME}-net" \
335+
--entrypoint="" \
336+
ric-piptest \
337+
sh -c 'curl -sS -X POST "http://${TARGET}:8080/2015-03-31/functions/function/invocations" -d "{}" --max-time 10'
306338
307-
# Mount the checkout read-only and build from a writable copy so the
308-
# host workspace is not polluted with build artifacts.
309-
docker run --rm \
310-
-v "$PWD":/src:ro \
311-
"$IMAGE" \
312-
sh -euc "
313-
$INSTALL_DEPS
314-
cp -r /src /build
315-
cd /build
316-
python -m pip install --no-cache-dir .
317-
# The native extension only imports if the C++ build (including the
318-
# backward.cpp / execinfo.h path) compiled and linked successfully.
319-
python -c 'import runtime_client; print(\"native runtime_client extension: OK\")'
320-
python -c 'import awslambdaric; print(\"awslambdaric\", awslambdaric.__version__, \"import: OK\")'
321-
"
339+
ACTUAL="$(docker logs --tail 1 "${TEST_NAME}-tester" | xargs)"
340+
EXPECTED="success"
341+
echo "Response: ${ACTUAL}"
342+
if [ "$ACTUAL" != "$EXPECTED" ]; then
343+
echo "FAIL: expected '${EXPECTED}', got '${ACTUAL}'"
344+
exit 1
345+
fi
346+
echo "PASS"
347+
348+
- name: Dump container logs
349+
if: always()
350+
run: |
351+
TEST_NAME="ric-piptest"
352+
echo "=== App container logs ==="
353+
docker logs "${TEST_NAME}-app" 2>&1 || true
354+
echo "=== Tester container logs ==="
355+
docker logs "${TEST_NAME}-tester" 2>&1 || true
356+
357+
- name: Cleanup
358+
if: always()
359+
run: |
360+
TEST_NAME="ric-piptest"
361+
docker rm -f "${TEST_NAME}-app" "${TEST_NAME}-tester" 2>/dev/null || true
362+
docker network rm "${TEST_NAME}-net" 2>/dev/null || true

0 commit comments

Comments
 (0)