Skip to content

Commit 5d96804

Browse files
committed
ci: build unity 6 sample app manually
1 parent da09f71 commit 5d96804

File tree

5 files changed

+87
-180
lines changed

5 files changed

+87
-180
lines changed

.github/workflows/ui-tests.yml

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ jobs:
3838
buildPath: sample/Builds/MacOS
3939
projectPath: sample
4040
unityVersion: 2021.3.26f1
41-
# Unity 6 macOS build (also triggered when StandaloneOSX is selected)
42-
- targetPlatform: StandaloneOSX-Unity6
43-
buildMethod: MacBuilderUnity6.BuildForAltTester
44-
buildPath: sample-unity6/Builds/MacOS
45-
projectPath: sample-unity6
46-
unityVersion: 6000.0.58f1
4741
- targetPlatform: StandaloneWindows64
4842
buildMethod: WindowsBuilder.BuildForAltTester
4943
buildPath: sample/Builds/Windows64
@@ -59,26 +53,6 @@ jobs:
5953
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
6054
with:
6155
lfs: true
62-
- name: Setup symlinks for Unity 6 project
63-
if: contains(matrix.targetPlatform, 'Unity6') && (github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
64-
run: |
65-
echo "Setting up symlinks for sample-unity6..."
66-
cd sample-unity6/Assets
67-
rm -rf Scenes Scripts Editor
68-
rm -f Scenes.meta Scripts.meta Editor.meta
69-
ln -s ../../sample/Assets/Scenes Scenes
70-
ln -s ../../sample/Assets/Scripts Scripts
71-
ln -s ../../sample/Assets/Editor Editor
72-
ln -s ../../sample/Assets/Scenes.meta Scenes.meta
73-
ln -s ../../sample/Assets/Scripts.meta Scripts.meta
74-
ln -s ../../sample/Assets/Editor.meta Editor.meta
75-
echo "✅ Symlinks for Assets created successfully!"
76-
ls -la Scenes Scripts Editor
77-
cd ..
78-
rm -rf Tests
79-
ln -s ../sample/Tests Tests
80-
echo "✅ Symlink for Tests created successfully!"
81-
ls -la Tests
8256
- uses: actions/cache@v3
8357
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
8458
with:
@@ -110,9 +84,69 @@ jobs:
11084
with:
11185
name: Build-${{ matrix.targetPlatform }}
11286
path: ${{ matrix.buildPath }}
87+
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 🛠️
90+
runs-on: [self-hosted, macOS]
91+
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == 'StandaloneOSX-Unity6'
92+
steps:
93+
- uses: actions/checkout@v3
94+
with:
95+
lfs: true
96+
- name: Setup symlinks for Unity 6 project
97+
run: |
98+
echo "Setting up symlinks for sample-unity6..."
99+
cd sample-unity6/Assets
100+
rm -rf Scenes Scripts Editor
101+
rm -f Scenes.meta Scripts.meta Editor.meta
102+
ln -s ../../sample/Assets/Scenes Scenes
103+
ln -s ../../sample/Assets/Scripts Scripts
104+
ln -s ../../sample/Assets/Editor Editor
105+
ln -s ../../sample/Assets/Scenes.meta Scenes.meta
106+
ln -s ../../sample/Assets/Scripts.meta Scripts.meta
107+
ln -s ../../sample/Assets/Editor.meta Editor.meta
108+
echo "✅ Symlinks for Assets created successfully!"
109+
ls -la Scenes Scripts Editor
110+
cd ..
111+
rm -rf Tests
112+
ln -s ../sample/Tests Tests
113+
echo "✅ Symlink for Tests created successfully!"
114+
ls -la Tests
115+
- name: Build Unity 6 macOS with command line
116+
run: |
117+
echo "Building Unity 6 macOS using command line..."
118+
export TMPDIR="/Users/svc_buildsdk/tmp"
119+
mkdir -p "$TMPDIR"
120+
mkdir -p sample-unity6/Tests
121+
/Applications/Unity/Hub/Editor/6000.0.58f1/Unity.app/Contents/MacOS/Unity \
122+
-projectPath "${{ github.workspace }}/sample-unity6" \
123+
-executeMethod "MacBuilderUnity6.BuildForAltTester" \
124+
-logFile "${{ github.workspace }}/sample-unity6/build-log.txt" \
125+
-quit \
126+
-batchmode \
127+
--buildPath "${{ github.workspace }}/sample-unity6/Tests"
128+
129+
echo "Build completed. Checking for build output..."
130+
ls -la sample-unity6/Tests/
131+
- name: Upload build log
132+
if: always()
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: Unity6-Build-Log
136+
path: sample-unity6/build-log.txt
137+
- name: Upload artifact
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: Build-StandaloneOSX-Unity6
141+
path: sample-unity6/Tests
142+
113143
test:
114144
name: Run ${{ matrix.targetPlatform }} UI tests 🧪
115-
needs: build
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')
116150
strategy:
117151
matrix:
118152
include:
@@ -162,7 +196,9 @@ jobs:
162196
name: Build-${{ matrix.targetPlatform }}
163197
path: ${{ matrix.projectPath }}/Tests
164198
- name: Make macOS artifact executable
165-
if: contains(matrix.targetPlatform, 'StandaloneOSX') && (github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
199+
if: |
200+
contains(matrix.targetPlatform, 'StandaloneOSX') &&
201+
(github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
166202
run: chmod -R +x '${{ matrix.projectPath }}/Tests/${{ matrix.unityAppName }}.app/Contents/MacOS'
167203
- uses: actions/setup-python@v4
168204
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ MonoBehaviour:
7878
- line: '| mipStripping: 0'
7979
- line: '| numberOfMipsStripped: 0'
8080
- line: '| numberOfMipsStrippedPerMipmapLimitGroup: {}'
81-
- line: '| m_StackTraceTypes: 010000000100000001000000010000000100000001000000'
81+
- line: '| m_StackTraceTypes: 010000000000000000000000000000000100000001000000'
8282
- line: '| iosShowActivityIndicatorOnLoading: -1'
8383
- line: '| androidShowActivityIndicatorOnLoading: -1'
8484
- line: '| iosUseCustomAppBackgroundBehavior: 0'

sample/Assets/Editor/MacBuilderUnity6.cs

Lines changed: 8 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,26 @@ private static void BuildPlayer(string defaultBuildPath, bool setupForAltTester
8282
EditorApplication.Exit(1);
8383
}
8484

85+
// Restore Build Profile to original state (empty scenes)
86+
Debug.Log("Restoring Build Profile to original state...");
87+
buildProfile.scenes = new EditorBuildSettingsScene[0];
88+
EditorUtility.SetDirty(buildProfile);
89+
AssetDatabase.SaveAssets();
90+
Debug.Log("Build Profile restored");
91+
8592
if (setupForAltTester)
86-
{
87-
Debug.Log("=== Cleaning up AltTester settings after build ===");
88-
93+
{
8994
// Clean up AltTester settings after build
90-
Debug.Log("Removing AltTester from scripting define symbols...");
9195
AltBuilder.RemoveAltTesterFromScriptingDefineSymbols(BuildTargetGroup.Standalone);
9296

9397
// Clean up custom e2e testing define
94-
Debug.Log("Removing IMMUTABLE_E2E_TESTING define symbol...");
9598
var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
9699
defineSymbols = defineSymbols.Replace("IMMUTABLE_E2E_TESTING;", "").Replace(";IMMUTABLE_E2E_TESTING", "").Replace("IMMUTABLE_E2E_TESTING", "");
97100
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);
98101

99102
var cleanedDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
100-
Debug.Log($"Cleaned scripting define symbols: {cleanedDefineSymbols}");
101103

102104
RemoveAltFromScene(scenes[0]);
103-
Debug.Log("✅ AltTester cleanup completed");
104105
}
105106
}
106107
catch (Exception exception)
@@ -123,106 +124,6 @@ private static string GetBuildPathFromArgs(string defaultBuildPath)
123124
return defaultBuildPath;
124125
}
125126

126-
private static void ValidateBuildProfile(BuildProfile buildProfile)
127-
{
128-
Debug.Log($"Build Profile Debug Info:");
129-
Debug.Log($" - Name: {buildProfile.name}");
130-
131-
// Use reflection to get available properties since API might vary
132-
var type = buildProfile.GetType();
133-
Debug.Log($" - Type: {type.Name}");
134-
135-
// Try to get common BuildProfile properties
136-
try
137-
{
138-
var buildTargetProperty = type.GetProperty("buildTarget");
139-
if (buildTargetProperty != null)
140-
{
141-
Debug.Log($" - Build Target: {buildTargetProperty.GetValue(buildProfile)}");
142-
}
143-
144-
var subtargetProperty = type.GetProperty("subtarget");
145-
if (subtargetProperty != null)
146-
{
147-
Debug.Log($" - Subtarget: {subtargetProperty.GetValue(buildProfile)}");
148-
}
149-
150-
var platformIdProperty = type.GetProperty("platformId");
151-
if (platformIdProperty != null)
152-
{
153-
Debug.Log($" - Platform ID: {platformIdProperty.GetValue(buildProfile)}");
154-
}
155-
156-
var overrideGlobalSceneListProperty = type.GetProperty("overrideGlobalSceneList");
157-
if (overrideGlobalSceneListProperty != null)
158-
{
159-
Debug.Log($" - Override Global Scene List: {overrideGlobalSceneListProperty.GetValue(buildProfile)}");
160-
}
161-
}
162-
catch (System.Exception ex)
163-
{
164-
Debug.LogWarning($" - Could not access some BuildProfile properties: {ex.Message}");
165-
}
166-
167-
Debug.Log($" - Scenes Count: {(buildProfile.scenes?.Length ?? 0)}");
168-
169-
if (buildProfile.scenes != null && buildProfile.scenes.Length > 0)
170-
{
171-
Debug.Log($" - Scenes:");
172-
for (int i = 0; i < buildProfile.scenes.Length; i++)
173-
{
174-
Debug.Log($" [{i}] {buildProfile.scenes[i]}");
175-
}
176-
}
177-
else
178-
{
179-
Debug.LogWarning(" - Build Profile has no scenes configured");
180-
}
181-
182-
Debug.Log($" - Scripting Defines Count: {(buildProfile.scriptingDefines?.Length ?? 0)}");
183-
if (buildProfile.scriptingDefines != null && buildProfile.scriptingDefines.Length > 0)
184-
{
185-
Debug.Log($" - Scripting Defines: {string.Join(", ", buildProfile.scriptingDefines)}");
186-
}
187-
188-
// Check symlink status
189-
Debug.Log($"Symlink Status Check:");
190-
string scenesPath = "Assets/Scenes";
191-
if (System.IO.Directory.Exists(scenesPath))
192-
{
193-
Debug.Log($" - Scenes directory exists: {scenesPath}");
194-
try
195-
{
196-
var scenesDir = new System.IO.DirectoryInfo(scenesPath);
197-
if (scenesDir.Attributes.HasFlag(System.IO.FileAttributes.ReparsePoint))
198-
{
199-
// Use reflection for LinkTarget since it might not be available on all platforms
200-
var linkTargetProperty = scenesDir.GetType().GetProperty("LinkTarget");
201-
if (linkTargetProperty != null)
202-
{
203-
Debug.Log($" - Scenes is a symlink: {linkTargetProperty.GetValue(scenesDir)}");
204-
}
205-
else
206-
{
207-
Debug.Log($" - Scenes is a symlink (LinkTarget property not available)");
208-
}
209-
}
210-
else
211-
{
212-
Debug.Log($" - Scenes is a regular directory");
213-
}
214-
}
215-
catch (System.Exception ex)
216-
{
217-
Debug.LogWarning($" - Could not check symlink status: {ex.Message}");
218-
}
219-
}
220-
else
221-
{
222-
Debug.LogError($" - Scenes directory does not exist: {scenesPath}");
223-
}
224-
}
225-
226127
private static string[] GetScenesToBuild(bool setupForAltTester = false)
227128
{
228129
return new[]
@@ -241,62 +142,32 @@ private static string[] GetScenesToBuild(bool setupForAltTester = false)
241142

242143
private static void SetupAltTester(string[] scenes)
243144
{
244-
Debug.Log("=== Setting up AltTester for build ===");
245-
246-
// Add AltTester scripting define symbols
247-
Debug.Log("Adding AltTester to scripting define symbols...");
248145
AltBuilder.AddAltTesterInScriptingDefineSymbolsGroup(BuildTargetGroup.Standalone);
249146

250147
var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
251-
Debug.Log($"Current scripting define symbols: {defineSymbols}");
252-
253-
// Add custom define for e2e testing to enable default browser behavior
254148
if (!defineSymbols.Contains("IMMUTABLE_E2E_TESTING"))
255149
{
256-
Debug.Log("Adding IMMUTABLE_E2E_TESTING define symbol...");
257150
defineSymbols += ";IMMUTABLE_E2E_TESTING";
258151
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);
259-
defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
260-
Debug.Log($"Updated scripting define symbols: {defineSymbols}");
261-
}
262-
else
263-
{
264-
Debug.Log("IMMUTABLE_E2E_TESTING define symbol already present");
265152
}
266153

267-
Debug.Log("Creating JSON file for input mapping of axis...");
268154
AltBuilder.CreateJsonFileForInputMappingOfAxis();
269155

270156
var instrumentationSettings = new AltInstrumentationSettings();
271157
var host = System.Environment.GetEnvironmentVariable("ALTSERVER_HOST");
272158
if (!string.IsNullOrEmpty(host))
273159
{
274-
Debug.Log($"Using custom AltServer host from environment: {host}");
275160
instrumentationSettings.AltServerHost = host;
276161
}
277-
else
278-
{
279-
Debug.Log($"Using default AltServer host: {instrumentationSettings.AltServerHost}");
280-
}
281162

282163
var port = System.Environment.GetEnvironmentVariable("ALTSERVER_PORT");
283164
if (!string.IsNullOrEmpty(port))
284165
{
285-
Debug.Log($"Using custom AltServer port from environment: {port}");
286166
instrumentationSettings.AltServerPort = int.Parse(port);
287167
}
288-
else
289-
{
290-
instrumentationSettings.AltServerPort = 13000;
291-
Debug.Log($"Using default AltServer port: 13000");
292-
}
293168

294169
instrumentationSettings.ResetConnectionData = true;
295-
Debug.Log($"AltTester instrumentation settings: Host={instrumentationSettings.AltServerHost}, Port={instrumentationSettings.AltServerPort}, ResetConnectionData={instrumentationSettings.ResetConnectionData}");
296-
297-
Debug.Log($"Inserting AltTester prefab into first scene: {scenes[0]}");
298170
AltBuilder.InsertAltInScene(scenes[0], instrumentationSettings);
299-
Debug.Log("✅ AltTester setup completed successfully");
300171
}
301172

302173
public static void RemoveAltFromScene(string scene)

sample/Assets/Scenes/Passport/Initialisation.unity

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,8 @@ RectTransform:
13441344
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
13451345
m_AnchorMin: {x: 0, y: 0}
13461346
m_AnchorMax: {x: 0, y: 0}
1347-
m_AnchoredPosition: {x: 1149.4546, y: 0}
1348-
m_SizeDelta: {x: 2258.9092, y: 0}
1347+
m_AnchoredPosition: {x: 1187.5127, y: 0}
1348+
m_SizeDelta: {x: 2335.0254, y: 0}
13491349
m_Pivot: {x: 0.5, y: 0.5}
13501350
--- !u!114 &1661390145
13511351
MonoBehaviour:
@@ -1643,7 +1643,7 @@ CanvasRenderer:
16431643
SceneRoots:
16441644
m_ObjectHideFlags: 0
16451645
m_Roots:
1646-
- {fileID: 519420032}
16471646
- {fileID: 1850628784}
16481647
- {fileID: 1557497264}
1648+
- {fileID: 519420032}
16491649
- {fileID: 1314882730}

0 commit comments

Comments
 (0)