forked from luxonis/depthai-core
-
Notifications
You must be signed in to change notification settings - Fork 0
340 lines (285 loc) · 11.5 KB
/
main.workflow.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
name: DepthAI Core CI/CD
on:
workflow_dispatch:
push:
branches:
- main
- develop
- gen2
- gen2_develop
tags:
- 'v*'
pull_request:
branches:
- main
- develop
- gen2
- gen2_develop
jobs:
style:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install format dependencies
run: |
sudo apt-get install clang-format-10
- name: configure
run: cmake . -Bbuild -DDEPTHAI_CLANG_FORMAT=ON -DCLANG_FORMAT_BIN=clang-format-10
- name: check style
run: ci/check_format.sh build
tidy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install clang-tidy-10
- name: configure
run: cmake . -Bbuild -DDEPTHAI_CLANG_TIDY=ON -DCLANG_TIDY_BIN=clang-tidy-10
- name: Run clang-tidy
run: cmake --build build --parallel 4
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
cmake: ['3.10.x', '3.29.x'] # Older version (Ubuntu 18.04) and newest
exclude:
- os: windows-latest
cmake: '3.10.x'
- os: macos-latest # Skip the old cmake on latest macos - doesn't handle ARM64 aarch correctly
cmake: '3.10.x'
steps:
- name: Cache .hunter folder
if: matrix.os != 'windows-latest'
uses: actions/cache@v3
with:
path: ~/.hunter/
key: hunter-${{ matrix.os }}-${{ matrix.cmake }}
- name: Cache .hunter folder
if: matrix.os == 'windows-latest'
uses: actions/cache@v3
with:
path: C:/.hunter/
key: hunter-${{ matrix.os }}-${{ matrix.cmake }}
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: ${{ matrix.cmake }}
- name: Install dependencies
if: matrix.os == 'macos-latest'
run: |
brew install opencv
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libopencv-dev
- name: Install dependencies
if: matrix.os == 'windows-latest'
run: |
choco install opencv
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build (old CMake, gcc/Clang)
if: matrix.cmake == '3.10.x' && matrix.os != 'windows-latest'
run: |
cmake -H. -Bbuild -D'CMAKE_BUILD_TYPE=Release' -D'HUNTER_CONFIGURATION_TYPES=Release' -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' ${{ env.CMAKE_ARGS }}
cmake --build build --config Release -- -j4
# CMake binaries unavailable
# - name: Build (old CMake, MSVC)
# if: matrix.cmake == '3.10.x' && matrix.os == 'windows-latest'
# run: |
# cmake -H. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON'
# cmake --build build
- name: Build (newest CMake)
if: matrix.cmake != '3.10.x'
run: |
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_CONFIGURATION_TYPES=Release -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON ${{ env.CMAKE_ARGS }}
cmake --build build --parallel 4 --config Release
integration:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
build-type: [Debug, Release]
shared: [true, false]
platform: [x64]
include:
- platform: Win32
os: windows-latest
shared: true
build-type: Debug
- platform: Win32
os: windows-latest
shared: true
build-type: Release
steps:
- name: Cache .hunter folder
if: matrix.os != 'windows-latest'
uses: actions/cache@v3
with:
path: ~/.hunter/
key: hunter-${{ matrix.os }}-shared_${{ matrix.shared }}
- name: Cache .hunter folder
if: matrix.os == 'windows-latest'
uses: actions/cache@v3
with:
path: C:/.hunter/
key: hunter-${{ matrix.os }}-shared_${{ matrix.shared }}
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies
if: matrix.os == 'macos-latest'
run: |
brew install opencv
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libopencv-dev
- name: Install dependencies
if: matrix.os == 'windows-latest'
run: |
choco install opencv
echo "OpenCV_DIR=C:\tools\opencv\build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CMAKE_GENERATOR=Visual Studio 17 2022" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CMAKE_GENERATOR_PLATFORM=${{ matrix.platform }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.29.x'
- name: Configure ${{ matrix.build-type }}, shared ${{ matrix.shared }}, ${{ matrix.platform }}
run: cmake -S . -B build -D BUILD_SHARED_LIBS=${{ matrix.shared}} -D CMAKE_BUILD_TYPE=${{ matrix.build-type }} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/depthai_install ${{ env.CMAKE_ARGS }}
- name: Set path to shared library dll (Windows)
if: matrix.os == 'windows-latest'
run: echo "$GITHUB_WORKSPACE/depthai_install/bin/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build and install
run: cmake --build build --config ${{ matrix.build-type }} --target install --parallel 4
- name: Upload Win64 shared library
if: matrix.os == 'windows-latest' && matrix.shared && matrix.platform == 'x64'
uses: actions/upload-artifact@v3
with:
name: windows-prebuilt-win64
path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/
- name: Upload Win32 shared library
if: matrix.os == 'windows-latest' && matrix.shared && matrix.platform == 'Win32'
uses: actions/upload-artifact@v3
with:
name: windows-prebuilt-win32-no-opencv
path: ${{ env.GITHUB_WORKSPACE }}/depthai_install/
- name: Build and test add_subdirectory
run: |
cmake -S tests/integration/ -B tests/integration/build_add_subdirectory -D TEST_FIND_PACKAGE=OFF ${{ env.CMAKE_ARGS }}
cmake --build tests/integration/build_add_subdirectory --config ${{ matrix.build-type }} --parallel 4
cd tests/integration/build_add_subdirectory
ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error
- name: Build and test find_package (installed)
run: |
cmake -S tests/integration/ -B tests/integration/build_find_package -D TEST_FIND_PACKAGE=ON -D depthai_DIR=$GITHUB_WORKSPACE/depthai_install/lib/cmake/depthai ${{ env.CMAKE_ARGS }}
cmake --build tests/integration/build_find_package --config ${{ matrix.build-type }} --parallel 4
cd tests/integration/build_find_package
ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error
- name: Build and test find_package (build directory)
run: |
cmake -S tests/integration/ -B tests/integration/build_find_package_2 -D TEST_FIND_PACKAGE=ON -D depthai_DIR=$GITHUB_WORKSPACE/build ${{ env.CMAKE_ARGS }}
cmake --build tests/integration/build_find_package_2 --config ${{ matrix.build-type }} --parallel 4
cd tests/integration/build_find_package_2
ctest -C ${{ matrix.build-type }} --output-on-failure --no-tests=error
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, style, integration]
runs-on: ubuntu-latest
# Clone repository
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# Get tag version
# TODO(themarpe) - Node12, has to be updated
- name: Get latest release version number
id: tag
uses: battila7/get-version-action@v2
# Check if version matches (TODO)
#- name: Check if version matches
# run: |
- uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install dependencies
run: python3.8 -m pip install git-archive-all
- name: Download Win64 artifacts
uses: actions/download-artifact@v3
with:
name: 'windows-prebuilt-win64'
path: depthai-core-${{ steps.tag.outputs.version }}-win64
- name: Download Win32 artifacts
uses: actions/download-artifact@v3
with:
name: 'windows-prebuilt-win32-no-opencv'
path: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv
- name: Create release assets
run: |
git-archive-all depthai-core-${{ steps.tag.outputs.version }}.tar.gz
git-archive-all depthai-core-${{ steps.tag.outputs.version }}.zip
zip -r depthai-core-${{ steps.tag.outputs.version }}-win64.zip depthai-core-${{ steps.tag.outputs.version }}-win64
zip -r depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv
# Create GitHub release
- uses: actions/create-release@master
id: createRelease
name: Create ${{ steps.tag.outputs.version }} depthai-core release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
## Features
## Bug fixes
## Misc
draft: true
# Upload release assets
- name: Upload source package (zip)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}.zip
asset_name: depthai-core-${{ steps.tag.outputs.version }}.zip
asset_content_type: application/octet-stream
- name: Upload source package (tar.gz)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}.tar.gz
asset_name: depthai-core-${{ steps.tag.outputs.version }}.tar.gz
asset_content_type: application/octet-stream
- name: Upload Win64 package (zip)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win64.zip
asset_name: depthai-core-${{ steps.tag.outputs.version }}-win64.zip
asset_content_type: application/octet-stream
- name: Upload Win32 package (zip)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ github.workspace }}/depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip
asset_name: depthai-core-${{ steps.tag.outputs.version }}-win32-no-opencv.zip
asset_content_type: application/octet-stream