Merge pull request #168 from Glavo/master #190
This file contains hidden or 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
# This workflow will build the native component for different platforms using | |
# qemu-user & docker | |
name: Build Linux Binaries | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
native: | |
# Switch back to ubuntu-latest after that maps to 20.04 | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
arch: | |
# https://github.com/adoptium/temurin-build/issues/986 | |
# - "386" | |
- amd64 | |
- arm | |
- arm64 | |
- linux-arm-v5 | |
- riscv64 | |
# this build does not work and ends up just rebuilding x86_64 | |
#- s390x | |
fail-fast: false | |
name: Linux binary ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- uses: satackey/action-docker-layer-caching@v0.0.11 | |
continue-on-error: true | |
- name: Update System | |
run: sudo apt-get update -y | |
- name: Install qemu | |
run: sudo apt-get install -y --no-install-recommends qemu-user-static | |
- name: Initialize environment variables | |
run: | | |
if [[ "${{ matrix.arch }}" == "riscv64" ]]; then | |
echo "DOCKER_IMAGE_NAME=debian:trixie" >> $GITHUB_ENV | |
else | |
echo "DOCKER_IMAGE_NAME=debian:10" >> $GITHUB_ENV | |
fi | |
- name: Pull docker image | |
run: docker pull --platform $(echo ${{ matrix.arch }} | sed 's|-|/|g') "$DOCKER_IMAGE_NAME" || true | |
- name: Build inside Docker | |
run: docker run --rm -v $GITHUB_WORKSPACE:/work "$DOCKER_IMAGE_NAME" /work/.github/build-native-debian.sh | |
- name: Archive built library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shared-object-${{ matrix.arch }} | |
path: build/jni/*.so | |
- name: Archive built jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jar-${{ matrix.arch }} | |
path: archive/*.jar | |