Add workflow job to ensure native loading works of cross compiled lib… #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------------- | |
# Copyright 2024 The Netty Project | |
# | |
# The Netty Project licenses this file to you under the Apache License, | |
# version 2.0 (the "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at: | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |
# License for the specific language governing permissions and limitations | |
# under the License. | |
# ---------------------------------------------------------------------------- | |
name: Verify native library loading | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryhandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=240 | |
jobs: | |
install-jars-linux-aarch64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Caching of maven dependencies | |
- uses: actions/cache@v4 | |
continue-on-error: true | |
with: | |
path: ~/.m2/repository | |
key: sinstall-jars-linux-aarch64-maven-cache-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
install-jars-linux-aarch64-maven-cache- | |
- name: Build docker image | |
run: docker compose -f docker/docker-compose.centos-7-cross.yaml build | |
- name: Build project and install jars | |
run: docker compose -f docker/docker-compose.centos-7-cross.yaml run cross-compile-aarch64-install | |
- name: Upload the maven repository | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maven-repository | |
# We only need the netty jars. | |
path: ~/.m2/repository/io/netty/ | |
if-no-files-found: error | |
load-native-linux-aarch64: | |
# The host should always be Linux | |
runs-on: ubuntu-latest | |
needs: [ install-jars-linux-aarch64 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download the maven repository | |
uses: actions/download-artifact@v4 | |
with: | |
name: maven-repository | |
path: /home/runner/jars | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Check native loading | |
id: runcmd | |
with: | |
arch: aarch64 | |
distro: ubuntu20.04 | |
# Not required, but speeds up builds by storing container images in | |
# a GitHub package registry. | |
githubToken: ${{ github.token }} | |
# Mount the .m2/repository | |
dockerRunArgs: | | |
--volume "/home/runner/jars:/root/jars" | |
# Install dependencies | |
install: | | |
apt-get update -q -y | |
apt-get install -q -y openjdk-11-jdk | |
apt-get clean -q -y | |
# Check if we can load the native code on aarch64 | |
run: | | |
.github/scripts/check_load_native.sh /root/jars io.netty.incubator.codec.hpke.boringssl.BoringSSLHPKE ensureAvailability |