Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: build unity 6 sample app manually
  • Loading branch information
nattb8 committed Oct 6, 2025
commit 5d96804c80cfa4e8018509ca8e9dfcbf9010ceec
92 changes: 64 additions & 28 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ jobs:
buildPath: sample/Builds/MacOS
projectPath: sample
unityVersion: 2021.3.26f1
# Unity 6 macOS build (also triggered when StandaloneOSX is selected)
- targetPlatform: StandaloneOSX-Unity6
buildMethod: MacBuilderUnity6.BuildForAltTester
buildPath: sample-unity6/Builds/MacOS
projectPath: sample-unity6
unityVersion: 6000.0.58f1
- targetPlatform: StandaloneWindows64
buildMethod: WindowsBuilder.BuildForAltTester
buildPath: sample/Builds/Windows64
Expand All @@ -59,26 +53,6 @@ jobs:
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
with:
lfs: true
- name: Setup symlinks for Unity 6 project
if: contains(matrix.targetPlatform, 'Unity6') && (github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
run: |
echo "Setting up symlinks for sample-unity6..."
cd sample-unity6/Assets
rm -rf Scenes Scripts Editor
rm -f Scenes.meta Scripts.meta Editor.meta
ln -s ../../sample/Assets/Scenes Scenes
ln -s ../../sample/Assets/Scripts Scripts
ln -s ../../sample/Assets/Editor Editor
ln -s ../../sample/Assets/Scenes.meta Scenes.meta
ln -s ../../sample/Assets/Scripts.meta Scripts.meta
ln -s ../../sample/Assets/Editor.meta Editor.meta
echo "✅ Symlinks for Assets created successfully!"
ls -la Scenes Scripts Editor
cd ..
rm -rf Tests
ln -s ../sample/Tests Tests
echo "✅ Symlink for Tests created successfully!"
ls -la Tests
- uses: actions/cache@v3
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
with:
Expand Down Expand Up @@ -110,9 +84,69 @@ jobs:
with:
name: Build-${{ matrix.targetPlatform }}
path: ${{ matrix.buildPath }}

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
name: Build Unity 6 macOS for AltTester 🛠️
runs-on: [self-hosted, macOS]
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == 'StandaloneOSX-Unity6'
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup symlinks for Unity 6 project
run: |
echo "Setting up symlinks for sample-unity6..."
cd sample-unity6/Assets
rm -rf Scenes Scripts Editor
rm -f Scenes.meta Scripts.meta Editor.meta
ln -s ../../sample/Assets/Scenes Scenes
ln -s ../../sample/Assets/Scripts Scripts
ln -s ../../sample/Assets/Editor Editor
ln -s ../../sample/Assets/Scenes.meta Scenes.meta
ln -s ../../sample/Assets/Scripts.meta Scripts.meta
ln -s ../../sample/Assets/Editor.meta Editor.meta
echo "✅ Symlinks for Assets created successfully!"
ls -la Scenes Scripts Editor
cd ..
rm -rf Tests
ln -s ../sample/Tests Tests
echo "✅ Symlink for Tests created successfully!"
ls -la Tests
- name: Build Unity 6 macOS with command line
run: |
echo "Building Unity 6 macOS using command line..."
export TMPDIR="/Users/svc_buildsdk/tmp"
mkdir -p "$TMPDIR"
mkdir -p sample-unity6/Tests
/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.txt" \
-quit \
-batchmode \
--buildPath "${{ github.workspace }}/sample-unity6/Tests"

echo "Build completed. Checking for build output..."
ls -la sample-unity6/Tests/
- name: Upload build log
if: always()
uses: actions/upload-artifact@v4
with:
name: Unity6-Build-Log
path: sample-unity6/build-log.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Build-StandaloneOSX-Unity6
path: sample-unity6/Tests

test:
name: Run ${{ matrix.targetPlatform }} UI tests 🧪
needs: build
needs: [build, build-unity6-macos]
if: |
always() &&
(needs.build.result == 'success' || needs.build.result == 'skipped') &&
(needs.build-unity6-macos.result == 'success' || needs.build-unity6-macos.result == 'skipped')
strategy:
matrix:
include:
Expand Down Expand Up @@ -162,7 +196,9 @@ jobs:
name: Build-${{ matrix.targetPlatform }}
path: ${{ matrix.projectPath }}/Tests
- name: Make macOS artifact executable
if: contains(matrix.targetPlatform, 'StandaloneOSX') && (github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
if: |
contains(matrix.targetPlatform, 'StandaloneOSX') &&
(github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform)
run: chmod -R +x '${{ matrix.projectPath }}/Tests/${{ matrix.unityAppName }}.app/Contents/MacOS'
- uses: actions/setup-python@v4
if: github.event_name != 'workflow_dispatch' || github.event.inputs.targetPlatform == 'All' || github.event.inputs.targetPlatform == matrix.targetPlatform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MonoBehaviour:
- line: '| mipStripping: 0'
- line: '| numberOfMipsStripped: 0'
- line: '| numberOfMipsStrippedPerMipmapLimitGroup: {}'
- line: '| m_StackTraceTypes: 010000000100000001000000010000000100000001000000'
- line: '| m_StackTraceTypes: 010000000000000000000000000000000100000001000000'
- line: '| iosShowActivityIndicatorOnLoading: -1'
- line: '| androidShowActivityIndicatorOnLoading: -1'
- line: '| iosUseCustomAppBackgroundBehavior: 0'
Expand Down
145 changes: 8 additions & 137 deletions sample/Assets/Editor/MacBuilderUnity6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,26 @@ private static void BuildPlayer(string defaultBuildPath, bool setupForAltTester
EditorApplication.Exit(1);
}

// Restore Build Profile to original state (empty scenes)
Debug.Log("Restoring Build Profile to original state...");
buildProfile.scenes = new EditorBuildSettingsScene[0];
EditorUtility.SetDirty(buildProfile);
AssetDatabase.SaveAssets();
Debug.Log("Build Profile restored");

if (setupForAltTester)
{
Debug.Log("=== Cleaning up AltTester settings after build ===");

{
// Clean up AltTester settings after build
Debug.Log("Removing AltTester from scripting define symbols...");
AltBuilder.RemoveAltTesterFromScriptingDefineSymbols(BuildTargetGroup.Standalone);

// Clean up custom e2e testing define
Debug.Log("Removing IMMUTABLE_E2E_TESTING define symbol...");
var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
defineSymbols = defineSymbols.Replace("IMMUTABLE_E2E_TESTING;", "").Replace(";IMMUTABLE_E2E_TESTING", "").Replace("IMMUTABLE_E2E_TESTING", "");
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);

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

RemoveAltFromScene(scenes[0]);
Debug.Log("✅ AltTester cleanup completed");
}
}
catch (Exception exception)
Expand All @@ -123,106 +124,6 @@ private static string GetBuildPathFromArgs(string defaultBuildPath)
return defaultBuildPath;
}

