Skip to content

Update PhysicsProjectile3D.cs #468

Update PhysicsProjectile3D.cs

Update PhysicsProjectile3D.cs #468

Workflow file for this run

name: Build — Android & Windows
on:
push:
branches: [master, deploy]
workflow_dispatch:
inputs:
platform:
description: 'Target platform'
required: true
default: 'Both'
type: choice
options: [Android, Windows, Both]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# ────────────────────────────────────────────────────────────────────────────
plan:
name: Plan
runs-on: ubuntu-latest
outputs:
build_android: ${{ steps.flags.outputs.build_android }}
build_windows: ${{ steps.flags.outputs.build_windows }}
any_build: ${{ steps.flags.outputs.any_build }}
steps:
- name: Parse flags
id: flags
run: |
MSG="${{ github.event.head_commit.message }}"
TRIGGER="${{ github.event_name }}"
SELECTED="${{ github.event.inputs.platform }}"
android=false; windows=false
if [ "$TRIGGER" = "workflow_dispatch" ]; then
case "$SELECTED" in
Android) android=true ;;
Windows) windows=true ;;
Both) android=true; windows=true ;;
esac
else
# --build alone (word-boundary) triggers everything
if echo "$MSG" | grep -qE '(^|[[:space:]])--build([[:space:]]|$)'; then
android=true; windows=true
fi
echo "$MSG" | grep -qi -- '--build-android' && android=true
echo "$MSG" | grep -qi -- '--build-windows' && windows=true
fi
any=false
{ [ "$android" = "true" ] || [ "$windows" = "true" ]; } && any=true
echo "build_android=$android" >> $GITHUB_OUTPUT
echo "build_windows=$windows" >> $GITHUB_OUTPUT
echo "any_build=$any" >> $GITHUB_OUTPUT
echo "📋 Plan → Android: $android | Windows: $windows"
# ────────────────────────────────────────────────────────────────────────────
build:
name: Build — ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
needs: plan
if: needs.plan.outputs.any_build == 'true'
strategy:
fail-fast: false
matrix:
include:
- targetPlatform: Android
plan_key: build_android
- targetPlatform: StandaloneWindows64
plan_key: build_windows
steps:
- name: Gate
id: gate
run: |
case "${{ matrix.plan_key }}" in
build_android) VAL="${{ needs.plan.outputs.build_android }}" ;;
build_windows) VAL="${{ needs.plan.outputs.build_windows }}" ;;
esac
echo "should_build=$VAL" >> $GITHUB_OUTPUT
[ "$VAL" = "true" ] \
&& echo "✅ Building ${{ matrix.targetPlatform }}" \
|| echo "⏭️ Skipping ${{ matrix.targetPlatform }}"
- name: Free Disk Space
if: steps.gate.outputs.should_build == 'true'
run: |
sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' \
'^mysql-.*' azure-cli google-chrome-stable firefox powershell \
mono-devel libgl1-mesa-dri || true
sudo apt-get autoremove -y && sudo apt-get clean
sudo rm -rf /usr/share/dotnet /usr/local/lib/android \
/opt/ghc /usr/local/share/boost "$AGENT_TOOLSDIRECTORY"
docker system prune -a -f || true
sudo swapoff -a || true && sudo rm -f /swapfile
echo "📊 Disk after cleanup:"; df -h /
- name: Setup swap
if: steps.gate.outputs.should_build == 'true'
run: |
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
- name: Checkout
if: steps.gate.outputs.should_build == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Cache Library
if: steps.gate.outputs.should_build == 'true'
uses: actions/cache@v4
with:
path: PackageSandbox/Library
key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('PackageSandbox/Assets/**', 'PackageSandbox/Packages/**', 'PackageSandbox/ProjectSettings/**') }}
restore-keys: |
Library-${{ matrix.targetPlatform }}-
Library-
- name: Build — ${{ matrix.targetPlatform }}
if: steps.gate.outputs.should_build == 'true'
id: unity_build
# FIX: the Linux Unity Editor is known to segfault during its own
# process shutdown (CleanupMono/domainUnloadComplete) AFTER a build
# has already completed successfully — see game-ci/unity-builder#625.
# continue-on-error keeps the job alive so the "Verify build output"
# step below can check whether this was that harmless shutdown crash
# (APK exists → treat as success) or a genuine build failure (no
# APK → we explicitly fail the job in "Fail if build genuinely
# failed" below). Nothing here silently swallows a real failure.
continue-on-error: true
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: PackageSandbox
targetPlatform: ${{ matrix.targetPlatform }}
unityVersion: 2022.3.13f1
buildName: PackageSandbox
customParameters: -disable-assembly-updater -maxConcurrentShaderCompilers 1
# Grab Editor.log / licensing logs unconditionally so we have real
# diagnostics on hand if this ever turns out NOT to be the benign
# shutdown crash (e.g. it starts happening WITH a missing APK).
collectUnityLogs: true
- name: Verify build output exists
if: steps.gate.outputs.should_build == 'true'
id: verify_output
run: |
OUT_DIR="build/${{ matrix.targetPlatform }}"
if [ -d "$OUT_DIR" ] && [ -n "$(find "$OUT_DIR" -type f 2>/dev/null | head -n 1)" ]; then
echo "output_exists=true" >> "$GITHUB_OUTPUT"
echo "✅ Build output found in $OUT_DIR:"
ls -la "$OUT_DIR"
else
echo "output_exists=false" >> "$GITHUB_OUTPUT"
echo "❌ No build output found in $OUT_DIR"
fi
- name: Note known post-build shutdown crash
if: steps.gate.outputs.should_build == 'true' && steps.unity_build.outcome == 'failure' && steps.verify_output.outputs.output_exists == 'true'
run: |
echo "::warning::Unity step reported failure (likely exit 139 / segfault), but a valid build output was found in build/${{ matrix.targetPlatform }}. This matches the known game-ci/unity-builder Linux Editor shutdown-crash class of issue (https://github.com/game-ci/unity-builder/issues/625) — the build itself succeeded; only the Editor's own process teardown crashed afterward. Continuing and uploading the artifact."
- name: Fail if build genuinely failed
if: steps.gate.outputs.should_build == 'true' && steps.unity_build.outcome == 'failure' && steps.verify_output.outputs.output_exists != 'true'
run: |
echo "::error::Unity build step failed AND no output was produced in build/${{ matrix.targetPlatform }} — this is a real build failure, not the known post-build Editor shutdown crash. Failing the job."
exit 1
- name: Upload
if: steps.gate.outputs.should_build == 'true' && steps.verify_output.outputs.output_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: PackageSandbox-${{ matrix.targetPlatform }}-${{ github.run_number }}
path: build/${{ matrix.targetPlatform }}
retention-days: 14
- name: Upload crash diagnostics
if: steps.gate.outputs.should_build == 'true' && steps.unity_build.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: unity-crash-diagnostics-${{ matrix.targetPlatform }}-${{ github.run_number }}
path: |
~/.local/share/unity3d/Editor/Crash.log
~/.config/unity3d/Editor.log
Logs/UnityDiagnostics/
retention-days: 3
- name: Skipped
if: steps.gate.outputs.should_build == 'false'
run: echo "⏭️ ${{ matrix.targetPlatform }} not requested."
# ────────────────────────────────────────────────────────────────────────────
no-build:
name: No build requested
runs-on: ubuntu-latest
needs: plan
if: needs.plan.outputs.any_build == 'false'
steps:
- run: |
echo "ℹ️ No build requested."
echo " Push with --build, --build-android, or --build-windows in commit message,"
echo " or trigger manually via Actions → Run workflow."