Skip to content

fix: Don't enforce jnigenBuild when doing jnigenJarNativesDesktop #2

fix: Don't enforce jnigenBuild when doing jnigenJarNativesDesktop

fix: Don't enforce jnigenBuild when doing jnigenJarNativesDesktop #2

Workflow file for this run

name: Build and publish
on:
push:
branches: [ feat/c-runtime ]
release:
types: [ published ]
jobs:
natives-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build macOS natives
run: |
# See https://github.com/actions/virtual-environments/issues/2557
sudo mv /Library/Developer/CommandLineTools/SDKs/* /tmp
sudo mv /Applications/Xcode.app /Applications/Xcode.app.bak
sudo mv /Applications/Xcode_14.3.1.app /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app
/usr/bin/xcodebuild -version
./gradlew build_ios
./gradlew jniGen jnigenBuildIOS
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" -o -name "*.xcframework" | grep "libs" > native-files-list
zip -r natives-ios -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-ios.zip
path: natives-ios.zip
natives-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build macOS natives
run: |
# See https://github.com/actions/virtual-environments/issues/2557
sudo mv /Library/Developer/CommandLineTools/SDKs/* /tmp
sudo mv /Applications/Xcode.app /Applications/Xcode.app.bak
sudo mv /Applications/Xcode_14.3.1.app /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app
/usr/bin/xcodebuild -version
./gradlew build_macos
./gradlew jniGen jnigenBuildMacOsX64 jnigenBuildMacOsXARM64
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-macos -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-macos.zip
path: natives-macos.zip
natives-linux:
runs-on: ubuntu-20.04
container:
image: ubuntu:18.04
steps:
- name: Install dependencies into minimal dockerfile
run: |
# ubuntu dockerfile is very minimal (only 122 packages are installed)
# need to install updated git (from official git ppa)
apt update
apt install -y software-properties-common
add-apt-repository ppa:git-core/ppa -y
# install dependencies expected by other steps
apt update
apt install -y git \
curl \
ca-certificates \
wget \
bzip2 \
zip \
unzip \
xz-utils \
maven \
ant sudo locales make texinfo
# set Locale to en_US.UTF-8 (avoids hang during compilation)
locale-gen en_US.UTF-8
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "LANGUAGE=en_US.UTF-8" >> $GITHUB_ENV
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Install cross-compilation toolchains
run: |
sudo apt update
sudo apt install -y --force-yes gcc g++
sudo apt install -y --force-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross
sudo apt install -y --force-yes gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross
sudo apt install -y --force-yes gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross
- name: Build Linux natives
run: |
./gradlew build_linux
./gradlew jniGen jnigenBuildLinux64 jnigenBuildLinuxARM jnigenBuildLinuxARM64 jnigenBuildLinuxRISCV64
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-linux -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-linux.zip
path: natives-linux.zip
natives-windows:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Install cross-compilation toolchains
run: |
sudo apt update
sudo apt install -y --force-yes mingw-w64 lib32z1
- name: Build Windows natives
run: |
./gradlew build_windows
./gradlew jniGen jnigenBuildWindows64 jnigenBuildWindows
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-windows -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-windows.zip
path: natives-windows.zip
natives-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Download NDK
run: |
wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip -O android-ndk.zip
echo "769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108 android-ndk.zip" | sha256sum --check
unzip android-ndk.zip
echo "NDK_HOME=$(pwd)/android-ndk-r25c" >> $GITHUB_ENV
- name: Build Android natives
run: |
./gradlew build_android
./gradlew jniGen jnigenBuildAndroid
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-android -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: natives-android.zip
path: natives-android.zip
publish:
runs-on: ubuntu-20.04
needs: [natives-macos, natives-linux, natives-windows, natives-ios, natives-android]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Download natives-ios artifact
uses: actions/download-artifact@v2
with:
name: natives-ios.zip
- name: Download natives-macos artifact
uses: actions/download-artifact@v2
with:
name: natives-macos.zip
- name: Download natives-linux artifact
uses: actions/download-artifact@v2
with:
name: natives-linux.zip
- name: Download natives-windows artifact
uses: actions/download-artifact@v2
with:
name: natives-windows.zip
- name: Download natives-android artifact
uses: actions/download-artifact@v2
with:
name: natives-android.zip
- name: Unpack natives
run: |
unzip -o natives-ios.zip
unzip -o natives-macos.zip
unzip -o natives-linux.zip
unzip -o natives-windows.zip
unzip -o natives-android.zip
- name: Snapshot build deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/feat/c-runtime' && github.repository_owner == 'libgdx'
run: ./gradlew build publish
env:
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Import GPG key
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
id: import_gpg
uses: crazy-max/ghaction-import-gpg@1c6a9e9d3594f2d743f1b1dd7669ab0dfdffa922
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Release build deploy
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
run: ./gradlew build publish -PRELEASE -Psigning.gnupg.keyId=${{ secrets.GPG_KEYID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Psigning.gnupg.keyName=${{ secrets.GPG_KEYID }}
env:
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}