|
46 | 46 | unity: 2021.3.45f2 |
47 | 47 | changeset: 88f88f591b2e |
48 | 48 | runner: [self-hosted, macOS, ARM64] |
| 49 | + - target: StandaloneLinux64 |
| 50 | + backend: IL2CPP |
| 51 | + unity: 2021.3.45f2 |
| 52 | + changeset: 88f88f591b2e |
| 53 | + runner: [self-hosted, X64, Linux] |
| 54 | + - target: StandaloneLinux64 |
| 55 | + backend: Mono2x |
| 56 | + unity: 2021.3.45f2 |
| 57 | + changeset: 88f88f591b2e |
| 58 | + runner: [self-hosted, X64, Linux] |
49 | 59 | - target: StandaloneWindows64 |
50 | 60 | backend: IL2CPP |
51 | 61 | unity: 6000.4.0f1 |
@@ -184,6 +194,25 @@ jobs: |
184 | 194 | Write-Host "Verified VC.Tools at: $($state.VcTools)" |
185 | 195 | Write-Host "Verified Win10 SDK at: $($state.Win10Sdk)" |
186 | 196 |
|
| 197 | + - name: Verify IL2CPP toolchain (Linux) |
| 198 | + if: runner.os == 'Linux' && matrix.backend == 'IL2CPP' |
| 199 | + shell: bash |
| 200 | + run: | |
| 201 | + # IL2CPP's C++ to native step links against gcc/g++ + glibc-dev (the |
| 202 | + # build-essential package on Ubuntu). Without these, Unity fails late |
| 203 | + # inside the IL2CPP build with a cryptic linker error. Fail fast here |
| 204 | + # with a clear remediation message instead. |
| 205 | + MISSING="" |
| 206 | + for cmd in gcc g++; do |
| 207 | + command -v "$cmd" >/dev/null 2>&1 || MISSING="${MISSING:+$MISSING+}$cmd" |
| 208 | + done |
| 209 | + if [ -n "$MISSING" ]; then |
| 210 | + echo "::error::IL2CPP toolchain incomplete on runner: $MISSING. Run on the runner host: sudo apt install -y build-essential" |
| 211 | + exit 1 |
| 212 | + fi |
| 213 | + echo "gcc: $(gcc --version | head -1)" |
| 214 | + echo "g++: $(g++ --version | head -1)" |
| 215 | +
|
187 | 216 | - name: Resolve Unity ${{ matrix.unity }} (macOS) |
188 | 217 | if: runner.os == 'macOS' |
189 | 218 | shell: bash |
@@ -280,6 +309,89 @@ jobs: |
280 | 309 | if ('${{ matrix.backend }}' -eq 'IL2CPP') { Write-Host "Found IL2CPP: $il2cpp" } |
281 | 310 | "UNITY_PATH=$editor" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 |
282 | 311 |
|
| 312 | + - name: Resolve Unity ${{ matrix.unity }} (Linux) |
| 313 | + if: runner.os == 'Linux' |
| 314 | + shell: bash |
| 315 | + env: |
| 316 | + UNITY_VER: ${{ matrix.unity }} |
| 317 | + UNITY_CS: ${{ matrix.changeset }} |
| 318 | + run: | |
| 319 | + set -uo pipefail |
| 320 | + HUB="unityhub" |
| 321 | +
|
| 322 | + echo "::group::install editor" |
| 323 | + "$HUB" --headless install \ |
| 324 | + --version "$UNITY_VER" --changeset "$UNITY_CS" --architecture x86_64 \ |
| 325 | + || echo "(install non-zero, OK if 'Editor already installed in this location')" |
| 326 | + echo "::endgroup::" |
| 327 | +
|
| 328 | + if [ "${{ matrix.backend }}" = "IL2CPP" ]; then |
| 329 | + echo "::group::install linux-il2cpp module" |
| 330 | + "$HUB" --headless install-modules \ |
| 331 | + --version "$UNITY_VER" --changeset "$UNITY_CS" --architecture x86_64 \ |
| 332 | + --module linux-il2cpp \ |
| 333 | + || echo "(install-modules non-zero, OK if 'No modules found to install')" |
| 334 | + echo "::endgroup::" |
| 335 | + fi |
| 336 | +
|
| 337 | + EDITOR_PATH="$HOME/Unity/Hub/Editor/$UNITY_VER/Editor/Unity" |
| 338 | +
|
| 339 | + IL2CPP_DIR="" |
| 340 | + if [ "${{ matrix.backend }}" = "IL2CPP" ] && [ -x "$EDITOR_PATH" ]; then |
| 341 | + IL2CPP_DIR="$HOME/Unity/Hub/Editor/$UNITY_VER/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/Variations/linux64_player_nondevelopment_il2cpp" |
| 342 | + [ -d "$IL2CPP_DIR" ] || IL2CPP_DIR="" |
| 343 | + fi |
| 344 | +
|
| 345 | + MISSING="" |
| 346 | + [ -x "$EDITOR_PATH" ] || MISSING="editor" |
| 347 | + [ "${{ matrix.backend }}" = "IL2CPP" ] && [ -z "$IL2CPP_DIR" ] && MISSING="${MISSING:+$MISSING+}linux-il2cpp" |
| 348 | + if [ -n "$MISSING" ]; then |
| 349 | + echo "::error::Unity $UNITY_VER missing: $MISSING" |
| 350 | + ls -la "$HOME/Unity/Hub/Editor/" 2>&1 || true |
| 351 | + "$HUB" --headless editors --installed 2>&1 || true |
| 352 | + exit 1 |
| 353 | + fi |
| 354 | +
|
| 355 | + echo "Found Unity: $EDITOR_PATH" |
| 356 | + [ -n "$IL2CPP_DIR" ] && echo "Found IL2CPP: $IL2CPP_DIR" |
| 357 | + echo "UNITY_PATH=$EDITOR_PATH" >> "$GITHUB_ENV" |
| 358 | +
|
| 359 | + - name: Activate Unity license (Linux) |
| 360 | + if: runner.os == 'Linux' |
| 361 | + shell: bash |
| 362 | + env: |
| 363 | + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
| 364 | + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
| 365 | + UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
| 366 | + run: | |
| 367 | + set -uo pipefail |
| 368 | + # Activate-once-and-cache. Unity Pro/Plus seats are scarce; the license |
| 369 | + # file persists in $HOME on the self-hosted runner so subsequent runs |
| 370 | + # detect it and skip activation. Win/macOS runners are pre-activated |
| 371 | + # manually outside the workflow; Linux activates here because the host |
| 372 | + # was provisioned fresh. |
| 373 | + LICENSE_FILE="$HOME/.local/share/unity3d/Unity/Unity_lic.ulf" |
| 374 | + if [ -f "$LICENSE_FILE" ]; then |
| 375 | + echo "Unity license already cached at $LICENSE_FILE; skipping activation" |
| 376 | + exit 0 |
| 377 | + fi |
| 378 | +
|
| 379 | + echo "::group::Activate Unity" |
| 380 | + # Unity exits non-zero on -quit even when activation succeeds, so the |
| 381 | + # license-file existence check below is the real success gate. |
| 382 | + "$UNITY_PATH" -batchmode -nographics -quit \ |
| 383 | + -username "$UNITY_EMAIL" \ |
| 384 | + -password "$UNITY_PASSWORD" \ |
| 385 | + -serial "$UNITY_SERIAL" \ |
| 386 | + -logFile - 2>&1 || true |
| 387 | + echo "::endgroup::" |
| 388 | +
|
| 389 | + if [ ! -f "$LICENSE_FILE" ]; then |
| 390 | + echo "::error::Unity activation failed: no license file at $LICENSE_FILE. Check UNITY_EMAIL/UNITY_PASSWORD/UNITY_SERIAL secrets and seat-pool availability." |
| 391 | + exit 1 |
| 392 | + fi |
| 393 | + echo "Activated; license file at $LICENSE_FILE" |
| 394 | +
|
283 | 395 | - name: Run PlayMode tests (macOS) |
284 | 396 | if: runner.os == 'macOS' |
285 | 397 | shell: bash |
@@ -329,6 +441,26 @@ jobs: |
329 | 441 | Write-Host "Unity exited with code $exit" |
330 | 442 | if ($exit -ne 0) { exit $exit } |
331 | 443 |
|
| 444 | + - name: Run PlayMode tests (Linux) |
| 445 | + if: runner.os == 'Linux' |
| 446 | + shell: bash |
| 447 | + env: |
| 448 | + AUDIENCE_TEST_PUBLISHABLE_KEY: ${{ secrets.AUDIENCE_TEST_PUBLISHABLE_KEY }} |
| 449 | + AUDIENCE_SCRIPTING_BACKEND: ${{ matrix.backend }} |
| 450 | + run: | |
| 451 | + set -euo pipefail |
| 452 | + mkdir -p artifacts |
| 453 | + # Mirrors the macOS variant: tee Unity's stdout to artifacts/unity.log |
| 454 | + # so the annotation step has a file to scan while progress streams to |
| 455 | + # the job log. pipefail propagates Unity's exit code through tee. |
| 456 | + "$UNITY_PATH" \ |
| 457 | + -batchmode -nographics \ |
| 458 | + -projectPath examples/audience \ |
| 459 | + -runTests \ |
| 460 | + -testPlatform ${{ matrix.target }} \ |
| 461 | + -testResults "$(pwd)/artifacts/test-results.xml" \ |
| 462 | + -logFile - 2>&1 | tee "$(pwd)/artifacts/unity.log" |
| 463 | +
|
332 | 464 | - name: Mark workspace safe for git (Windows) |
333 | 465 | if: always() && runner.os == 'Windows' |
334 | 466 | shell: pwsh |
@@ -369,6 +501,21 @@ jobs: |
369 | 501 | } |
370 | 502 | } |
371 | 503 |
|
| 504 | + - name: Capture player log (Linux) |
| 505 | + if: always() && runner.os == 'Linux' |
| 506 | + shell: bash |
| 507 | + run: | |
| 508 | + # See macOS counterpart for rationale. Linux player log location: |
| 509 | + # ~/.config/unity3d/<CompanyName>/<ProductName>/Player.log (Unity's |
| 510 | + # standard persistent data path on Linux, matching $XDG_CONFIG_HOME). |
| 511 | + mkdir -p artifacts |
| 512 | + src="$HOME/.config/unity3d" |
| 513 | + if [ -d "$src" ]; then |
| 514 | + find "$src" -name "Player.log" 2>/dev/null | while IFS= read -r f; do |
| 515 | + cp "$f" "artifacts/Player-$(basename "$(dirname "$f")").log" 2>/dev/null || true |
| 516 | + done |
| 517 | + fi |
| 518 | +
|
372 | 519 | - name: Surface Unity compile errors as annotations (macOS) |
373 | 520 | if: always() && runner.os == 'macOS' |
374 | 521 | shell: bash |
@@ -414,6 +561,23 @@ jobs: |
414 | 561 | Write-Host "::error::$sanitized" |
415 | 562 | } |
416 | 563 |
|
| 564 | + - name: Surface Unity compile errors as annotations (Linux) |
| 565 | + if: always() && runner.os == 'Linux' |
| 566 | + shell: bash |
| 567 | + run: | |
| 568 | + set -uo pipefail |
| 569 | + # See macOS counterpart for rationale. |
| 570 | + LOG_FILE="artifacts/unity.log" |
| 571 | + if [ ! -f "$LOG_FILE" ]; then |
| 572 | + echo "::notice::No Unity log file at $LOG_FILE." |
| 573 | + exit 0 |
| 574 | + fi |
| 575 | + grep -E '(error CS[0-9]+:|Compilation failed:)' "$LOG_FILE" | sort -u | while IFS= read -r line; do |
| 576 | + trimmed="${line#"${line%%[![:space:]]*}"}" |
| 577 | + sanitized="${trimmed//::/%3A%3A}" |
| 578 | + echo "::error::$sanitized" |
| 579 | + done || true |
| 580 | +
|
417 | 581 | - name: Publish test report |
418 | 582 | uses: dorny/test-reporter@v3 |
419 | 583 | if: always() |
|
0 commit comments