Skip to content

Run test in Windows #272

Run test in Windows

Run test in Windows #272

Workflow file for this run

name: Build
on:
pull_request:
workflow_dispatch:
inputs:
clean:
type: boolean
default: false
description: "clean"
env:
CLEAN: ${{ github.event.inputs.clean || false }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
defaults:
run:
shell: bash
jobs:
paths-filter:
name: Paths Filter
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
should-build: ${{ steps.filter.outputs.should-build }}
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
- uses: dorny/paths-filter@v3
id: filter
if: ${{ github.event_name == 'pull_request' }}
with:
filters: |
should-build:
- Editor/**/*
- Runtime/**/*
- Samples~/**/*
- .github/workflows/build.yml
get-unity-version:
name: Get Unity Version
needs: paths-filter
if: ${{ (github.event_name == 'pull_request' && needs.paths-filter.outputs.should-build == 'true') || github.event_name == 'workflow_dispatch'}}
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PROJECT_VERSION_PATH: Samples~/ProjectSettings/ProjectVersion.txt
outputs:
unity-version: ${{ steps.get-unity-version.outputs.unity-version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: ${{ env.PROJECT_VERSION_PATH }}
clean: "${{ env.CLEAN }}"
- name: Get Unity version
id: get-unity-version
run: |
echo "unity-version=$(grep "m_EditorVersion:" < "${PROJECT_VERSION_PATH}" | cut -d" " -f2)" >> "${GITHUB_OUTPUT}"
android:
name: Android
needs: get-unity-version
runs-on: [self-hosted, macOS]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Android Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
ANDROID_NDK_ROOT: "/Applications/Unity/Hub/Editor/${UNITY_VERSION}/PlaybackEngines/AndroidPlayer/NDK"
run: |
mkdir -p ./Samples~/Logs/
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-silent-crashes \
-quit \
-batchmode \
-projectPath ./Samples~ \
-logFile - \
-buildReporterConfig "Assets/Editor/GhaUnityBuildReporterConfig.asset" \
-executeMethod Editor.BuildEntryPoint.BuildAndroid | tee ./Samples~/Logs/Build.log
- name: Dump BuildReport
run: |
cat ./Samples~/Logs/BuildReport.json
ios:
name: iOS
needs: get-unity-version
runs-on: [self-hosted, macOS]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: iOS Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
mkdir -p ./Samples~/Logs/
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-silent-crashes \
-quit \
-batchmode \
-logFile - \
-projectPath ./Samples~ \
-buildReporterConfig "Assets/Editor/GhaUnityBuildReporterConfig.asset" \
-executeMethod Editor.BuildEntryPoint.BuildIOS | tee ./Samples~/Logs/Build.log
- name: Dump BuildReport
run: |
cat ./Samples~/Logs/BuildReport.json
macos:
name: macOS
needs: get-unity-version
runs-on: [self-hosted, macOS]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: macOS Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
mkdir -p ./Samples~/Logs/
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-silent-crashes \
-quit \
-batchmode \
-logFile - \
-projectPath ./Samples~ \
-executeMethod Editor.BuildEntryPoint.BuildMacOS | tee ./Samples~/Logs/Build.log
- name: Dump BuildReport
run: |
cat ./Samples~/Logs/BuildReport.json
Windows:
name: Windows
needs: get-unity-version
runs-on: [self-hosted, Windows]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Windows Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
shell: pwsh
run: |
$unityPath = "C:\Program Files\Unity\Hub\Editor\$env:UNITY_VERSION\Editor\Unity.exe"
$projectPath = ".\Samples~"
$executeMethod = "Editor.BuildEntryPoint.BuildWindows"
$arguments = "-silent-crashes", "-quit", "-batchmode", "-projectPath", $projectPath, "-executeMethod", $executeMethod, "-logFile", "-"
New-Item -Path ".\Samples~\Logs\" -ItemType Directory -Force
Start-Process -FilePath $unityPath -ArgumentList $arguments -NoNewWindow -Wait | Tee-Object -FilePath ".\Samples~\Logs\Build.log"
- name: Dump BuildReport
shell: pwsh
run: |
Get-Content -Path .\Samples~\Logs\BuildReport.json -Raw
webgl:
name: WebGL
needs: get-unity-version
runs-on: [self-hosted, macOS]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: WebGL Build
env:
UNITY_VERSION: ${{ needs.get-unity-version.outputs.unity-version }}
run: |
mkdir -p ./Samples~/Logs/
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-silent-crashes \
-quit \
-batchmode \
-logFile - \
-projectPath ./Samples~ \
-executeMethod Editor.BuildEntryPoint.BuildWebGL | tee ./Samples~/Logs/Build.log
- name: Dump BuildReport
run: |
cat ./Samples~/Logs/BuildReport.json