Skip to content

Commit 136b37d

Browse files
committed
ci: resolve unity 6 package synchronously
1 parent c952afa commit 136b37d

File tree

2 files changed

+96
-66
lines changed

2 files changed

+96
-66
lines changed

.github/workflows/ui-tests.yml

Lines changed: 93 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -85,68 +85,125 @@ jobs:
8585
name: Build-${{ matrix.targetPlatform }}
8686
path: ${{ matrix.buildPath }}
8787

88-
build-unity6-macos: # Game CI and Unity 6 don't like how we setup the project for AltTester in the build script, so we have to build it manually
89-
name: Build Unity 6 macOS for AltTester 🛠️
88+
build-and-test-unity6-macos: # 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.
89+
name: Build & Test Unity 6 macOS 🛠️🧪
9090
runs-on: [self-hosted, macOS]
9191
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == 'StandaloneOSX-Unity6'
9292
steps:
9393
- name: Cleanup old builds
9494
run: |
95-
# Remove all previous builds to save space
96-
rm -rf /tmp/unity-builds/* 2>/dev/null || true
95+
# Remove previous build to save space
96+
rm -rf sample-unity6/Tests/* 2>/dev/null || true
9797
- uses: actions/checkout@v3
9898
with:
9999
lfs: true
100-
- name: Setup symlinks for Unity 6 project
100+
- name: Copy files for Unity 6 project
101101
run: |
102-
echo "Setting up symlinks for sample-unity6..."
102+
echo "Removing symlinks and copying files for sample-unity6..."
103+
pwd
103104
cd sample-unity6/Assets
105+
pwd
106+
ls -l
107+
echo "Remove symlinks explicitly (rm -f works on symlinks without following them)"
108+
rm -f Scenes Scripts Editor Scenes.meta Scripts.meta Editor.meta
109+
ls -l
110+
echo "Also remove if they were directories (in case previous copy made them real)"
104111
rm -rf Scenes Scripts Editor
105-
rm -f Scenes.meta Scripts.meta Editor.meta
106-
ln -s ../../sample/Assets/Scenes Scenes
107-
ln -s ../../sample/Assets/Scripts Scripts
108-
ln -s ../../sample/Assets/Editor Editor
109-
ln -s ../../sample/Assets/Scenes.meta Scenes.meta
110-
ln -s ../../sample/Assets/Scripts.meta Scripts.meta
111-
ln -s ../../sample/Assets/Editor.meta Editor.meta
112-
echo "✅ Symlinks for Assets created successfully!"
113-
ls -la Scenes Scripts Editor
112+
ls -l
113+
# Now copy the actual files
114+
cp -R ../../sample/Assets/Scenes Scenes
115+
cp -R ../../sample/Assets/Scripts Scripts
116+
cp -R ../../sample/Assets/Editor Editor
117+
cp ../../sample/Assets/Scenes.meta Scenes.meta
118+
cp ../../sample/Assets/Scripts.meta Scripts.meta
119+
cp ../../sample/Assets/Editor.meta Editor.meta
120+
echo "✅ Assets copied successfully as real files (not symlinks)!"
121+
# Verify they are NOT symlinks
122+
file Scenes Scripts Editor Scenes.meta Scripts.meta Editor.meta
114123
cd ..
124+
rm -f Tests
115125
rm -rf Tests
116-
ln -s ../sample/Tests Tests
117-
echo "✅ Symlink for Tests created successfully!"
118-
ls -la Tests
119-
- name: Build Unity 6 macOS with command line
126+
cp -R ../sample/Tests Tests
127+
echo "✅ Tests copied successfully!"
128+
file Tests
129+
- name: Force clean package resolution
130+
run: |
131+
echo "Removing Library folder to force clean package resolution..."
132+
rm -rf sample-unity6/Library
133+
echo "✅ Library folder removed"
134+
- name: First build (resolves packages)
135+
run: |
136+
echo "Running first build to trigger package resolution..."
137+
export TMPDIR="/Users/svc_buildsdk/tmp"
138+
mkdir -p "$TMPDIR"
139+
mkdir -p sample-unity6/Tests
140+
/Applications/Unity/Hub/Editor/6000.0.58f1/Unity.app/Contents/MacOS/Unity -projectPath "${{ github.workspace }}/sample-unity6" -executeMethod "MacBuilderUnity6.BuildForAltTester" -logFile "${{ github.workspace }}/sample-unity6/first-build-log.txt" -quit -batchmode --buildPath "${{ github.workspace }}/sample-unity6/Tests/Sample Unity 6 macOS" || true
141+
142+
echo "First build completed (may have failed, that's ok). Checking for AltTester..."
143+
if ls -la "${{ github.workspace }}/sample-unity6/Library/PackageCache/" | grep alttester; then
144+
echo "✅ AltTester found in PackageCache after first build"
145+
else
146+
echo "⚠️ AltTester not found yet, but will be ready for second build"
147+
fi
148+
- name: Build Unity 6 macOS with command line (second build with packages ready)
120149
run: |
121150
echo "Building Unity 6 macOS using command line..."
122151
export TMPDIR="/Users/svc_buildsdk/tmp"
123152
mkdir -p "$TMPDIR"
124-
BUILD_DIR="/tmp/unity-builds/${{ github.run_id }}"
125-
mkdir -p "$BUILD_DIR"
126-
/Applications/Unity/Hub/Editor/6000.0.58f1/Unity.app/Contents/MacOS/Unity \
127-
-projectPath "${{ github.workspace }}/sample-unity6" \
128-
-executeMethod "MacBuilderUnity6.BuildForAltTester" \
129-
-logFile "${{ github.workspace }}/sample-unity6/build-log.txt" \
130-
-quit \
131-
-batchmode \
132-
--buildPath "$BUILD_DIR"
153+
mkdir -p sample-unity6/Tests
154+
/Applications/Unity/Hub/Editor/6000.0.58f1/Unity.app/Contents/MacOS/Unity -projectPath "${{ github.workspace }}/sample-unity6" -executeMethod "MacBuilderUnity6.BuildForAltTester" -logFile "${{ github.workspace }}/sample-unity6/build-log.log" -quit -batchmode --buildPath "${{ github.workspace }}/sample-unity6/Tests/Sample Unity 6 macOS"
133155
134156
echo "Build completed. Checking for build output..."
135-
ls -la "$BUILD_DIR"
157+
ls -la sample-unity6/Tests/
158+
- name: Create temporary keychain
159+
run: |
160+
security list-keychains
161+
security delete-keychain temporary || true
162+
security list-keychains
163+
security create-keychain -p "" temporary
164+
security default-keychain -s temporary
165+
security unlock-keychain -p "" temporary
166+
security set-keychain-settings -lut 600 temporary
167+
- name: Make macOS artifact executable
168+
run: chmod -R +x 'sample-unity6/Tests/Sample Unity 6 macOS.app/Contents/MacOS'
169+
- uses: actions/setup-python@v4
170+
with:
171+
python-version: "3.13"
172+
- name: Install dependencies
173+
run: pip install -r sample-unity6/Tests/requirements-desktop.txt
174+
- name: Run UI tests
175+
env:
176+
UNITY_APP_PATH: Sample Unity 6 macOS.app
177+
UNITY_APP_NAME: Sample Unity 6 macOS
178+
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
179+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
180+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
181+
working-directory: sample-unity6/Tests
182+
run: pytest -xs test/test_mac.py::MacTest
183+
- name: Remove temporary keychain
184+
if: always()
185+
run: |
186+
security list-keychains
187+
security delete-keychain temporary
188+
security default-keychain -s ~/Library/Keychains/login.keychain-db
189+
security list-keychains -d user -s ~/Library/Keychains/login.keychain-db
190+
security list-keychains
191+
- name: Upload first build log
192+
if: always()
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: Unity6-First-Build-Log
196+
path: sample-unity6/first-build-log.txt
136197
- name: Upload build log
137198
if: always()
138199
uses: actions/upload-artifact@v4
139200
with:
140201
name: Unity6-Build-Log
141-
path: sample-unity6/build-log.txt
202+
path: sample-unity6/build-log.log
142203

143204
test:
144205
name: Run ${{ matrix.targetPlatform }} UI tests 🧪
145-
needs: [build, build-unity6-macos]
146-
if: |
147-
always() &&
148-
(needs.build.result == 'success' || needs.build.result == 'skipped') &&
149-
(needs.build-unity6-macos.result == 'success' || needs.build-unity6-macos.result == 'skipped')
206+
needs: build
150207
strategy:
151208
matrix:
152209
include:
@@ -156,12 +213,6 @@ jobs:
156213
projectPath: sample
157214
unityAppName: SampleApp
158215
concurrency_group: macos
159-
- targetPlatform: StandaloneOSX-Unity6
160-
runs-on: [self-hosted, macOS]
161-
test_script: pytest -xs test/test_mac.py::MacTest
162-
projectPath: sample-unity6
163-
unityAppName: Sample Unity 6 macOS
164-
concurrency_group: macos
165216
- targetPlatform: StandaloneWindows64
166217
runs-on: [self-hosted, windows]
167218
test_script: python -m pytest -xs test/test_windows.py::WindowsTest
@@ -191,22 +242,10 @@ jobs:
191242
security unlock-keychain -p "" temporary
192243
security set-keychain-settings -lut 600 temporary
193244
- uses: actions/download-artifact@v4
194-
if: |
195-
matrix.targetPlatform != 'StandaloneOSX-Unity6' &&
196-
(github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
245+
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
197246
with:
198247
name: Build-${{ matrix.targetPlatform }}
199248
path: ${{ matrix.projectPath }}/Tests
200-
- name: Copy Unity 6 build from shared directory
201-
if: |
202-
matrix.targetPlatform == 'StandaloneOSX-Unity6' &&
203-
(github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
204-
run: |
205-
BUILD_APP="/tmp/unity-builds/${{ github.run_id }}.app"
206-
mkdir -p "${{ matrix.projectPath }}/Tests"
207-
cp -R "$BUILD_APP" "${{ matrix.projectPath }}/Tests/"
208-
echo "Build copied from shared directory:"
209-
ls -la "${{ matrix.projectPath }}/Tests/"
210249
- name: Make macOS artifact executable
211250
if: |
212251
contains(matrix.targetPlatform, 'StandaloneOSX') &&
@@ -240,16 +279,6 @@ jobs:
240279
security default-keychain -s ~/Library/Keychains/login.keychain-db
241280
security list-keychains -d user -s ~/Library/Keychains/login.keychain-db
242281
security list-keychains
243-
- name: Cleanup Unity 6 shared build
244-
if: |
245-
always() &&
246-
matrix.targetPlatform == 'StandaloneOSX-Unity6' &&
247-
(github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
248-
run: |
249-
BUILD_APP="/tmp/unity-builds/${{ github.run_id }}.app"
250-
echo "Cleaning up shared build: $BUILD_APP"
251-
rm -rf "$BUILD_APP"
252-
echo "✅ Cleanup completed"
253282
build-ios: #test-ios:
254283
name: Run iOS build #UI tests 🧪
255284
needs:

sample-unity6/Assets/Settings/Build Profiles/macOS Profile.asset

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ MonoBehaviour:
256256
- line: '| iOSLaunchScreeniPadCustomStoryboardPath: '
257257
- line: '| iOSDeviceRequirements: []'
258258
- line: '| iOSURLSchemes: []'
259-
- line: '| macOSURLSchemes: []'
259+
- line: '| macOSURLSchemes:'
260+
- line: '| - immutablerunner'
260261
- line: '| iOSBackgroundModes: 0'
261262
- line: '| iOSMetalForceHardShadows: 0'
262263
- line: '| metalEditorSupport: 1'
@@ -915,7 +916,7 @@ MonoBehaviour:
915916
- rid: 279568446812586195
916917
type: {class: OSXStandaloneBuildProfile, ns: UnityEditor.OSXStandalone, asm: UnityEditor.OSXStandalone.Extensions}
917918
data:
918-
m_Development: 0
919+
m_Development: 1
919920
m_ConnectProfiler: 0
920921
m_BuildWithDeepProfilingSupport: 0
921922
m_AllowDebugging: 0

0 commit comments

Comments
 (0)