Fix native tests #64
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
name: Build or Publish | |
on: [ push, workflow_dispatch ] | |
jobs: | |
natives: | |
strategy: | |
matrix: | |
include: | |
# Win x86 | |
- os: windows-2022 | |
arch: x86 | |
java_arch: x86 | |
msvc_arch: amd64_x86 | |
args: -DtargetArch=x86 | |
# Win x64 | |
- os: windows-2022 | |
arch: x64 | |
msvc_arch: amd64 | |
# Win Arm64 | |
- os: windows-2022 | |
arch: arm64 | |
java_arch: x64 | |
msvc_arch: amd64_arm64 | |
extra_java: 17 | |
vendor: zulu | |
args: -DtargetArch=arm64 -DtargetJavaHomeVar=JAVA_HOME_17_ARM64 | |
# Mac Intel (x64) | |
- os: macos-13 | |
arch: x64 | |
args: -DtargetJavaHome="$JAVA_HOME_8_X64" | |
# Mac Silicon (arm64) | |
- os: macos-14 | |
arch: arm64 | |
java_arch: arm64 | |
# Linux i386 | |
- os: ubuntu-20.04 | |
arch: i386 | |
java_arch: x64 | |
linux_arch: i386 | |
packages: gcc-multilib | |
extra_java: 11 | |
vendor: zulu | |
args: -DtargetJavaHome="$JAVA_HOME_11_I386" -DtargetArch=i386 | |
# Linux amd64 Java 8 | |
- os: ubuntu-20.04 | |
arch: amd64 | |
java_arch: x64 | |
# Linux amd64 Java 11+ | |
- os: ubuntu-20.04 | |
arch: amd64 | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup build dependencies | |
- if: 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.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 }} | |
# Setup target java | |
- 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 }} | |
# Setup runtime java | |
- if: 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 }} | |
# Build natives | |
- name: Build natives | |
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: natives-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.extra_java }}-${{ matrix.java_arch }} | |
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 | |
args: -DtargetJavaHome="$JAVA_HOME_11_AARCH64" -DtargetArch=aarch64 | |
- 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 | |
args: -DtargetJavaHome="$JAVA_HOME_11_PPC64LE" -DtargetArch=ppc64le | |
- 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 | |
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-riscv64" -DtargetArch=riscv64 | |
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 }} | |
- name: Build natives | |
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace | |
env: | |
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 | |
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-armhf" -DtargetArch=armhf | |
- arch: armel | |
image: oldstable-backports | |
packages: gcc-arm-linux-gnueabi libc6-dev-armel-cross g++-arm-linux-gnueabi | |
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-armel" -DtargetArch=armel | |
# - 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: Build natives | |
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace | |
env: | |
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 }} |