Skip to content

Commit b8ffae9

Browse files
authored
Merge pull request #312 from immutable/feature/sdk-3347-ui-cicd
[SDK-3347] add ui tests to CICD (WIP)
2 parents 9a33849 + cc83d1d commit b8ffae9

File tree

5 files changed

+98
-5
lines changed

5 files changed

+98
-5
lines changed

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
with:
8686
branch: gh-pages
8787
folder: build/WebGL/WebGL
88-
- uses: actions/upload-artifact@v3
88+
- uses: actions/upload-artifact@v4
8989
if: always()
9090
with:
9191
name: Build-${{ matrix.targetPlatform }}

.github/workflows/ui-tests.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: UI Tests 🧪
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
name: Build sample game for AltTester 🛠️
16+
runs-on: ubuntu-latest-8-cores
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
lfs: true
21+
- uses: actions/cache@v3
22+
with:
23+
path: Library
24+
key: Library-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }}
25+
restore-keys: |
26+
Library-
27+
- name: Build project
28+
uses: game-ci/unity-builder@v4
29+
env:
30+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
31+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
32+
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
33+
with:
34+
targetPlatform: StandaloneOSX
35+
projectPath: sample
36+
buildMethod: MacBuilder.BuildForAltTester
37+
customParameters: -logFile logFile.log -quit -batchmode
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: Build-StandaloneOSX
42+
path: sample/Builds/MacOS
43+
test:
44+
name: Run UI tests on AltTester 🧪
45+
runs-on: macos-latest
46+
needs: build
47+
steps:
48+
- uses: actions/checkout@v3
49+
with:
50+
lfs: true
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: Build-StandaloneOSX
54+
- name: Open application
55+
run: |
56+
pwd
57+
ls -la
58+
export RUN_IN_BROWSERSTACK="false"
59+
export ALTSERVER_PORT=13000
60+
export ALTSERVER_HOST="159.196.149.251"
61+
chmod -R 755 SampleApp.app
62+
open SampleApp.app
63+
- uses: actions/setup-python@v4
64+
with:
65+
python-version: "3.10"
66+
- name: Install dependencies
67+
run: pip install -r "sample/Tests/requirements.txt"
68+
- name: Run UI tests
69+
run: |
70+
export ALTSERVER_PORT=13000
71+
export ALTSERVER_HOST="159.196.149.251"
72+
pytest -s -v sample/Tests/test.py
73+

sample/Assets/Editor/MacBuilder.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#if UNITY_EDITOR_OSX
2-
31
using UnityEngine;
42
using UnityEditor;
53
using UnityEditor.SceneManagement;
@@ -117,5 +115,3 @@ public static void RemoveAltFromScene(string scene)
117115
}
118116

119117
}
120-
121-
#endif

sample/Tests/requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
AltTester_Driver==2.1.1
2+
google_api_python_client==2.136.0
3+
google_auth_oauthlib==1.2.0
4+
protobuf==5.27.2
5+
selenium==4.22.0
6+
pytest==8.2.2
7+
requests==2.32.3

sample/Tests/test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unittest
2+
from alttester import *
3+
4+
class UnityTest(unittest.TestCase):
5+
6+
# altdriver = None
7+
#
8+
# @classmethod
9+
# def setUpClass(cls):
10+
# cls.altdriver = AltDriver()
11+
#
12+
# @classmethod
13+
# def tearDownClass(cls):
14+
# cls.altdriver.stop()
15+
16+
def test(self):
17+
assert True

0 commit comments

Comments
 (0)