private static void ValidateBuildProfile(BuildProfile buildProfile)
{
Debug.Log($"Build Profile Debug Info:");
Debug.Log($" - Name: {buildProfile.name}");

// Use reflection to get available properties since API might vary
var type = buildProfile.GetType();
Debug.Log($" - Type: {type.Name}");

// Try to get common BuildProfile properties
try
{
var buildTargetProperty = type.GetProperty("buildTarget");
if (buildTargetProperty != null)
{
Debug.Log($" - Build Target: {buildTargetProperty.GetValue(buildProfile)}");
}

var subtargetProperty = type.GetProperty("subtarget");
if (subtargetProperty != null)
{
Debug.Log($" - Subtarget: {subtargetProperty.GetValue(buildProfile)}");
}

var platformIdProperty = type.GetProperty("platformId");
if (platformIdProperty != null)
{
Debug.Log($" - Platform ID: {platformIdProperty.GetValue(buildProfile)}");
}

var overrideGlobalSceneListProperty = type.GetProperty("overrideGlobalSceneList");
if (overrideGlobalSceneListProperty != null)
{
Debug.Log($" - Override Global Scene List: {overrideGlobalSceneListProperty.GetValue(buildProfile)}");
}
}
catch (System.Exception ex)
{
Debug.LogWarning($" - Could not access some BuildProfile properties: {ex.Message}");
}

Debug.Log($" - Scenes Count: {(buildProfile.scenes?.Length ?? 0)}");

if (buildProfile.scenes != null && buildProfile.scenes.Length > 0)
{
Debug.Log($" - Scenes:");
for (int i = 0; i < buildProfile.scenes.Length; i++)
{
Debug.Log($" [{i}] {buildProfile.scenes[i]}");
}
}
else
{
Debug.LogWarning(" - Build Profile has no scenes configured");
}

Debug.Log($" - Scripting Defines Count: {(buildProfile.scriptingDefines?.Length ?? 0)}");
if (buildProfile.scriptingDefines != null && buildProfile.scriptingDefines.Length > 0)
{
Debug.Log($" - Scripting Defines: {string.Join(", ", buildProfile.scriptingDefines)}");
}

// Check symlink status
Debug.Log($"Symlink Status Check:");
string scenesPath = "Assets/Scenes";
if (System.IO.Directory.Exists(scenesPath))
{
Debug.Log($" - Scenes directory exists: {scenesPath}");
try
{
var scenesDir = new System.IO.DirectoryInfo(scenesPath);
if (scenesDir.Attributes.HasFlag(System.IO.FileAttributes.ReparsePoint))
{
// Use reflection for LinkTarget since it might not be available on all platforms
var linkTargetProperty = scenesDir.GetType().GetProperty("LinkTarget");
if (linkTargetProperty != null)
{
Debug.Log($" - Scenes is a symlink: {linkTargetProperty.GetValue(scenesDir)}");
}
else
{
Debug.Log($" - Scenes is a symlink (LinkTarget property not available)");
}
}
else
{
Debug.Log($" - Scenes is a regular directory");
}
}
catch (System.Exception ex)
{
Debug.LogWarning($" - Could not check symlink status: {ex.Message}");
}
}
else
{
Debug.LogError($" - Scenes directory does not exist: {scenesPath}");
}
}

