perf(build): keep only the snappy JNI libraries the image will use (#2940)

* perf(build): keep only the snappy JNI libraries the image can load

snappy-java registers its JNI library for 27 platforms as native image
resources. Only the one for the running platform can load.

Downsize Docker image size from 274.4 to 267.5 MiB,
88.7 to 86.6 MB gzipped.

* ci(compat): run the native compatibility suite on amd64 too

The native image ships for linux/amd64 and linux/arm64, but only arm64
ever ran the compatibility suite. An arch-specific resource in the native
image could go missing on amd64 and no PR check would catch it. The
snappy-java JNI library is one such resource.

Both jobs now run once per architecture.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-09-02 20:00:00 -05:00
1 parent 44655751c6
commit 4ce53b51d6
2 files changed
+50 -10

No files matched your search

+29 -10
View File
@@ -103,9 +103,20 @@ jobs:
run: python3 .github/ci/compat-opentofu-drift-check.py
build-native:
name: Build native floci image
runs-on: ubuntu-24.04-arm
name: Build native floci image (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
# Both published architectures. The native image is the only place an
# arch-specific resource can go missing (snappy-java's JNI library is
# registered per platform), and one arch cannot prove the other.
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: ubuntu-24.04-arm
- arch: amd64
runner: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
@@ -125,7 +136,7 @@ jobs:
# reads the ~/.m2 that ci.yml's shard 1 saves on every push to main. ci.yml
# stays the single owner of the save; a second writer would just race it.
# Two known partial-hit caveats, both cheap: `runner.os` is Linux for both
# but ci.yml runs x64 while this runs arm64 (Maven artifacts are
# but ci.yml runs x64 while the arm64 leg here does not (Maven artifacts are
# arch-neutral, so only classifier-based natives re-download), and
# `-Dnative` pulls native-image plugins that ci.yml's `mvn test` never
# fetches. Expect most of the ~66s of cold resolution back, not all of it.
@@ -140,10 +151,10 @@ jobs:
- name: Stage native binary for packaging
run: |
mkdir -p native/arm64
cp target/*-runner native/arm64/application
mkdir -p native/${{ matrix.arch }}
cp target/*-runner native/${{ matrix.arch }}/application
# include any sidecar .so the runtime image may need (matches nightly artifact set)
cp target/*.so native/arm64/ 2>/dev/null || true
cp target/*.so native/${{ matrix.arch }}/ 2>/dev/null || true
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
@@ -169,18 +180,21 @@ jobs:
- name: Upload native floci image
uses: actions/upload-artifact@v7
with:
name: floci-native-image
name: floci-native-image-${{ matrix.arch }}
path: /tmp/floci-native-image.tar.gz
retention-days: 1
native-compat-test:
name: native / ${{ matrix.test }}
name: native ${{ matrix.arch }} / ${{ matrix.test }}
needs: build-native
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
arch:
- arm64
- amd64
test:
- sdk-test-node
- sdk-test-python
@@ -190,12 +204,17 @@ jobs:
- compat-cdk
- compat-terraform
- compat-opentofu
include:
- arch: arm64
runner: ubuntu-24.04-arm
- arch: amd64
runner: ubuntu-latest
steps:
- name: Download native floci image
uses: actions/download-artifact@v8
with:
name: floci-native-image
name: floci-native-image-${{ matrix.arch }}
path: /tmp
- name: Load native floci image
+21
View File
@@ -40,6 +40,27 @@ quarkus:
- iam/*.yaml
- i18n/*.properties
- org/apache/velocity/runtime/defaults/*.properties
# snappy-java registers 27 JNI libraries, one per platform. Only the one
# for the running platform loads, so 23 are dropped. Linux x86_64 and
# aarch64 cover the published images, Mac covers a local native build.
excludes:
- org/xerial/snappy/native/AIX/**
- org/xerial/snappy/native/FreeBSD/**
- org/xerial/snappy/native/SunOS/**
- org/xerial/snappy/native/Windows/**
- org/xerial/snappy/native/Linux/android-aarch64/**
- org/xerial/snappy/native/Linux/android-arm/**
- org/xerial/snappy/native/Linux/arm/**
- org/xerial/snappy/native/Linux/armv6/**
- org/xerial/snappy/native/Linux/armv7/**
- org/xerial/snappy/native/Linux/loongarch64/**
- org/xerial/snappy/native/Linux/ppc/**
- org/xerial/snappy/native/Linux/ppc64/**
- org/xerial/snappy/native/Linux/ppc64le/**
- org/xerial/snappy/native/Linux/riscv64/**
- org/xerial/snappy/native/Linux/s390x/**
- org/xerial/snappy/native/Linux/x86/**
- org/xerial/snappy/native/Linux/x86_64-musl/**
additional-build-args:
- --report-unsupported-elements-at-runtime
- --allow-incomplete-classpath