Skip to content
Merged
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
293 changes: 216 additions & 77 deletions .github/workflows/test-on-push-and-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ '*' ]
branches: [ '**' ]

permissions:
contents: read
Expand All @@ -18,91 +18,230 @@ jobs:
- name: Run 'pr' target
run: make pr

alpine:
integration-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro_version: ["3.19", "3.20"]
runtime_version: ["3.10", "3.11", "3.12", "3.13"]
include:
- distro_version: "3.21"
# 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"

steps:
- uses: actions/checkout@v4
- name: Run integration test (alpine ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
run: |
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
tests/integration/codebuild/buildspec.os.alpine.yml \
alpine "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"

debian:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro_version: ["bookworm", "bullseye"]
runtime_version: ["3.10", "3.11", "3.12", "3.13"]
include:
- distro_version: "bookworm"
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

steps:
- uses: actions/checkout@v4
- name: Run integration test (debian ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
run: |
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
tests/integration/codebuild/buildspec.os.debian.yml \
debian "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"

amazonlinux2:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime_version: ["3.10", "3.11"]
name: "${{ matrix.distro }} ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }}"

steps:
- uses: actions/checkout@v4
- name: Run integration test (amazonlinux 2 / python ${{ matrix.runtime_version }})
run: |
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
tests/integration/codebuild/buildspec.os.amazonlinux.2.yml \
amazonlinux2 "2" "${{ matrix.runtime_version }}"

amazonlinux2023:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime_version: ["3.12", "3.13", "3.14"]
- uses: actions/checkout@v4

steps:
- uses: actions/checkout@v4
- name: Run integration test (amazonlinux 2023 / python ${{ matrix.runtime_version }})
run: |
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
tests/integration/codebuild/buildspec.os.amazonlinux.2023.yml \
amazonlinux2023 "2023" "${{ matrix.runtime_version }}"

ubuntu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro_version: ["22.04", "24.04"]
runtime_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
- 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"

steps:
- uses: actions/checkout@v4
- name: Run integration test (ubuntu ${{ matrix.distro_version }} / python ${{ matrix.runtime_version }})
run: |
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh \
tests/integration/codebuild/buildspec.os.ubuntu.yml \
ubuntu "${{ matrix.distro_version }}" "${{ matrix.runtime_version }}"
- 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"

Comment on lines +201 to +232

@darklight3it darklight3it Jun 18, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we integrate the dockerized tests also here? I would prefer this to be handled so we give the community a way to test their new features and example for those that wanna create a lambda in python.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes if you don't mind I will add this feature in a new PR, the scope of this one is
codebuild -> GH Actions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving this.

- 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ generated.docker-compose.*.yml

tests/integration/resources/init

.scratch

.idea

node_modules/
Expand Down
21 changes: 8 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ init:
test: check-format
pytest --cov awslambdaric --cov-report term-missing --cov-fail-under 90 tests

.PHONY: setup-codebuild-agent
setup-codebuild-agent:
docker build -t codebuild-agent - < tests/integration/codebuild-local/Dockerfile.agent

.PHONY: test-smoke
test-smoke: setup-codebuild-agent
CODEBUILD_IMAGE_TAG=codebuild-agent tests/integration/codebuild-local/test_one.sh tests/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 3.9

.PHONY: test-integ
test-integ: setup-codebuild-agent
CODEBUILD_IMAGE_TAG=codebuild-agent DISTRO="$(DISTRO)" tests/integration/codebuild-local/test_all.sh tests/integration/codebuild/.
test-integ:
@echo "Integration tests run via GitHub Actions (see .github/workflows/test-on-push-and-pr.yml)"
@echo "To run a single combo locally:"
@echo " make test-integ-local DISTRO=alpine DISTRO_VERSION=3.20 RUNTIME_VERSION=3.13"

.PHONY: test-integ-local
test-integ-local:
tests/integration/run-local.sh $(DISTRO) $(DISTRO_VERSION) $(RUNTIME_VERSION)

.PHONY: check-security
check-security:
Expand All @@ -43,9 +41,6 @@ dev: init test
.PHONY: pr
pr: init check-format check-security dev

codebuild: setup-codebuild-agent
CODEBUILD_IMAGE_TAG=codebuild-agent DISTRO="$(DISTRO)" tests/integration/codebuild-local/test_all.sh tests/integration/codebuild

.PHONY: clean
clean:
rm -rf dist
Expand Down
5 changes: 0 additions & 5 deletions tests/integration/codebuild-local/Dockerfile.agent

This file was deleted.

Loading
Loading