Skip to content

Commit a32b1e4

Browse files
authored
fix: speed up CI (#634)
* fix: speed up CI * fix: build native JNI lib on aarch64 CI runners The multiArch=false path skips architectures whose name doesn't match the host arch, but ARCHITECTURES uses Maven's classifier spelling 'aarch_64' while `arch` reports 'aarch64'. On the ARM runner this mismatch caused every arch to be skipped, so no .so was built and the unit tests crashed loading the native library. Normalize the host arch to 'aarch_64' before comparing. * fix: speed up smoke tests * fix: pr comments
1 parent b668333 commit a32b1e4

5 files changed

Lines changed: 89 additions & 23 deletions

File tree

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

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,17 @@ permissions:
1919

2020
jobs:
2121

22-
smoke-test:
23-
runs-on: ubuntu-latest
22+
smoke-test-arch:
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
include:
27+
- arch: x86_64
28+
runner: ubuntu-latest
29+
- arch: aarch64
30+
runner: ubuntu-24.04-arm
31+
runs-on: ${{ matrix.runner }}
32+
name: "smoke-test (${{ matrix.arch }})"
2433
steps:
2534
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2635

@@ -39,14 +48,23 @@ jobs:
3948
working-directory: ./aws-lambda-java-serialization
4049
run: mvn clean install
4150

42-
- name: Runtime Interface Client smoke tests - Run 'pr' target
51+
- name: Runtime Interface Client smoke tests - Run 'pr-${{ matrix.arch }}' target
4352
working-directory: ./aws-lambda-java-runtime-interface-client
44-
run: make pr
53+
run: make pr-${{ matrix.arch }}
4554
env:
4655
IS_JAVA_8: true
4756

48-
build:
49-
runs-on: ubuntu-latest
57+
build-arch:
58+
strategy:
59+
fail-fast: true
60+
matrix:
61+
include:
62+
- arch: x86_64
63+
runner: ubuntu-latest
64+
- arch: aarch64
65+
runner: ubuntu-24.04-arm
66+
runs-on: ${{ matrix.runner }}
67+
name: "build (${{ matrix.arch }})"
5068
steps:
5169
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5270

@@ -57,17 +75,11 @@ jobs:
5775
distribution: corretto
5876
cache: maven
5977

60-
- name: Set up QEMU
61-
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
62-
6378
- name: Set up Docker Buildx
6479
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
6580
with:
6681
install: true
6782

68-
- name: Available buildx platforms
69-
run: echo ${{ steps.buildx.outputs.platforms }}
70-
7183
- name: Build and install core dependency locally
7284
working-directory: ./aws-lambda-java-core
7385
run: mvn clean install
@@ -76,20 +88,44 @@ jobs:
7688
working-directory: ./aws-lambda-java-serialization
7789
run: mvn clean install
7890

79-
- name: Test Runtime Interface Client xplatform build - Run 'build' target
91+
- name: Test Runtime Interface Client build - Run 'build-${{ matrix.arch }}' target
8092
working-directory: ./aws-lambda-java-runtime-interface-client
81-
run: make build
93+
run: make build-${{ matrix.arch }}
8294
env:
8395
IS_JAVA_8: true
8496

8597
- name: Save the built jar
8698
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
8799
with:
88-
name: aws-lambda-java-runtime-interface-client
100+
name: aws-lambda-java-runtime-interface-client-${{ matrix.arch }}
89101
path: ./aws-lambda-java-runtime-interface-client/target/aws-lambda-java-runtime-interface-client-*.jar
90102

91103
- name: Upload coverage to Codecov
92104
if: env.CODECOV_TOKEN != null
93105
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
94106
env:
95107
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
108+
109+
smoke-test:
110+
needs: smoke-test-arch
111+
if: always()
112+
runs-on: ubuntu-latest
113+
steps:
114+
- name: Check smoke-test results
115+
run: |
116+
if [ "${{ needs.smoke-test-arch.result }}" != "success" ]; then
117+
echo "Smoke tests failed on one or more architectures"
118+
exit 1
119+
fi
120+
121+
build:
122+
needs: build-arch
123+
if: always()
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Check build results
127+
run: |
128+
if [ "${{ needs.build-arch.result }}" != "success" ]; then
129+
echo "Build failed on one or more architectures"
130+
exit 1
131+
fi

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@ setup-codebuild-agent:
3030
--build-arg ARCHITECTURE=$(ARCHITECTURE_ALIAS) \
3131
- < test/integration/codebuild-local/Dockerfile.agent
3232

33+
# Smoke tests are split per-architecture so CI can run each set on a native
34+
# runner. Running the linux/arm64/v8 combos under QEMU on an x86_64 host makes
35+
# `mvn install` recompile curl for aarch64 emulated, which takes ~30 minutes.
3336
.PHONY: test-smoke
34-
test-smoke: setup-codebuild-agent
37+
test-smoke: test-smoke-x86_64 test-smoke-aarch64
38+
39+
.PHONY: test-smoke-x86_64
40+
test-smoke-x86_64: setup-codebuild-agent
3541
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 corretto11 linux/amd64
36-
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 corretto11 linux/arm64/v8
3742
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.amazoncorretto.yml amazoncorretto amazoncorretto 11 linux/amd64
43+
44+
.PHONY: test-smoke-aarch64
45+
test-smoke-aarch64: setup-codebuild-agent
46+
CODEBUILD_IMAGE_TAG=codebuild-agent test/integration/codebuild-local/test_one.sh test/integration/codebuild/buildspec.os.alpine.yml alpine 3.15 corretto11 linux/arm64/v8
3847
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
3948

4049
.PHONY: test-integ
@@ -49,11 +58,25 @@ dev: test
4958
.PHONY: pr
5059
pr: test test-smoke
5160

61+
# Per-architecture PR checks so CI can run each on a native runner (no QEMU).
62+
.PHONY: pr-x86_64
63+
pr-x86_64: test test-smoke-x86_64
64+
65+
.PHONY: pr-aarch64
66+
pr-aarch64: test test-smoke-aarch64
67+
5268
.PHONY: build
53-
build:
54-
mvn clean install $(EXTRA_LOAD_ARG)
69+
build: build-x86_64 build-aarch64
70+
71+
.PHONY: build-x86_64
72+
build-x86_64:
73+
mvn clean install -DmultiArch=false $(EXTRA_LOAD_ARG)
5574
mvn install -P linux-x86_64 $(EXTRA_LOAD_ARG)
5675
mvn install -P linux_musl-x86_64 $(EXTRA_LOAD_ARG)
76+
77+
.PHONY: build-aarch64
78+
build-aarch64:
79+
mvn clean install -DmultiArch=false $(EXTRA_LOAD_ARG)
5780
mvn install -P linux-aarch64 $(EXTRA_LOAD_ARG)
5881
mvn install -P linux_musl-aarch64 $(EXTRA_LOAD_ARG)
5982

aws-lambda-java-runtime-interface-client/src/main/jni/build-jni-lib.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,17 @@ else
118118
declare -a ARCHITECTURES=("x86_64" "aarch_64")
119119
declare -a LIBC_IMPLS=("glibc" "musl")
120120

121+
# `arch` reports the host as `aarch64`, but we use Maven's classifier
122+
# spelling `aarch_64` in ARCHITECTURES, so normalize before comparing.
123+
host_arch=$(arch)
124+
if [ "${host_arch}" == "aarch64" ]; then
125+
host_arch="aarch_64"
126+
fi
127+
121128
for arch in "${ARCHITECTURES[@]}"; do
122129

123-
if [[ "${MULTI_ARCH}" != "true" ]] && [[ "$(arch)" != "${arch}" ]]; then
124-
echo "multi arch build not requested and host arch is $(arch), so skipping ${arch}..."
130+
if [[ "${MULTI_ARCH}" != "true" ]] && [[ "${host_arch}" != "${arch}" ]]; then
131+
echo "multi arch build not requested and host arch is ${host_arch}, so skipping ${arch}..."
125132
continue
126133
fi
127134

aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.alpine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ phases:
4545
# Install serialization (dependency of RIC)
4646
- (cd aws-lambda-java-core && mvn install)
4747
- (cd aws-lambda-java-serialization && mvn install)
48-
- (cd aws-lambda-java-runtime-interface-client && mvn install -DargLineForReflectionTestOnly="")
48+
- (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="")
4949
- (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install)
5050
- export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}"
5151
- echo "Extracting and including Runtime Interface Emulator"

aws-lambda-java-runtime-interface-client/test/integration/codebuild/buildspec.os.amazoncorretto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ phases:
4444
# Install serialization (dependency of RIC)
4545
- (cd aws-lambda-java-core && mvn install)
4646
- (cd aws-lambda-java-serialization && mvn install)
47-
- (cd aws-lambda-java-runtime-interface-client && mvn install -DargLineForReflectionTestOnly="")
47+
- (cd aws-lambda-java-runtime-interface-client && mvn install -DmultiArch=false -DargLineForReflectionTestOnly="")
4848
- (cd aws-lambda-java-runtime-interface-client/test/integration/test-handler && mvn install)
4949
- export IMAGE_TAG="java-${OS_DISTRIBUTION}-${DISTRO_VERSION}:${RUNTIME_VERSION}"
5050
- echo "Extracting and including Runtime Interface Emulator"

0 commit comments

Comments
 (0)