mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-11-28 08:08:03 -08:00
123 lines
5.0 KiB
YAML
123 lines
5.0 KiB
YAML
name: Builds - MacOS
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
buildForAllPlatformsMacOS:
|
|
name: ${{ matrix.targetPlatform }} on ${{ matrix.unityVersion }}
|
|
# Dependabot-triggered runs receive no Actions secrets, so the Unity
|
|
# licence these builds need is absent. Ubuntu builds (embedded licence)
|
|
# and the Tests job still cover dependency bumps.
|
|
if: github.actor != 'dependabot[bot]'
|
|
runs-on: macos-latest
|
|
# Kept as a backstop even after splitting the cache save below into its
|
|
# own bounded step: real builds finish in well under 40m, so this only
|
|
# fires if something else entirely hangs.
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
projectPath:
|
|
- test-project
|
|
unityVersion:
|
|
- 2021.3.45f2
|
|
- 2022.3.62f3
|
|
- 2023.2.22f1
|
|
targetPlatform:
|
|
- StandaloneOSX # Build a MacOS executable
|
|
- iOS # Build an iOS executable
|
|
include:
|
|
# Additionally test enableGpu build for a standalone windows target
|
|
- unityVersion: 6000.0.36f1
|
|
targetPlatform: StandaloneOSX
|
|
- unityVersion: 6000.0.36f1
|
|
targetPlatform: StandaloneOSX
|
|
buildProfile: 'Assets/Settings/Build Profiles/Sample macOS Build Profile.asset'
|
|
|
|
steps:
|
|
###########################
|
|
# Checkout #
|
|
###########################
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
###########################
|
|
# Cache (restore) #
|
|
###########################
|
|
# Split from the save side (below) rather than the combined
|
|
# actions/cache@v4: that action's implicit post-run save has been
|
|
# observed hanging indefinitely on macOS runners (unrelated to the
|
|
# cache key itself - confirmed by reproducing it again after fixing a
|
|
# real key collision here). A per-step timeout doesn't bound an
|
|
# implicit post-run cleanup step, only an explicit step does - and
|
|
# caching is a pure optimization, so losing one save is far cheaper
|
|
# than a job stuck "in_progress" for 1.5h+.
|
|
- uses: actions/cache/restore@v4
|
|
id: cache-restore
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
# One cache per build configuration and no prefix fallback: a Library
|
|
# remembers the settings of the build that produced it (such as the
|
|
# standalone subtarget), so restoring another configuration's Library
|
|
# changes what gets built. Bump the version to discard every Library cache.
|
|
key: Library-v2-${{ matrix.projectPath }}-macos-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-il2cpp-true-subtarget-player-${{ matrix.buildProfile }}
|
|
|
|
###########################
|
|
# Set Scripting Backend #
|
|
###########################
|
|
- name: Set Scripting Backend To il2cpp
|
|
run: |
|
|
mv -f "./test-project/ProjectSettings/ProjectSettingsIl2cpp.asset" "./test-project/ProjectSettings/ProjectSettings.asset"
|
|
|
|
###########################
|
|
# Build #
|
|
###########################
|
|
- uses: ./
|
|
env:
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
with:
|
|
buildName: 'GameCI Test Build'
|
|
projectPath: ${{ matrix.projectPath }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
targetPlatform: ${{ matrix.targetPlatform }}
|
|
buildProfile: ${{ matrix.buildProfile }}
|
|
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
# We use dirty build because we are replacing the default project settings file above
|
|
allowDirtyBuild: true
|
|
|
|
###########################
|
|
# Upload #
|
|
###########################
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})${{ matrix.buildProfile && ' With Build Profile' || '' }}
|
|
path: build
|
|
retention-days: 14
|
|
|
|
###########################
|
|
# Cache (save) #
|
|
###########################
|
|
# A bounded, non-fatal step (unlike the combined action's implicit
|
|
# post-run save): a hang here is killed after 5m instead of stalling
|
|
# the whole job, and continue-on-error means a failed/timed-out save
|
|
# never fails the build - only a real cache miss on the next run,
|
|
# which is a much cheaper failure mode.
|
|
- if: steps.cache-restore.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
timeout-minutes: 5
|
|
continue-on-error: true
|
|
with:
|
|
path: ${{ matrix.projectPath }}/Library
|
|
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
|