Unciv/.github/workflows/buildMultiplatform.yml

111 lines
3.2 KiB
YAML

# Jobs to test the code base and build the client and server app
name: Build Multiplatform
on:
push:
# This is an expensive run, and we don't need it on *every single* push.
# Once when deploying a version is a good compromise.
tags:
- '*'
jobs:
# Job to build the android files on a Ubuntu host
build-android:
strategy:
matrix:
java_version:
- 17
runs-on: ubuntu-latest
name: Build Android (Java ${{ matrix.java_version }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
cache: 'gradle'
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build Android debug and release files
run: |
mkdir whatsNewDirectory
echo "Nothing changed so far" > whatsNewDirectory/whatsnew-en-US
set -x
./gradlew :android:bundleDebug
./gradlew :android:assembleDebug
./gradlew :android:bundleRelease
./gradlew :android:assembleRelease
- name: Upload Android artifacts
uses: actions/upload-artifact@v4
with:
name: Android (built with Java ${{ matrix.java_version }})
path: |
android/build/outputs/apk/*/*.apk
android/build/outputs/bundle/*/*.aab
retention-days: 1
continue-on-error: true
# Job to build the desktop and server JAR files on all available platforms
build-desktop:
defaults:
run:
# Ensures that a UNIX-like shell is available (default would be Powershell on Windows)
shell: sh
name: Build Desktop for ${{ matrix.os }} (Java ${{ matrix.java_version }})
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
java_version:
- 17
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
cache: 'gradle'
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build the Desktop app
run: ./gradlew desktop:dist
- name: Build the Java server
run: ./gradlew server:dist
- name: Upload Desktop artifacts
uses: actions/upload-artifact@v4
with:
name: Desktop (built with Java ${{ matrix.java_version }})
path: desktop/build/libs/*.jar
retention-days: 1
# Only run this step on ubuntu-latest, since Java is cross-platform anyways
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true
- name: Upload Java server artifacts
uses: actions/upload-artifact@v4
with:
name: Server (built with Java ${{ matrix.java_version }})
path: server/build/libs/*.jar
retention-days: 1
# Only run this step on ubuntu-latest, since Java is cross-platform anyways
if: ${{ matrix.os == 'ubuntu-latest' }}
continue-on-error: true