@@ -12,145 +12,174 @@ concurrency:
12
12
cancel-in-progress : true
13
13
14
14
jobs :
15
- build :
16
- name : Build ${{ matrix.targetPlatform }} for AltTester 🛠️
17
- runs-on : ubuntu-latest-8-cores
18
- strategy :
19
- fail-fast : false
20
- matrix :
21
- include :
22
- - targetPlatform : StandaloneOSX
23
- buildMethod : MacBuilder.BuildForAltTester
24
- buildPath : sample/Builds/MacOS
25
- - targetPlatform : StandaloneWindows64
26
- buildMethod : WindowsBuilder.BuildForAltTester
27
- buildPath : sample/Builds/Windows64
28
- - targetPlatform : Android
29
- buildMethod : MobileBuilder.BuildForAltTester
30
- buildPath : sample/Builds/Android
15
+ # build:
16
+ # name: Build ${{ matrix.targetPlatform }} for AltTester 🛠️
17
+ # runs-on: ubuntu-latest-8-cores
18
+ # strategy:
19
+ # fail-fast: false
20
+ # matrix:
21
+ # include:
22
+ # - targetPlatform: StandaloneOSX
23
+ # buildMethod: MacBuilder.BuildForAltTester
24
+ # buildPath: sample/Builds/MacOS
25
+ # - targetPlatform: StandaloneWindows64
26
+ # buildMethod: WindowsBuilder.BuildForAltTester
27
+ # buildPath: sample/Builds/Windows64
28
+ # - targetPlatform: Android
29
+ # buildMethod: MobileBuilder.BuildForAltTester
30
+ # buildPath: sample/Builds/Android
31
+ # steps:
32
+ # - uses: actions/checkout@v3
33
+ # with:
34
+ # lfs: true
35
+ # - uses: actions/cache@v3
36
+ # with:
37
+ # path: Library
38
+ # key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }}
39
+ # restore-keys: |
40
+ # Library-${{ matrix.targetPlatform }}
41
+ # Library-
42
+ # - name: Build project
43
+ # uses: game-ci/unity-builder@v4
44
+ # env:
45
+ # UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
46
+ # UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
47
+ # UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
48
+ # with:
49
+ # targetPlatform: ${{ matrix.targetPlatform }}
50
+ # projectPath: sample
51
+ # buildMethod: ${{ matrix.buildMethod }}
52
+ # customParameters: -logFile logFile.log -quit -batchmode
53
+ # artifactsPath: ${{ matrix.buildPath }}
54
+ # - name: List build directory
55
+ # run: ls -R ./
56
+ # - name: Ensure build path exists
57
+ # run: mkdir -p ${{ matrix.buildPath }}
58
+ # - name: Upload artifact
59
+ # uses: actions/upload-artifact@v4
60
+ # if: always()
61
+ # with:
62
+ # name: Build-${{ matrix.targetPlatform }}
63
+ # path: ${{ matrix.buildPath }}
64
+ # test:
65
+ # name: Run ${{ matrix.targetPlatform }} UI tests 🧪
66
+ # needs: build
67
+ # strategy:
68
+ # matrix:
69
+ # include:
70
+ # - targetPlatform: StandaloneOSX
71
+ # runs-on: [self-hosted, macOS]
72
+ # test_script: pytest -xs test/test_mac.py::MacTest
73
+ # - targetPlatform: StandaloneWindows64
74
+ # runs-on: [self-hosted, windows]
75
+ # test_script: pytest -xs test/test_windows.py::WindowsTest
76
+ # - targetPlatform: Android
77
+ # runs-on: [ self-hosted, macOS ]
78
+ # test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
79
+ # concurrency:
80
+ # group: test-${{ matrix.targetPlatform }}
81
+ # runs-on: ${{ matrix.runs-on }}
82
+ # steps:
83
+ # - uses: actions/checkout@v3
84
+ # with:
85
+ # lfs: true
86
+ # - name: Create temporary keychain
87
+ # if: ${{ matrix.targetPlatform == 'StandaloneOSX' }}
88
+ # run: |
89
+ # security list-keychains
90
+ # security delete-keychain temporary || true
91
+ # security list-keychains
92
+ # security create-keychain -p "" temporary
93
+ # security default-keychain -s temporary
94
+ # security unlock-keychain -p "" temporary
95
+ # security set-keychain-settings -lut 600 temporary
96
+ # - uses: actions/download-artifact@v4
97
+ # with:
98
+ # name: Build-${{ matrix.targetPlatform }}
99
+ # path: sample/Tests
100
+ # - name: Make macOS artifact executable
101
+ # if: ${{ matrix.targetPlatform == 'StandaloneOSX' }}
102
+ # run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/*
103
+ # - uses: actions/setup-python@v4
104
+ # with:
105
+ # python-version: "3.10"
106
+ # - name: Install dependencies (Windows)
107
+ # if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }}
108
+ # run: pip install -r "sample/Tests/requirements-desktop.txt"
109
+ # - name: Install dependencies (Mac)
110
+ # if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }}
111
+ # run: |
112
+ # if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then
113
+ # pip uninstall -y browserstack-sdk || true
114
+ # pip install -r "sample/Tests/requirements-desktop.txt"
115
+ # else
116
+ # pip install -r "sample/Tests/requirements-mobile.txt"
117
+ # fi
118
+ # - name: Run UI tests
119
+ # env:
120
+ # UNITY_APP_PATH: SampleApp.app
121
+ # UNITY_APP_NAME: SampleApp
122
+ # MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
123
+ # BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
124
+ # BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
125
+ # working-directory: sample/Tests
126
+ # run: ${{ matrix.test_script }}
127
+ # - name: Remove temporary keychain
128
+ # if: ${{ matrix.targetPlatform == 'StandaloneOSX' }}
129
+ # run: |
130
+ # security list-keychains
131
+ # security default-keychain -s ~/Library/Keychains/login.keychain-db
132
+ # security delete-keychain temporary
133
+ # security list-keychains
134
+ test-ios :
135
+ name : Run iOS UI tests 🧪
136
+ runs-on : [ self-hosted, macOS ]
31
137
steps :
32
138
- uses : actions/checkout@v3
33
139
with :
34
140
lfs : true
35
- - uses : actions/cache@v3
36
- with :
37
- path : Library
38
- key : Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }}
39
- restore-keys : |
40
- Library-${{ matrix.targetPlatform }}
41
- Library-
42
- - name : Build project
43
- uses : game-ci/unity-builder@v4
141
+ - name : Build iOS app
142
+ working-directory : sample
143
+ run : ./build_ios.sh
144
+ - name : Install jq (if not installed)
145
+ run : |
146
+ if ! command -v jq &> /dev/null; then
147
+ echo "jq not found, installing..."
148
+ brew install jq
149
+ else
150
+ echo "jq is already installed"
151
+ fi
152
+ - name : Upload iOS app to BrowserStack
153
+ working-directory : sample/Tests
44
154
env :
45
- UNITY_EMAIL : ${{ secrets.UNITY_EMAIL }}
46
- UNITY_PASSWORD : ${{ secrets.UNITY_PASSWORD }}
47
- UNITY_SERIAL : ${{ secrets.UNITY_SERIAL }}
48
- with :
49
- targetPlatform : ${{ matrix.targetPlatform }}
50
- projectPath : sample
51
- buildMethod : ${{ matrix.buildMethod }}
52
- customParameters : -logFile logFile.log -quit -batchmode
53
- artifactsPath : ${{ matrix.buildPath }}
54
- - name : List build directory
55
- run : ls -R ./
56
- - name : Ensure build path exists
57
- run : mkdir -p ${{ matrix.buildPath }}
58
- - name : Upload artifact
59
- uses : actions/upload-artifact@v4
60
- if : always()
61
- with :
62
- name : Build-${{ matrix.targetPlatform }}
63
- path : ${{ matrix.buildPath }}
64
- test :
65
- name : Run ${{ matrix.targetPlatform }} UI tests 🧪
66
- needs : build
67
- strategy :
68
- matrix :
69
- include :
70
- - targetPlatform : StandaloneOSX
71
- runs-on : [self-hosted, macOS]
72
- test_script : pytest -xs test/test_mac.py::MacTest
73
- - targetPlatform : StandaloneWindows64
74
- runs-on : [self-hosted, windows]
75
- test_script : pytest -xs test/test_windows.py::WindowsTest
76
- - targetPlatform : Android
77
- runs-on : [ self-hosted, macOS ]
78
- test_script : browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
79
- concurrency :
80
- group : test-${{ matrix.targetPlatform }}
81
- runs-on : ${{ matrix.runs-on }}
82
- steps :
83
- - uses : actions/checkout@v3
84
- with :
85
- lfs : true
86
- - name : Create temporary keychain
87
- if : ${{ matrix.targetPlatform == 'StandaloneOSX' }}
155
+ BROWSERSTACK_USERNAME : ${{ secrets.BROWSERSTACK_USERNAME }}
156
+ BROWSERSTACK_ACCESS_KEY : ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
88
157
run : |
89
- security list-keychains
90
- security delete-keychain temporary || true
91
- security list-keychains
92
- security create-keychain -p "" temporary
93
- security default-keychain -s temporary
94
- security unlock-keychain -p "" temporary
95
- security set-keychain-settings -lut 600 temporary
96
- - uses : actions/download-artifact@v4
97
- with :
98
- name : Build-${{ matrix.targetPlatform }}
99
- path : sample/Tests
100
- - name : Make macOS artifact executable
101
- if : ${{ matrix.targetPlatform == 'StandaloneOSX' }}
102
- run : chmod +x sample/Tests/SampleApp.app/Contents/MacOS/*
158
+ curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
159
+ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \
160
+
161
+
162
+ # Extract app_url from the response using jq
163
+ app_url=$(echo "$response" | jq -r '.app_url')
164
+
165
+ if [ -z "$app_url" ]; then
166
+ echo "Error: app_url is not found in the response"
167
+ exit 1 # Fail the workflow if app_url is not present
168
+ fi
169
+
170
+ echo "app_url: $app_url"
171
+
172
+ echo "APP_URL=$app_url" >> $GITHUB_ENV
103
173
- uses : actions/setup-python@v4
104
174
with :
105
175
python-version : " 3.10"
106
- - name : Install dependencies (Windows)
107
- if : ${{ matrix.targetPlatform == 'StandaloneWindows64' }}
108
- run : pip install -r "sample/Tests/requirements-desktop.txt"
109
- - name : Install dependencies (Mac)
110
- if : ${{ matrix.targetPlatform != 'StandaloneWindows64' }}
111
- run : |
112
- if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then
113
- pip uninstall -y browserstack-sdk || true
114
- pip install -r "sample/Tests/requirements-desktop.txt"
115
- else
116
- pip install -r "sample/Tests/requirements-mobile.txt"
117
- fi
176
+ - name : Install dependencies
177
+ run : pip install -r "sample/Tests/requirements-mobile.txt"
118
178
- name : Run UI tests
119
179
env :
120
- UNITY_APP_PATH : SampleApp.app
121
- UNITY_APP_NAME : SampleApp
122
180
MAILSLURP_API_KEY : ${{ secrets.MAILSLURP_API_KEY }}
123
181
BROWSERSTACK_USERNAME : ${{ secrets.BROWSERSTACK_USERNAME }}
124
182
BROWSERSTACK_ACCESS_KEY : ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
125
183
working-directory : sample/Tests
126
- run : ${{ matrix.test_script }}
127
- - name : Remove temporary keychain
128
- if : ${{ matrix.targetPlatform == 'StandaloneOSX' }}
129
- run : |
130
- security list-keychains
131
- security default-keychain -s ~/Library/Keychains/login.keychain-db
132
- security delete-keychain temporary
133
- security list-keychains
134
- # test-ios:
135
- # name: Run iOS UI tests 🧪
136
- # runs-on: [ self-hosted, macOS ]
137
- # steps:
138
- # - uses: actions/checkout@v3
139
- # with:
140
- # lfs: true
141
- # - name: Build iOS app
142
- # working-directory: sample
143
- # run: ./build_ios.sh
144
- # - uses: actions/setup-python@v4
145
- # with:
146
- # python-version: "3.10"
147
- # - name: Install dependencies
148
- # run: pip install -r "sample/Tests/requirements-mobile.txt"
149
- # - name: Run UI tests
150
- # env:
151
- # MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
152
- # BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
153
- # BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
154
- # working-directory: sample/Tests
155
- # run: browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
184
+ run : browserstack-sdk pytest -s ./test/test_ios.py --browserstack.config "browserstack.ios.yml"
156
185
0 commit comments