Skip to content

Commit c3e1f95

Browse files
committed
ci: run OS integration tests in PR, parallelized per OS/arch on native runners
1 parent 5f222d2 commit c3e1f95

3 files changed

Lines changed: 59 additions & 5 deletions

File tree

.github/workflows/runtime-interface-client_pr.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,38 @@ jobs:
9393
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
9494
env:
9595
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
96+
97+
integration-test:
98+
runs-on: ${{ matrix.arch.runner }}
99+
strategy:
100+
# Run every OS/arch combination to completion so one failure doesn't mask the others.
101+
fail-fast: false
102+
matrix:
103+
buildspec:
104+
- buildspec.os.alpine.yml
105+
- buildspec.os.amazoncorretto.yml
106+
- buildspec.os.amazonlinux.1.yml
107+
- buildspec.os.amazonlinux.2.yml
108+
- buildspec.os.debian.yml
109+
- buildspec.os.ubuntu.yml
110+
arch:
111+
- label: x64
112+
runner: ubuntu-latest
113+
platform: linux/amd64
114+
- label: arm64
115+
runner: ubuntu-24.04-arm
116+
platform: linux/arm64/v8
117+
name: "integration-test (${{ matrix.buildspec }} / ${{ matrix.arch.label }})"
118+
steps:
119+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
120+
121+
- name: Set up Docker Buildx
122+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
123+
with:
124+
install: true
125+
126+
- name: Run OS integration test - 'test-integ' target
127+
working-directory: ./aws-lambda-java-runtime-interface-client
128+
run: make test-integ BUILDSPEC=test/integration/codebuild/${{ matrix.buildspec }}
129+
env:
130+
PLATFORM_FILTER: ${{ matrix.arch.platform }}

aws-lambda-java-runtime-interface-client/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ test-smoke: setup-codebuild-agent
3737
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11 linux/amd64
3838
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11 linux/arm64/v8
3939

40+
# BUILDSPEC can point to the buildspec directory (default, runs every OS) or to a
41+
# single buildspec file, which is how CI parallelizes the run across OSes.
42+
BUILDSPEC ?= test/integration/codebuild
43+
4044
.PHONY: test-integ
4145
test-integ: setup-codebuild-agent
42-
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_all.sh test/integration/codebuild
46+
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_all.sh $(BUILDSPEC)
4347

4448
# Command to run everytime you make changes to verify everything works
4549
.PHONY: dev

aws-lambda-java-runtime-interface-client/test/integration/codebuild-local/test_all.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ set -euo pipefail
55

66
CODEBUILD_IMAGE_TAG="${CODEBUILD_IMAGE_TAG:-al2/x86_64/standard/3.0}"
77
DRYRUN="${DRYRUN-0}"
8+
# When set, only the matching platform from each buildspec is run. Used by CI to
9+
# run each architecture on its own native runner instead of emulating via QEMU.
10+
PLATFORM_FILTER="${PLATFORM_FILTER-}"
811

912
function usage {
10-
echo "usage: test_all.sh buildspec_yml_dir"
13+
echo "usage: test_all.sh buildspec_yml_dir_or_file"
1114
echo "Runs all buildspec build-matrix combinations via test_one.sh."
1215
echo "Required:"
13-
echo " buildspec_yml_dir Used to specify the CodeBuild buildspec template file."
16+
echo " buildspec_yml_dir_or_file A directory of buildspec templates (runs every *.yml),"
17+
echo " or a single buildspec .yml file."
1418
}
1519

1620
do_one_yaml() {
@@ -21,6 +25,10 @@ do_one_yaml() {
2125
RUNTIME_VERSIONS=$(sed '1,/RUNTIME_VERSION/d;/PLATFORM/,$d' "$YML" | sed '/#.*$/d' | tr -d '\-" ')
2226
PLATFORMS=$(sed '1,/PLATFORM/d;/phases/,$d' "$YML" | tr -d '\-" ')
2327

28+
if [ -n "$PLATFORM_FILTER" ]; then
29+
PLATFORMS="$PLATFORM_FILTER"
30+
fi
31+
2432
for DISTRO_VERSION in $DISTRO_VERSIONS; do
2533
for RUNTIME_VERSION in $RUNTIME_VERSIONS; do
2634
for PLATFORM in $PLATFORMS; do
@@ -56,9 +64,16 @@ main() {
5664
usage
5765
exit 1
5866
fi
59-
BUILDSPEC_YML_DIR="$1"
67+
BUILDSPEC_YML_PATH="$1"
68+
69+
# Allow passing a single buildspec file so CI can parallelize per OS.
70+
if [ -f "$BUILDSPEC_YML_PATH" ]; then
71+
do_one_yaml "$BUILDSPEC_YML_PATH"
72+
return
73+
fi
74+
6075
HAS_YML=0
61-
for f in "$BUILDSPEC_YML_DIR"/*.yml ; do
76+
for f in "$BUILDSPEC_YML_PATH"/*.yml ; do
6277
[ -f "$f" ] || continue;
6378
do_one_yaml "$f"
6479
HAS_YML=1

0 commit comments

Comments
 (0)