-
Notifications
You must be signed in to change notification settings - Fork 0
519 lines (466 loc) · 19.2 KB
/
macos.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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
name: MacOS
permissions: {}
on:
workflow_dispatch:
inputs:
developer_build:
description: 'Set to OFF for Release builds.'
required: false
default: 'ON'
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
types: [opened, reopened, synchronize] # Rebuild on new pushes to PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NPROC: 4
DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }}
jobs:
MacOS:
permissions:
contents: write # upload
actions: write # release
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
# macos-13 is Intel runner, macos-14 is Apple Silicon
# https://github.com/actions/runner-images
os: [macos-13, macos-14]
python_version: ['3.11']
env:
BUILD_SHARED_LIBS: OFF
BUILD_CUDA_MODULE: OFF
BUILD_TENSORFLOW_OPS: OFF
BUILD_PYTORCH_OPS: OFF
LOW_MEM_USAGE: ON
CONDA_DEP_FILE_CLOUDVIEWER: ".ci/conda_macos_cloudViewer.yml"
steps:
- name: Setup DEVELOPER_BUILD
run: |
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "DEVELOPER_BUILD=OFF" >> $GITHUB_ENV
else
echo "DEVELOPER_BUILD=${{ github.event.inputs.developer_build || 'ON' }}" >> $GITHUB_ENV
fi
- name: Set up Install path environment
run: |
echo "INSTALL_DIR=${HOME}/cloudViewer_install" >> $GITHUB_ENV
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v4
with:
# Ref: https://github.com/apache/incubator-mxnet/pull/18459/files
path: ~/.ccache
# We include the commit sha in the cache key, as new cache entries are
# only created if there is no existing entry for the key yet.
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ github.sha }}
# Restore any ccache cache entry, if none for
# ${{ runner.os }}-${{ runner.arch }}-ccache-${{ github.sha }} exists.
# Common prefix will be used so that ccache can be used across commits.
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ccache
- name: Set up Python version
run: |
sed -i "" "s/3.8/${{ matrix.python_version }}/g" ${{ env.CONDA_DEP_FILE_CLOUDVIEWER }}
# DGM: without caching, using conda on Windows takes a long time...
- name: Set up Python version
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: cloudViewer
auto-activate-base: false
environment-file: ${{ env.CONDA_DEP_FILE_CLOUDVIEWER }}
- name: Install dependencies
run: |
brew install ccache
# Fix gfortran not found issue
ln -s $(which gfortran-13) /usr/local/bin/gfortran
# Install libomp 11.1.0 from old brew bottle for x64 catalina (10.15)
# / arm64 big sur (11.0). Directly installing the Ruby formula will
# install for the current OS.
# https://github.com/microsoft/LightGBM/issues/4229
if [[ ${{ runner.arch}} == "X64" ]]; then
# brew unlink libomp
# x64 catalina (10.15) bottle
export LIBOMP_BOTTLE_HASH=45a5aa653bd45bd5ff5858580b1a4670c4b5a51ea29d68d45a53f72f56010e05
else # ARM64
# arm64 big_sur (11.0) bottle
export LIBOMP_BOTTLE_HASH=f87f7841eb8b72650fa771af39642361aec371ea1a1f94f081ecc0e8168a0e75
fi
curl -L -H "Authorization: Bearer QQ==" -o libomp-11.1.0.bottle.tar.gz \
https://ghcr.io/v2/homebrew/core/libomp/blobs/sha256:$LIBOMP_BOTTLE_HASH
brew install -f libomp-11.1.0.bottle.tar.gz
curl -L "https://raw.githubusercontent.com/Asher-1/CloudViewerUpdate/main/tools/QtIFW-4.6.1-darwin.zip" -o ~/QtIFW-4.6.1-darwin.zip
unzip -q ~/QtIFW-4.6.1-darwin.zip -d ~/
rm ~/QtIFW-4.6.1-darwin.zip
ls -hal ~/QtIFW-4.6.1-darwin/bin
ccache -M 2G # See .github/workflows/readme.md for ccache strategy.
- name: Config and build
shell: bash -l {0}
run: |
if [[ ${{ runner.arch}} == "ARM64" ]]; then
brew install libomp
brew info libomp
export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
echo "LDFLAGS: $LDFLAGS"
echo "CPPFLAGS: $CPPFLAGS"
ls -l /opt/homebrew/opt/libomp/include
ls -l /opt/homebrew/opt/libomp/lib
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
echo "OpenMP_ROOT=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
else
brew install libomp
brew info libomp
export LDFLAGS="-L/usr/local/opt/libomp/lib"
export CPPFLAGS="-I/usr/local/opt/libomp/include"
echo "LDFLAGS: $LDFLAGS"
echo "CPPFLAGS: $CPPFLAGS"
ls -l /usr/local/opt/libomp/include
ls -l /usr/local/opt/libomp/lib
echo "LDFLAGS=-L/usr/local/opt/libomp/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
echo "OpenMP_ROOT=/usr/local/opt/libomp" >> $GITHUB_ENV
fi
export PATH=${HOME}/QtIFW-4.6.1-darwin/bin:$PATH
export PATH=/usr/local/var/homebrew/linked/ccache/libexec:$PATH
export PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/lib/pkgconfig:$CONDA_PREFIX/lib/cmake:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
echo "DEVELOPER_BUILD is ${{ env.DEVELOPER_BUILD }}"
echo "INSTALL_DIR is ${{ env.INSTALL_DIR }}"
ccache -s
./util/run_ci.sh
CLOUDVIEWER_VERSION_FULL="$(grep -F CLOUDVIEWER_VERSION_FULL build/CMakeCache.txt | cut -f2 -d'=')"
DEVEL_PKG_NAME="$(basename ${{ env.INSTALL_DIR }}/ACloudViewer-${CLOUDVIEWER_VERSION_FULL}*.dmg)"
echo "DEVEL_PKG_NAME=$DEVEL_PKG_NAME" >> $GITHUB_ENV
- name: Upload ACloudViewer app to GitHub artifacts
uses: actions/upload-artifact@v4
if: ${{ env.BUILD_SHARED_LIBS == 'OFF' }}
with:
name: ACloudViewer-app-macosx-${{ runner.arch}}
path: |
${{ env.INSTALL_DIR }}/${{ env.DEVEL_PKG_NAME }}
if-no-files-found: error
- name: Update devel release
if: ${{ github.ref == 'refs/heads/main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload main-devel ${{ env.INSTALL_DIR }}/${{ env.DEVEL_PKG_NAME }} --clobber
gh release view main-devel
- name: Public App Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: false
generate_release_notes: false
prerelease: false
# body_path: ${{github.workspace}}/CHANGELOG.md
files: |
${{ env.INSTALL_DIR }}/${{ env.DEVEL_PKG_NAME }}
build-wheel:
name: Build wheel
permissions:
contents: write # upload
actions: write # release
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
# https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6
matrix:
# macos-13 is Intel runner, macos-14 is Apple Silicon
# https://github.com/actions/runner-images
os: [macos-13, macos-14]
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
is_main:
- ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
exclude:
- is_main: false
python_version: '3.8'
- is_main: false
python_version: '3.9'
- is_main: false
python_version: '3.10'
- is_main: false
python_version: '3.11'
env:
CONDA_DEP_FILE: ".ci/conda_macos.yml"
BUILD_CUDA_MODULE: OFF
BUILD_TORCH_OPS: ON
# TensorFlow v2.16 does not support Python 3.8
BUILD_TENSORFLOW_OPS: OFF
CLOUDVIEWER_ML_ROOT: ${{ github.workspace }}/CloudViewer-ML
steps:
- name: Setup DEVELOPER_BUILD
run: |
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "DEVELOPER_BUILD=OFF" >> $GITHUB_ENV
else
echo "DEVELOPER_BUILD=${{ github.event.inputs.developer_build || 'ON' }}" >> $GITHUB_ENV
fi
- name: Checkout source code
uses: actions/checkout@v4
- name: Checkout CloudViewer-ML source code
uses: actions/checkout@v4
with:
repository: Asher-1/CloudViewer-ML
path: ${{ env.CLOUDVIEWER_ML_ROOT }}
- name: Setup cache
uses: actions/cache@v4
with:
# Ref: https://github.com/apache/incubator-mxnet/pull/18459/files
path: ~/.ccache
# We include the commit sha in the cache key, as new cache entries are
# only created if there is no existing entry for the key yet.
key: ${{ runner.os }}-${{ runner.arch }}-ccache-${{ github.sha }}
# Restore any ccache cache entry, if none for
# ${{ runner.os }}-${{ runner.arch }}-ccache-${{ github.sha }} exists.
# Common prefix will be used so that ccache can be used across commits.
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ccache
- name: Set up Python version
run: |
sed -i "" "s/3.8/${{ matrix.python_version }}/g" ${{ env.CONDA_DEP_FILE }}
- name: Set up Python environment
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: python${{ matrix.python_version }}
auto-activate-base: false
environment-file: ${{ env.CONDA_DEP_FILE }}
- name: Install python dependencies
shell: bash -l {0}
run: |
echo "Using python: $(which python)"
python --version
echo -n "Using pip: $(which pip)"
python -m pip --version
echo "Using cmake: $(which cmake)"
cmake --version
source util/ci_utils.sh
install_python_dependencies
- name: Install dependencies
run: |
# Fix macos-14 arm64 runner image issues, see comments in MacOS job.
ln -s $(which gfortran-13) /usr/local/bin/gfortran
# Install libomp 11.1.0. See comment above.
if [[ ${{ runner.arch}} == "X64" ]]; then
# brew unlink libomp
# x64 catalina (10.15) bottle
export LIBOMP_BOTTLE_HASH=45a5aa653bd45bd5ff5858580b1a4670c4b5a51ea29d68d45a53f72f56010e05
else # ARM64
# arm64 big_sur (11.0) bottle
export LIBOMP_BOTTLE_HASH=f87f7841eb8b72650fa771af39642361aec371ea1a1f94f081ecc0e8168a0e75
fi
curl -L -H "Authorization: Bearer QQ==" -o libomp-11.1.0.bottle.tar.gz \
https://ghcr.io/v2/homebrew/core/libomp/blobs/sha256:$LIBOMP_BOTTLE_HASH
brew install -f libomp-11.1.0.bottle.tar.gz
brew install ccache
ccache -M 2G # See .github/workflows/readme.md for ccache strategy.
- name: Config and build wheel
shell: bash -l {0}
run: |
if [[ ${{ runner.arch}} == "ARM64" ]]; then
brew install libomp
brew info libomp
export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
echo "LDFLAGS: $LDFLAGS"
echo "CPPFLAGS: $CPPFLAGS"
ls -l /opt/homebrew/opt/libomp/include
ls -l /opt/homebrew/opt/libomp/lib
echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
echo "OpenMP_ROOT=/opt/homebrew/opt/libomp" >> $GITHUB_ENV
else
brew install libomp
brew info libomp
export LDFLAGS="-L/usr/local/opt/libomp/lib"
export CPPFLAGS="-I/usr/local/opt/libomp/include"
echo "LDFLAGS: $LDFLAGS"
echo "CPPFLAGS: $CPPFLAGS"
ls -l /usr/local/opt/libomp/include
ls -l /usr/local/opt/libomp/lib
echo "LDFLAGS=-L/usr/local/opt/libomp/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
echo "OpenMP_ROOT=/usr/local/opt/libomp" >> $GITHUB_ENV
fi
export PATH=/usr/local/var/homebrew/linked/ccache/libexec:$PATH
export PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH
export PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/lib/pkgconfig:$CONDA_PREFIX/lib/cmake:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
echo "DEVELOPER_BUILD is ${{ env.DEVELOPER_BUILD }}"
ccache -s
source util/ci_utils.sh
build_mac_wheel with_conda build_realsense
ccache -s
PIP_PKG_NAME="$(basename build/lib/python_package/pip_package/cloudViewer*.whl)"
echo "PIP_PKG_NAME=$PIP_PKG_NAME" >> $GITHUB_ENV
- name: Upload Wheel to GitHub artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PIP_PKG_NAME }}
path: build/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }}
if-no-files-found: error
- name: Update devel release
if: ${{ github.ref == 'refs/heads/main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload main-devel build/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }} --clobber
gh release view main-devel
- name: Public Wheel Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: false
generate_release_notes: false
prerelease: false
# body_path: ${{github.workspace}}/CHANGELOG.md
files: |
build/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }}
fuse-wheel:
name: Fuse universal2 wheel
permissions:
contents: write # upload
actions: write # release
runs-on: [macos-13]
needs: [build-wheel]
strategy:
fail-fast: false
# https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6
matrix:
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
is_main:
- ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
exclude:
- is_main: false
python_version: '3.8'
- is_main: false
python_version: '3.9'
- is_main: false
python_version: '3.10'
- is_main: false
python_version: '3.11'
steps:
- name: Checkout source code # for gh release upload
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Download X64 wheels
uses: actions/download-artifact@v4
with:
pattern: cloudViewer-*macosx*_x86_64.whl
path: x64_wheels
merge-multiple: true
- name: Download ARM64 wheels
uses: actions/download-artifact@v4
with:
pattern: cloudViewer-*macosx*_arm64.whl
path: arm64_wheels
merge-multiple: true
- name: Fuse x64 and ARM64 wheels
env:
python_version: ${{ matrix.python_version }}
run: |
PYTAG="-cp$(echo ${{ env.python_version }} | tr -d '.')"
mkdir universal_wheels
pip install delocate
delocate-merge -v -w universal_wheels x64_wheels/cloudViewer-*${PYTAG}*.whl arm64_wheels/cloudViewer-*${PYTAG}*.whl
NEW_WHL_NAME=$(basename universal_wheels/cloudViewer-*${PYTAG}*.whl)
echo "PIP_PKG_NAME=$NEW_WHL_NAME" >> $GITHUB_ENV
- name: Upload merged wheels to GitHub artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PIP_PKG_NAME }}
path: universal_wheels/${{ env.PIP_PKG_NAME }}
if-no-files-found: error
- name: Update devel release
if: ${{ github.ref == 'refs/heads/main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload main-devel universal_wheels/${{ env.PIP_PKG_NAME }} --clobber
gh release view main-devel
- name: Public merged wheels Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: false
generate_release_notes: false
prerelease: false
files: |
universal_wheels/${{ env.PIP_PKG_NAME }}
test-wheel:
name: Test wheel
permissions:
contents: read
runs-on: ${{ matrix.os }}
needs: [build-wheel]
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
is_main:
- ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
exclude:
- os: macos-14
python_version: '3.8'
- os: macos-14
python_version: '3.9'
- is_main: false
python_version: '3.8'
- is_main: false
python_version: '3.9'
- is_main: false
python_version: '3.10'
- is_main: false
python_version: '3.11'
env:
BUILD_CUDA_MODULE: OFF
BUILD_TORCH_OPS: ON
# TensorFlow v2.16 does not support Python 3.8
BUILD_TENSORFLOW_OPS: OFF
CLOUDVIEWER_ML_ROOT: ${{ github.workspace }}/CloudViewer-ML
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Checkout CloudViewer-ML source code
uses: actions/checkout@v4
with:
repository: Asher-1/CloudViewer-ML
ref: main
path: ${{ env.CLOUDVIEWER_ML_ROOT }}
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: cloudViewer-*macosx*.whl
merge-multiple: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Test Python package
run: |
python -V
source util/ci_utils.sh
pi_tag=$(python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
test_wheel cloudViewer*-"$pi_tag"-*_$(uname -m).whl
# - name: Run Python unit tests
# run: |
# source util/ci_utils.sh
# echo "Running CloudViewer python tests..."
# run_python_tests