|
1 | | -# --- |
2 | | -# name: UI Tests 🧪 |
| 1 | +--- |
| 2 | +name: UI Tests 🧪 |
3 | 3 |
|
4 | | -# on: |
5 | | -# push: |
6 | | -# branches: [main] |
7 | | -# pull_request: |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + pull_request: |
8 | 9 |
|
9 | | -# concurrency: |
10 | | -# group: ${{ github.workflow }}-${{ github.ref }} |
11 | | -# cancel-in-progress: true |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
12 | 13 |
|
13 | | -# jobs: |
14 | | -# build: |
15 | | -# name: Build ${{ matrix.targetPlatform }} for AltTester 🛠️ |
16 | | -# runs-on: ubuntu-latest-8-cores |
17 | | -# strategy: |
18 | | -# fail-fast: false |
19 | | -# matrix: |
20 | | -# include: |
21 | | -# - targetPlatform: StandaloneOSX |
22 | | -# buildMethod: MacBuilder.BuildForAltTester |
23 | | -# buildPath: sample/Builds/MacOS |
24 | | -# - targetPlatform: StandaloneWindows64 |
25 | | -# buildMethod: WindowsBuilder.BuildForAltTester |
26 | | -# buildPath: sample/Builds/Windows64 |
27 | | -# - targetPlatform: Android |
28 | | -# buildMethod: MobileBuilder.BuildForAltTester |
29 | | -# buildPath: sample/Builds/Android |
30 | | -# steps: |
31 | | -# - uses: actions/checkout@v3 |
32 | | -# with: |
33 | | -# lfs: true |
34 | | -# - uses: actions/cache@v3 |
35 | | -# with: |
36 | | -# path: Library |
37 | | -# key: Library-${{ matrix.targetPlatform }}-${{ hashFiles('sample/Assets/**', 'sample/Packages/**', 'sample/ProjectSettings/**') }} |
38 | | -# restore-keys: | |
39 | | -# Library-${{ matrix.targetPlatform }} |
40 | | -# Library- |
41 | | -# - name: Build project |
42 | | -# uses: game-ci/unity-builder@v4 |
43 | | -# env: |
44 | | -# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} |
45 | | -# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |
46 | | -# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} |
47 | | -# with: |
48 | | -# targetPlatform: ${{ matrix.targetPlatform }} |
49 | | -# projectPath: sample |
50 | | -# buildMethod: ${{ matrix.buildMethod }} |
51 | | -# customParameters: -logFile logFile.log -quit -batchmode |
52 | | -# - name: List build directory |
53 | | -# run: ls -R ./ |
54 | | -# - name: Upload artifact |
55 | | -# uses: actions/upload-artifact@v4 |
56 | | -# if: always() |
57 | | -# with: |
58 | | -# name: Build-${{ matrix.targetPlatform }} |
59 | | -# path: ${{ matrix.buildPath }} |
60 | | -# test: |
61 | | -# name: Run ${{ matrix.targetPlatform }} UI tests 🧪 |
62 | | -# needs: build |
63 | | -# strategy: |
64 | | -# matrix: |
65 | | -# include: |
66 | | -# - targetPlatform: StandaloneOSX |
67 | | -# runs-on: [self-hosted, macOS] |
68 | | -# test_script: pytest -xs test/test_mac.py::MacTest |
69 | | -# - targetPlatform: StandaloneWindows64 |
70 | | -# runs-on: [self-hosted, windows] |
71 | | -# test_script: pytest -xs test/test_windows.py::WindowsTest |
72 | | -# - targetPlatform: Android |
73 | | -# runs-on: [ self-hosted, macOS ] |
74 | | -# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml" |
75 | | -# concurrency: |
76 | | -# group: test-${{ matrix.targetPlatform }} |
77 | | -# runs-on: ${{ matrix.runs-on }} |
78 | | -# steps: |
79 | | -# - uses: actions/checkout@v3 |
80 | | -# with: |
81 | | -# lfs: true |
82 | | -# - uses: actions/download-artifact@v4 |
83 | | -# with: |
84 | | -# name: Build-${{ matrix.targetPlatform }} |
85 | | -# path: sample/Tests |
86 | | -# - name: Make macOS artifact executable |
87 | | -# if: ${{ matrix.targetPlatform == 'StandaloneOSX' }} |
88 | | -# run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/* |
89 | | -# - uses: actions/setup-python@v4 |
90 | | -# with: |
91 | | -# python-version: "3.10" |
92 | | -# - name: Install dependencies (Windows) |
93 | | -# if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} |
94 | | -# run: pip install -r "sample/Tests/requirements-desktop.txt" |
95 | | -# - name: Install dependencies (Mac) |
96 | | -# if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} |
97 | | -# run: | |
98 | | -# if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then |
99 | | -# pip uninstall -y browserstack-sdk || true |
100 | | -# pip install -r "sample/Tests/requirements-desktop.txt" |
101 | | -# else |
102 | | -# pip install -r "sample/Tests/requirements-mobile.txt" |
103 | | -# fi |
104 | | -# - name: Run UI tests |
105 | | -# env: |
106 | | -# UNITY_APP_PATH: SampleApp.app |
107 | | -# UNITY_APP_NAME: SampleApp |
108 | | -# MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} |
109 | | -# BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} |
110 | | -# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
111 | | -# working-directory: sample/Tests |
112 | | -# run: ${{ matrix.test_script }} |
| 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 |
| 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 | + - name: List build directory |
| 54 | + run: ls -R ./ |
| 55 | + - name: Upload artifact |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + if: always() |
| 58 | + with: |
| 59 | + name: Build-${{ matrix.targetPlatform }} |
| 60 | + path: ${{ matrix.buildPath }} |
| 61 | + test: |
| 62 | + name: Run ${{ matrix.targetPlatform }} UI tests 🧪 |
| 63 | + needs: build |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + include: |
| 67 | + - targetPlatform: StandaloneOSX |
| 68 | + runs-on: [self-hosted, macOS] |
| 69 | + test_script: pytest -xs test/test_mac.py::MacTest |
| 70 | + # - targetPlatform: StandaloneWindows64 |
| 71 | + # runs-on: [self-hosted, windows] |
| 72 | + # test_script: pytest -xs test/test_windows.py::WindowsTest |
| 73 | + # - targetPlatform: Android |
| 74 | + # runs-on: [ self-hosted, macOS ] |
| 75 | + # test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml" |
| 76 | + concurrency: |
| 77 | + group: test-${{ matrix.targetPlatform }} |
| 78 | + runs-on: ${{ matrix.runs-on }} |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v3 |
| 81 | + with: |
| 82 | + lfs: true |
| 83 | + - uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + name: Build-${{ matrix.targetPlatform }} |
| 86 | + path: sample/Tests |
| 87 | + - name: Make macOS artifact executable |
| 88 | + if: ${{ matrix.targetPlatform == 'StandaloneOSX' }} |
| 89 | + run: chmod +x sample/Tests/SampleApp.app/Contents/MacOS/* |
| 90 | + - uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: "3.10" |
| 93 | + - name: Install dependencies (Windows) |
| 94 | + if: ${{ matrix.targetPlatform == 'StandaloneWindows64' }} |
| 95 | + run: pip install -r "sample/Tests/requirements-desktop.txt" |
| 96 | + - name: Install dependencies (Mac) |
| 97 | + if: ${{ matrix.targetPlatform != 'StandaloneWindows64' }} |
| 98 | + run: | |
| 99 | + if [[ "${{ matrix.targetPlatform }}" == "StandaloneOSX" ]]; then |
| 100 | + pip uninstall -y browserstack-sdk || true |
| 101 | + pip install -r "sample/Tests/requirements-desktop.txt" |
| 102 | + else |
| 103 | + pip install -r "sample/Tests/requirements-mobile.txt" |
| 104 | + fi |
| 105 | + - name: Run UI tests |
| 106 | + env: |
| 107 | + UNITY_APP_PATH: SampleApp.app |
| 108 | + UNITY_APP_NAME: SampleApp |
| 109 | + MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }} |
| 110 | + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} |
| 111 | + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
| 112 | + working-directory: sample/Tests |
| 113 | + run: ${{ matrix.test_script }} |
113 | 114 | # test-ios: |
114 | 115 | # name: Run iOS UI tests 🧪 |
115 | 116 | # runs-on: [ self-hosted, macOS ] |
|
0 commit comments