-
-
Notifications
You must be signed in to change notification settings - Fork 471
194 lines (176 loc) · 6.43 KB
/
windows-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Run Tests on Windows
on:
workflow_call:
inputs:
ref:
type: string
secrets:
UNITY_EMAIL:
required: true
UNITY_PASSWORD:
required: true
UNITY_TOTP_KEY:
required: true
jobs:
build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
# Cache built libraries
- name: Concat native library source files
run: |
find WORKSPACE packages.config build.py mediapipe_api/ third_party/ -type f | sort | xargs cat > cache_key.txt
shell: bash
- name: Cache libraries
id: cache-libs
uses: actions/cache@v4
with:
path: |
Packages/com.github.homuler.mediapipe/Runtime/Plugins/mediapipe_c.dll
Packages/com.github.homuler.mediapipe/Runtime/Plugins/Protobuf/*.dll
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/**/*.cs
Packages/com.github.homuler.mediapipe/PackageResources/MediaPipe/*.bytes
Packages/com.github.homuler.mediapipe/PackageResources/MediaPipe/*.txt
key: libs-windows-2019-v1-${{ hashFiles('cache_key.txt') }}
- name: Remove cache_key.txt
run: |
rm cache_key.txt
shell: cmd
# Setup build tools
- uses: msys2/setup-msys2@v2
if: steps.cache-libs.outputs.cache-hit != 'true'
with:
msystem: MINGW64
update: true
install: git patch unzip zip
# Setup Python
- uses: actions/setup-python@v5
if: steps.cache-libs.outputs.cache-hit != 'true'
with:
python-version: '3.10'
- name: Install NumPy
if: steps.cache-libs.outputs.cache-hit != 'true'
run: pip install --no-cache-dir --user numpy
- name: Build
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
set ANDROID_NDK_HOME=
python build.py build --desktop cpu --opencv cmake -vv
shell: cmd
- name: Shutdown Bazel
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
bazel --output_user_root=C:\_bzl shutdown
shell: cmd
- name: Package
run: |
tar cvf artifacts.tar Packages/com.github.homuler.mediapipe
shell: cmd
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-package
path: artifacts.tar
retention-days: 1
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os:
- windows-2019
unity:
- { version: "2022.3.34f1", changeset: "4886f5360533" }
- { version: "2021.3.33f1", changeset: "ee5a2aa03ab2" }
steps:
- name: Install UnityHub
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install unity-hub -y
- name: Install UnityEditor
run: |
Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity Hub\Unity Hub.exe" -ArgumentList "-- --headless install --version ${{ matrix.unity.version }} --changeset ${{ matrix.unity.changeset }}"
exit 0
- name: Generate a license activation file
run: |
Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${{ matrix.unity.version }}\Editor\Unity.exe" -ArgumentList "-quit -batchmode -createManualActivationFile -logfile"
exit 0
timeout-minutes: 1
- name: Request a Unity license file
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_TOTP_KEY: ${{ secrets.UNITY_TOTP_KEY }}
run: |
npm install -g unity-verify-code
git clone https://github.com/homuler/unity-license-activate.git
cd unity-license-activate
npm install
cd ..
npm install -g ./unity-license-activate
unity-license-activate "$env:UNITY_EMAIL" "$env:UNITY_PASSWORD" Unity_v${{ matrix.unity.version }}.alf --authenticator-key "$env:UNITY_TOTP_KEY"
- name: Activate License
run: |
$ulf_file = Get-Item Unity_*.ulf
$process = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${{ matrix.unity.version }}\Editor\Unity.exe" -ArgumentList "-batchmode -nographics -logFile -quit -manualLicenseFile $ulf_file"
$ulf_file.Delete()
if ($process.ExitCode -ne 1)
{
exit $process.ExitCode
}
timeout-minutes: 1
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: windows-package
- name: Create a dummy project
run: |
Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${{ matrix.unity.version }}\Editor\Unity.exe" -ArgumentList "-quit -batchmode -createProject DummyProject -logfile"
mv artifacts.tar DummyProject
cd DummyProject
tar xvf artifacts.tar
timeout-minutes: 8
- uses: actions/cache@v4
with:
path: DummyProject/Library
key: Library-DummyProject-${{ matrix.os }}-${{ matrix.unity.version }}-v1
- name: Run tests
env:
ARTIFACTS_PATH: testResults
run: |
$process = Start-Process -NoNewWindow -Wait -PassThru "C:\Program Files\Unity\Hub\Editor\${{ matrix.unity.version }}\Editor\Unity.exe" `
-ArgumentList `
"-batchmode -nographics `
-logFile `
-projectPath DummyProject `
-testResults $env:ARTIFACTS_PATH/results.xml `
-runTests `
-testPlatform EditMode `
-testCategory !GpuOnly;!SignalAbort"
exit $process.ExitCode
timeout-minutes: 3
- name: Cat results.xml
env:
RESULT_FILE_PATH: DummyProject\testResults\results.xml
if: always()
run: |
if (Test-Path $env:RESULT_FILE_PATH -PathType Leaf) {
cat $env:RESULT_FILE_PATH
}
- uses: actions/upload-artifact@v4
if: always()
with:
name: Test results for ${{ matrix.unity.version }} on ${{ matrix.os }}
path: DummyProject\testResults
retention-days: 7
post-test:
runs-on: ubuntu-latest
needs: test
steps:
- uses: geekyeggo/delete-artifact@v4
with:
name: windows-package
failOnError: false