forked from homuler/MediaPipeUnityPlugin
-
Notifications
You must be signed in to change notification settings - Fork 2
168 lines (153 loc) · 5.36 KB
/
Copy pathwindows-test.yml
File metadata and controls
168 lines (153 loc) · 5.36 KB
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
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@v3
with:
ref: ${{ inputs.ref }}
# Setup build tools
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git patch unzip zip
- name: Mount bazelisk cache
uses: actions/cache@v3
with:
path: C:\Users\runneradmin\AppData\Local\bazelisk
key: windows-bazelisk
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install NumPy
run: pip install --no-cache-dir --user numpy
- name: Build
run: |
set ANDROID_NDK_HOME=
python build.py build --desktop cpu --opencv cmake -vv
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@v3
with:
name: windows-package
path: artifacts.tar
retention-days: 1
- name: Prepare for cache
run: |
(Get-Item C:\_bzl\*\install).Delete()
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os:
- windows-2019
unity:
- { version: "2021.3.18f1", changeset: "3129e69bc0c7" }
- { version: "2020.3.44f1", changeset: "7f159b6136da" }
steps:
- name: Install UnityHub
uses: crazy-max/ghaction-chocolatey@v2
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
- 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
}
- name: Download built artifacts
uses: actions/download-artifact@v3
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
- uses: actions/cache@v3
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
- 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@v3
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
if: ${{ always() }}
needs: test
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: windows-package
failOnError: false