Skip to content

Use Dockerfile and script for building in container instead of running the entire job in the container #122

Use Dockerfile and script for building in container instead of running the entire job in the container

Use Dockerfile and script for building in container instead of running the entire job in the container #122

Workflow file for this run

name: Compile and deploy snapshot artifacts
on: [push, pull_request] # Don't worry, the actual deployment is guarded with an "if" and only done on push to master
env:
GRADLE_USER_HOME: .gradle
# Needed in order to use Node 16. Node 20 does not work with glibc 2.17
# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- run: mkdir -p SDL/build-macosarm64
# No --disable-video for macOS https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c70c727c98b24ad8b44e05285b8785be15062af0
- run: ../configure --host=aarch64-apple-darwin CFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" CPPFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" LDFLAGS="-arch arm64 -mmacosx-version-min=10.7" --disable-audio --disable-video-vulkan --disable-render --disable-filesystem --disable-threads --disable-directx --disable-mmx --disable-3dnow --disable-sse --disable-sse2 --disable-sse3 --disable-cpuinfo --disable-sensor --enable-hidapi --disable-joystick-mfi
working-directory: SDL/build-macosarm64
- run: make -j
working-directory: SDL/build-macosarm64
- run: mkdir -p SDL/build-macos64
# No --disable-video for macOS https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c70c727c98b24ad8b44e05285b8785be15062af0
- run: ../configure CFLAGS="-arch x86_64 -fPIC -mmacosx-version-min=10.7" CPPFLAGS="-arch x86_64 -fPIC -mmacosx-version-min=10.7" LDFLAGS="-arch x86_64 -mmacosx-version-min=10.7" --disable-audio --disable-video-vulkan --disable-render --disable-filesystem --disable-threads --disable-directx --disable-mmx --disable-3dnow --disable-sse --disable-sse2 --disable-sse3 --disable-cpuinfo --disable-sensor --enable-hidapi --disable-joystick-mfi
working-directory: SDL/build-macos64
- run: make -j
working-directory: SDL/build-macos64
- run: sudo make install
working-directory: SDL/build-macos64
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew jnigen jnigenBuild
- name: Upload macOS natives
uses: actions/upload-artifact@v4
with:
name: macos-natives
path: libs
linux:
needs: macos
runs-on: ubuntu-20.04
env:
ORG_GRADLE_PROJECT_GITHUB_USERNAME: ""
ORG_GRADLE_PROJECT_GITHUB_API_TOKEN: ""
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Download macOS natives
uses: actions/download-artifact@v4
with:
name: macos-natives
path: libs
# Build natives and snapshot in docker container
- name: Build in Docker Container
uses: ./.github/actions/docker
id: docker
- name: Upload all output libs
uses: actions/upload-artifact@v4
with:
name: output-libs
path: build/libs/
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
# Snapshot was built inside docker container
- name: Snapshot deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx'
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run:
./gradlew publish --no-daemon