Skip to content

De-hardcode natives build process Part 2 #51

De-hardcode natives build process Part 2

De-hardcode natives build process Part 2 #51

name: Build or Publish
on: [ push, workflow_dispatch ]
jobs:
natives:
strategy:
matrix:
include:
- os: windows-2022
arch: x86
java_arch: x86
msvc_arch: amd64_x86
args: -Dtarget.arch=x86
- os: windows-2022
arch: x64
msvc_arch: amd64
- os: windows-2022
arch: arm64
msvc_arch: amd64_arm64
extra_java: 17
vendor: zulu
args: -Dtarget.java.home="$JAVA_HOME_17_ARM64" -Dtarget.arch=arm64
- os: macos-13
arch: x64
args: -Dtarget.java.home="$JAVA_HOME_8_X64"
- os: macos-14
arch: arm64
java_arch: arm64
- os: ubuntu-20.04
arch: i386
linux_arch: i386
packages: gcc-multilib
extra_java: 11
vendor: zulu
args: -Dtarget.java.home="JAVA_HOME_11_I386"
- os: ubuntu-20.04
arch: amd64
args: -Dtarget.java.home="$JAVA_HOME_8_X64" -Dtarget.java.version="1.8"
- os: ubuntu-20.04
arch: amd64
java_arch: x64
extra_java: 11
vendor: zulu
args: -Dtarget.java.home="$JAVA_HOME_11_X64"
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
- if: (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04') && matrix.linux_arch
run: |
sudo dpkg --add-architecture ${{ matrix.linux_arch }} && sudo apt-get clean && sudo apt-get update
sudo apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }} libx11-dev:${{ matrix.linux_arch }} libxrandr-dev:${{ matrix.linux_arch }} libxext-dev:${{ matrix.linux_arch }} libxcursor-dev:${{ matrix.linux_arch }} libxxf86vm-dev:${{ matrix.linux_arch }}
- if: matrix.extra_java
name: Set up ${{ matrix.arch }} ${{ matrix.vendor }} JDK ${{ matrix.extra_java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.extra_java }}
distribution: ${{ matrix.vendor }}
architecture: ${{ matrix.arch }}
- if: (matrix.os == 'ubuntu-20.04' && matrix.arch == 'amd64' && matrix.extra_java == '11') != true && matrix.java_arch
name: Set up ${{ matrix.java_arch }} zulu JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
architecture: ${{ matrix.java_arch }}
- if: (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04') && matrix.arch == 'amd64'
run: sudo apt install libx11-dev libxrandr-dev libxext-dev libxcursor-dev libxxf86vm-dev
- if: matrix.os == 'windows-latest' || matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvc_arch }}
- if: (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04')
run: echo "${{ matrix.java_test_home }}"
- name: Build natives
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace
env:
ARCHITECTURE: ${{ matrix.arch }}
TARGET_JAVA: /usr/lib/jvm/java-11-openjdk-${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: natives-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.extra_java }}
path: |
lwjgl-platform/build/natives/lwjgl*.dll
lwjgl-platform/build/natives/liblwjgl*.so
lwjgl-platform/build/natives/liblwjgl*.dylib
natives-cross:
runs-on: ubuntu-latest
container:
image: ${{matrix.os}}
strategy:
matrix:
include:
- os: ubuntu:20.04
arch: aarch64
java_arch: x64
linux_arch: arm64
packages: gcc-aarch64-linux-gnu libc6-dev-arm64-cross g++-aarch64-linux-gnu
extra_java: 11
vendor: zulu
- os: ubuntu:20.04
arch: ppc64le
java_arch: x64
linux_arch: ppc64el
packages: gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross g++-powerpc64le-linux-gnu
extra_java: 11
vendor: temurin
- os: ubuntu:20.04
arch: riscv64
java_arch: x64
linux_arch: riscv64
packages: gcc-riscv64-linux-gnu libc6-dev-riscv64-cross g++-riscv64-linux-gnu
continue-on-error: true
steps:
- uses: actions/checkout@v4
- run: |
sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list
grep "ubuntu.com/ubuntu" /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list
sed -i 's/amd64,i386/${{matrix.linux_arch}}/' /etc/apt/sources.list.d/ports.list
sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list
dpkg --add-architecture ${{ matrix.linux_arch }} && apt-get clean && apt-get update
apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }} libx11-dev:${{ matrix.linux_arch }} libxrandr-dev:${{ matrix.linux_arch }} libxext-dev:${{ matrix.linux_arch }} libxcursor-dev:${{ matrix.linux_arch }} libxxf86vm-dev:${{ matrix.linux_arch }}
- if: matrix.arch == 'riscv64'
run: apt-get -yq -f --allow-unauthenticated --no-install-suggests install openjdk-11-jdk:${{ matrix.linux_arch }}
- if: matrix.extra_java
name: Set up ${{ matrix.arch }} ${{ matrix.vendor }} JDK ${{ matrix.extra_java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.extra_java }}
distribution: ${{ matrix.vendor }}
architecture: ${{ matrix.arch }}
- if: (matrix.os == 'ubuntu-20.04' && matrix.arch == 'amd64' && matrix.extra_java == '11') != true
name: Set up ${{ matrix.java_arch }} zulu JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
architecture: ${{ matrix.java_arch }}
- name: Build natives
run: ./gradlew compile_native --stacktrace
env:
ARCHITECTURE: ${{ matrix.arch }}
TARGET_JAVA: /usr/lib/jvm/java-11-openjdk-${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: natives-linux-${{ matrix.arch }}
path: |
lwjgl-platform/build/natives/liblwjgl*.so
natives-debian:
strategy:
matrix:
include:
- arch: armhf
image: oldstable-backports
packages: gcc-arm-linux-gnueabihf libc6-dev-armhf-cross g++-arm-linux-gnueabihf
- arch: armel
image: oldstable-backports
packages: gcc-arm-linux-gnueabi libc6-dev-armel-cross g++-arm-linux-gnueabi
# - arch: powerpc
# image: sid
# packages: gcc-powerpc-linux-gnu libc6-dev-powerpc-cross g++-powerpc-linux-gnu
# - arch: ppc64
# image: sid
# packages: gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross g++-powerpc64-linux-gnu
runs-on: ubuntu-latest
continue-on-error: true
container:
image: debian:${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- if: matrix.image == 'sid'
run: |
apt-get clean && apt-get update && apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install debian-ports-archive-keyring
echo "deb http://ftp.ports.debian.org/debian-ports unstable main" > /etc/apt/sources.list
echo "deb http://ftp.ports.debian.org/debian-ports unreleased main" > /etc/apt/sources.list
echo "deb http://ftp.ports.debian.org/debian-ports experimental main" > /etc/apt/sources.list
- run: dpkg --add-architecture ${{ matrix.arch }} && apt-get clean && apt-get update
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }}
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install libx11-dev:${{ matrix.arch }} libxrandr-dev:${{ matrix.arch }} libxext-dev:${{ matrix.arch }} libxcursor-dev:${{ matrix.arch }} libxxf86vm-dev:${{ matrix.arch }}
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install openjdk-11-jdk:${{ matrix.arch }}
- name: Set up x64 zulu JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
architecture: x64
- name: Build natives
run: ./gradlew compile_native --stacktrace
env:
ARCHITECTURE: ${{ matrix.arch }}
TARGET_JAVA: /usr/lib/jvm/java-11-openjdk-${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: natives-linux-${{ matrix.arch }}
path: |
lwjgl-platform/build/natives/liblwjgl*.so
build:
runs-on: ubuntu-latest
needs: [natives, natives-debian, natives-cross]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- uses: actions/download-artifact@v4
with:
path: lwjgl-platform/build/natives
pattern: natives-*
merge-multiple: true
- name: Build
run: ./gradlew publishToMavenLocal --stacktrace
- uses: actions/upload-artifact@v4
with:
name: maven
path: ~/.m2/repository
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Publish to Maven
run: ./gradlew publish --stacktrace
env:
MAVEN_PUBLISH_CREDENTIALS: ${{ secrets.MAVEN_PUBLISH_CREDENTIALS }}