Repository navigation
171 lines (155 loc) · 5.5 KB
/
Copy pathmacos-test.yml
File metadata and controls
171 lines (155 loc) · 5.5 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
169
170
171
name: Run Tests on macOS
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: macos-11
steps:
- uses: actions/checkout@v3
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
- name: Cache libraries
id: cache-libs
uses: actions/cache@v3
with:
path: |
Packages/com.github.homuler.mediapipe/Runtime/Plugins/libmediapipe_c.dylib
Packages/com.github.homuler.mediapipe/Runtime/Plugins/Protobuf/*.dll
Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/**/*.cs
key: libs-macos-11-v1-${{ hashFiles('cache_key.txt') }}
# Setup build tools
- name: Mount bazel cache
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: /private/var/tmp/_bazel_runner
key: bazel-macos-11-v1-${{ hashFiles('WORKSPACE') }}-${{ hashFiles('cache_key.txt') }}
restore-keys: |
bazel-macos-11-v1-${{ hashFiles('WORKSPACE') }}-
bazel-macos-11-v1-
- name: Remove cache_key.txt
run: |
rm cache_key.txt
# Setup Python
- uses: actions/setup-python@v4
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: |
unset ANDROID_NDK_HOME
python build.py build --desktop cpu --opencv cmake -vv
- name: Package
run: |
tar cvf artifacts.tar Packages/com.github.homuler.mediapipe
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: macos-package
path: artifacts.tar
retention-days: 1
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os:
- macos-11
- macos-12
unity:
- { version: "2022.3.6f1", changeset: "b9e6e7e9fa2d" }
- { version: "2021.3.29f1", changeset: "204d6dc9ae1c" }
- { version: "2020.3.44f1", changeset: "7f159b6136da" }
exclude:
- os: macos-12
unity: { version: "2020.3.44f1", changeset: "7f159b6136da" }
steps:
- name: Install UnityEditor
run: |
curl -LO https://beta.unity3d.com/download/${{ matrix.unity.changeset }}/MacEditorInstaller/Unity.pkg
sudo installer -package Unity.pkg -target /
- name: Generate a license activation file
run: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -createManualActivationFile -logFile || true
- 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 "${UNITY_EMAIL}" "${UNITY_PASSWORD}" Unity_v${{ matrix.unity.version }}.alf --authenticator-key "${UNITY_TOTP_KEY}"
- name: Activate License
run: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile -manualLicenseFile $(ls Unity_*.ulf) || true
rm Unity_*.ulf
- name: Download built artifacts
uses: actions/download-artifact@v3
with:
name: macos-package
- name: Create a dummy project
run: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -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: |
/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode \
-nographics \
-logFile \
-projectPath DummyProject \
-testResults ${ARTIFACTS_PATH}/results.xml \
-runTests \
-testPlatform EditMode \
-testCategory !GpuOnly
- name: Cat results.xml
env:
RESULT_FILE_PATH: DummyProject/testResults/results.xml
if: always()
run: |
[ -f $RESULT_FILE_PATH ] && cat ${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
needs: test
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: macos-package
failOnError: false