Unciv/.github/workflows/buildMultiplatform.yml
dependabot[bot] 0fb32d8f3f
Bump gradle/gradle-build-action in /.github/workflows (#9302)
Bumps [gradle/gradle-build-action](https://github.com/gradle/gradle-build-action) from 2.3.3 to 2.4.2.
- [Release notes](https://github.com/gradle/gradle-build-action/releases)
- [Commits](https://github.com/gradle/gradle-build-action/compare/v2.3.3...v2.4.2)

---
updated-dependencies:
- dependency-name: gradle/gradle-build-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-01 19:01:29 +03:00

140 lines
3.9 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 execute code checks and unit tests on the project source
code-checks:
name: Check code and run unit tests (Java ${{ matrix.java_version }})
strategy:
matrix:
java_version:
- 11
- 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
cache: 'gradle'
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- name: Compile kotlin and build classes
run: ./gradlew classes
- name: Run code checks
run: ./gradlew check
- name: Run unit tests
run: ./gradlew --no-build-cache cleanTest test tests:test
# Job to build the android files on a Ubuntu host
build-android:
strategy:
matrix:
java_version:
- 11
- 17
runs-on: ubuntu-latest
name: Build Android (Java ${{ matrix.java_version }})
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
cache: 'gradle'
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- 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@v3
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:
- 11
- 17
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
cache: 'gradle'
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- 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@v3
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@v3
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