private static string[] GetScenesToBuild(bool setupForAltTester = false)
{
return new[]
Expand All @@ -241,62 +142,32 @@ private static string[] GetScenesToBuild(bool setupForAltTester = false)

private static void SetupAltTester(string[] scenes)
{
Debug.Log("=== Setting up AltTester for build ===");

// Add AltTester scripting define symbols
Debug.Log("Adding AltTester to scripting define symbols...");
AltBuilder.AddAltTesterInScriptingDefineSymbolsGroup(BuildTargetGroup.Standalone);

var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
Debug.Log($"Current scripting define symbols: {defineSymbols}");

// Add custom define for e2e testing to enable default browser behavior
if (!defineSymbols.Contains("IMMUTABLE_E2E_TESTING"))
{
Debug.Log("Adding IMMUTABLE_E2E_TESTING define symbol...");
defineSymbols += ";IMMUTABLE_E2E_TESTING";
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);
defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
Debug.Log($"Updated scripting define symbols: {defineSymbols}");
}
else
{
Debug.Log("IMMUTABLE_E2E_TESTING define symbol already present");
}

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

var instrumentationSettings = new AltInstrumentationSettings();
var host = System.Environment.GetEnvironmentVariable("ALTSERVER_HOST");
if (!string.IsNullOrEmpty(host))
{
Debug.Log($"Using custom AltServer host from environment: {host}");
instrumentationSettings.AltServerHost = host;
}
else
{
Debug.Log($"Using default AltServer host: {instrumentationSettings.AltServerHost}");
}

var port = System.Environment.GetEnvironmentVariable("ALTSERVER_PORT");
if (!string.IsNullOrEmpty(port))
{
Debug.Log($"Using custom AltServer port from environment: {port}");
instrumentationSettings.AltServerPort = int.Parse(port);
}
else
{
instrumentationSettings.AltServerPort = 13000;
Debug.Log($"Using default AltServer port: 13000");
}

instrumentationSettings.ResetConnectionData = true;
Debug.Log($"AltTester instrumentation settings: Host={instrumentationSettings.AltServerHost}, Port={instrumentationSettings.AltServerPort}, ResetConnectionData={instrumentationSettings.ResetConnectionData}");

Debug.Log($"Inserting AltTester prefab into first scene: {scenes[0]}");
AltBuilder.InsertAltInScene(scenes[0], instrumentationSettings);
Debug.Log("✅ AltTester setup completed successfully");
}

public static void RemoveAltFromScene(string scene)
Expand Down
6 changes: 3 additions & 3 deletions sample/Assets/Scenes/Passport/Initialisation.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1344,8 +1344,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1149.4546, y: 0}
m_SizeDelta: {x: 2258.9092, y: 0}
m_AnchoredPosition: {x: 1187.5127, y: 0}
m_SizeDelta: {x: 2335.0254, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1661390145
MonoBehaviour:
Expand Down Expand Up @@ -1643,7 +1643,7 @@ CanvasRenderer:
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 519420032}
- {fileID: 1850628784}
- {fileID: 1557497264}
- {fileID: 519420032}
- {fileID: 1314882730}
Loading