Skip to content

Commit e13811a

Browse files
authored
Merge ccd2918 into 5be07e2
2 parents 5be07e2 + ccd2918 commit e13811a

File tree

15 files changed

+1423
-75
lines changed

15 files changed

+1423
-75
lines changed

.github/workflows/test-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
jobs:
1414
test:
1515
if: github.event.pull_request.head.repo.fork == false
16-
name: Build sample app 🛠️
16+
name: Test sample app 🛠️
1717
runs-on: ubuntu-latest-8-cores
1818

1919
steps:
@@ -132,6 +132,7 @@ jobs:
132132
targetPlatform:
133133
- iOS
134134
- Android
135+
- StandaloneWindows64
135136
steps:
136137
- uses: actions/checkout@v4
137138
with:

.github/workflows/ui-tests.yml

Lines changed: 153 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ on:
1313
- All
1414
- StandaloneOSX # Builds Unity 2021 macOS only
1515
- StandaloneOSX-Unity6 # Builds Unity 6 macOS only
16-
- StandaloneWindows64
16+
- StandaloneWindows64 # Builds Unity 2021 Windows only
17+
- StandaloneWindows64-Unity6 # Builds Unity 6 Windows only
1718
# - Android
1819
# - iOS
1920
push:
@@ -88,8 +89,8 @@ jobs:
8889
name: Build & Test Unity 6 macOS 🛠️🧪
8990
runs-on: [self-hosted, macOS]
9091
concurrency:
91-
group: ui-tests-email-inbox-macos
92-
cancel-in-progress: false # Let tests complete rather than canceling
92+
group: ui-tests-email-inbox-macos-unity6
93+
cancel-in-progress: false # Let tests complete rather than cancelling
9394
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == 'StandaloneOSX-Unity6'
9495
steps:
9596
- name: Cleanup old builds
@@ -99,6 +100,8 @@ jobs:
99100
- uses: actions/checkout@v3
100101
with:
101102
lfs: true
103+
- name: Setup symlinks for Unity 6 macOS
104+
run: ./setup-symlinks.sh
102105
- name: Force clean package resolution
103106
run: |
104107
echo "Removing Library folder to force clean package resolution..."
@@ -171,7 +174,153 @@ jobs:
171174
if: always()
172175
uses: actions/upload-artifact@v4
173176
with:
174-
name: Unity6-Build-Log
177+
name: Unity6-macOS-Build-Log
178+
path: sample-unity6/build-log.log
179+
180+
build-and-test-unity6-windows: # Unity 6 requires a full build cycle to compile AltTester packages properly. This doesn't work well in Game CI, so we have to build it manually.
181+
name: Build & Test Unity 6 Windows 🛠️🧪
182+
runs-on: [self-hosted, windows]
183+
concurrency:
184+
group: ui-tests-email-inbox-windows-unity6
185+
cancel-in-progress: false # Let tests complete rather than cancelling
186+
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == 'StandaloneWindows64-Unity6'
187+
steps:
188+
- name: Cleanup old builds
189+
run: |
190+
# Remove previous build to save space
191+
if (Test-Path "sample-unity6/Tests") { Remove-Item -Recurse -Force "sample-unity6/Tests" -ErrorAction SilentlyContinue }
192+
- uses: actions/checkout@v3
193+
with:
194+
lfs: true
195+
- name: Cache Unity Library folder
196+
uses: actions/cache@v3
197+
with:
198+
path: sample-unity6/Library
199+
key: Library-Unity6-Windows-${{ hashFiles('sample-unity6/Assets/**', 'sample-unity6/Packages/**', 'sample-unity6/ProjectSettings/**') }}
200+
restore-keys: |
201+
Library-Unity6-Windows-
202+
- name: Setup symlinks for Unity 6 Windows
203+
run: .\setup-symlinks.ps1
204+
- name: Verify symlinks were created
205+
run: |
206+
if (-not (Test-Path "sample-unity6/Assets/Editor/WindowsBuilderUnity6.cs")) {
207+
Write-Output "❌ Build script not found - symlink setup failed"
208+
exit 1
209+
}
210+
Write-Output "✅ Symlinks verified"
211+
# Don't delete Library folder - let Unity reuse cached package data if available
212+
# Deleting it forces a complete reimport which takes too long
213+
- name: Ensure Tests directory exists
214+
run: |
215+
if (-not (Test-Path "sample-unity6/Tests")) {
216+
New-Item -ItemType Directory -Path "sample-unity6/Tests" -Force | Out-Null
217+
}
218+
- name: First build (resolves packages)
219+
run: |
220+
Write-Output "Running first build to trigger package resolution..."
221+
222+
$unityPath = "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe"
223+
$projectPath = "${{ github.workspace }}\sample-unity6"
224+
$logFile = "${{ github.workspace }}\sample-unity6\first-build-log.txt"
225+
$buildPath = "${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
226+
227+
$arguments = @(
228+
"-projectPath", "`"$projectPath`"",
229+
"-executeMethod", "WindowsBuilderUnity6.BuildForAltTester",
230+
"-logFile", "`"$logFile`"",
231+
"-quit", "-batchmode", "-nographics",
232+
"--buildPath", "`"$buildPath`""
233+
)
234+
235+
# Run and ignore exit code (may fail on first attempt)
236+
$process = Start-Process -FilePath $unityPath `
237+
-ArgumentList $arguments `
238+
-Wait -PassThru -NoNewWindow
239+
240+
Write-Output "First build completed (exit code: $($process.ExitCode), may have failed, that's ok). Checking for AltTester..."
241+
242+
if (Test-Path "${{ github.workspace }}\sample-unity6\Library\PackageCache") {
243+
$altTesterFound = Get-ChildItem "${{ github.workspace }}\sample-unity6\Library\PackageCache" -Filter "*alttester*" -ErrorAction SilentlyContinue
244+
if ($altTesterFound) {
245+
Write-Output "✅ AltTester found in PackageCache after first build"
246+
} else {
247+
Write-Output "⚠️ AltTester not found yet, but will be ready for second build"
248+
}
249+
}
250+
- name: Build Unity 6 Windows executable
251+
timeout-minutes: 20
252+
run: |
253+
Write-Output "Building Unity 6 Windows executable..."
254+
Write-Output "Started at: $(Get-Date -Format 'HH:mm:ss')"
255+
256+
# Run Unity build
257+
$unityPath = "C:\Program Files\Unity\Hub\Editor\6000.0.58f2\Editor\Unity.exe"
258+
$projectPath = "${{ github.workspace }}\sample-unity6"
259+
$logFile = "${{ github.workspace }}\sample-unity6\build-log.log"
260+
$buildPath = "${{ github.workspace }}\sample-unity6\Tests\Sample Unity 6 Windows.exe"
261+
262+
# Build argument list with proper quoting for paths with spaces
263+
$arguments = @(
264+
"-projectPath", "`"$projectPath`"",
265+
"-executeMethod", "WindowsBuilderUnity6.BuildForAltTester",
266+
"-logFile", "`"$logFile`"",
267+
"-quit", "-batchmode", "-nographics",
268+
"--buildPath", "`"$buildPath`""
269+
)
270+
271+
$process = Start-Process -FilePath $unityPath `
272+
-ArgumentList $arguments `
273+
-Wait -PassThru -NoNewWindow
274+
275+
$buildExitCode = $process.ExitCode
276+
Write-Output "Finished at: $(Get-Date -Format 'HH:mm:ss') (exit code: $buildExitCode)"
277+
278+
# Verify build output
279+
Start-Sleep -Seconds 2
280+
if (Test-Path $buildPath) {
281+
$fileSize = (Get-Item $buildPath).Length / 1MB
282+
Write-Output "✅ Build succeeded! ($([math]::Round($fileSize, 2)) MB)"
283+
} else {
284+
Write-Output "❌ Build failed! Executable not found"
285+
Write-Output ""
286+
Write-Output "Build log:"
287+
if (Test-Path $logFile) {
288+
Get-Content $logFile
289+
} else {
290+
Write-Output "⚠️ Log file not found at: $logFile"
291+
}
292+
exit 1
293+
}
294+
- uses: actions/setup-python@v4
295+
with:
296+
python-version: "3.13"
297+
- name: Verify test files are accessible
298+
run: |
299+
if (-not (Test-Path "sample-unity6/Tests/requirements-desktop.txt") -and -not (Test-Path "sample/Tests/requirements-desktop.txt")) {
300+
Write-Output "❌ Test requirements file not found"
301+
exit 1
302+
}
303+
- name: Install dependencies
304+
run: |
305+
if (Test-Path "sample-unity6/Tests/requirements-desktop.txt") {
306+
pip install -r sample-unity6/Tests/requirements-desktop.txt
307+
} else {
308+
pip install -r sample/Tests/requirements-desktop.txt
309+
}
310+
- name: Run UI tests
311+
env:
312+
UNITY_APP_PATH: Sample Unity 6 Windows.exe
313+
UNITY_APP_NAME: Sample Unity 6 Windows
314+
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
315+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
316+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
317+
working-directory: sample-unity6/Tests
318+
run: python -m pytest -xs test/test_windows.py::WindowsTest
319+
- name: Upload build log
320+
if: always()
321+
uses: actions/upload-artifact@v4
322+
with:
323+
name: Unity6-Windows-Build-Log
175324
path: sample-unity6/build-log.log
176325

