Skip to content

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

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 #130

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
jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
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 --no-daemon
- name: Upload macOS natives
uses: actions/upload-artifact@v3
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@v3
with:
name: macos-natives
path: libs
- name: Build natives in Docker Container
uses: ./.github/actions/docker
id: docker
- name: Upload all output libs
uses: actions/upload-artifact@v3
with:
name: output-libs
path: build/libs/
- name: Set up JDK 8
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx'
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- name: Setup Gradle
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx'
uses: gradle/gradle-build-action@v2.4.2
- name: Snapshot build 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:
# Execute permission was granted in the docker script
./gradlew build publish --no-daemon