177326
test:

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The Immutable SDK for Unity helps you integrate your game with Immutable Passpor
2222
This repository contains two sample projects:
2323

2424
- **`sample/`** - Unity 2021.3.26f1 sample project
25-
- **`sample-unity6/`** - Unity 6 sample project *(work in progress)*
25+
- **`sample-unity6/`** - Unity 6 sample project
2626

2727
Both projects share the same Scenes, Scripts, Editor folders, and Tests via symbolic links, providing a single source of truth for the sample code. See [`sample-unity6/README.md`](sample-unity6/README.md) for setup instructions.
2828

@@ -36,13 +36,14 @@ The `sample-unity6` project uses symbolic links to share Scenes, Scripts, Editor
3636
1. Navigate to `sample-unity6/Assets/` and `sample-unity6/`
3737
2. Check if `Scenes`, `Scripts`, `Editor`, and `Tests` are folders (symlinks work) or small text files (symlinks didn't work)
3838

39-
If symlinks didn't work, run the setup script:
39+
If symlinks didn't work, run the setup script as Administrator:
4040

4141
```powershell
42+
# Right-click PowerShell -> "Run as Administrator"
4243
.\setup-symlinks.ps1
4344
```
4445

45-
> **Note for Windows users**: You'll need Developer Mode enabled or run PowerShell as Administrator. See [`sample-unity6/README.md`](sample-unity6/README.md) for details.
46+
> **Note for Windows users**: You must run PowerShell as Administrator. Directory symbolic links (required for Unity to recognise the folders) need admin privileges on Windows. See [`sample-unity6/README.md`](sample-unity6/README.md) for details.
4647
4748
## Contributing
4849

0 commit comments

Comments
 (0)