-
Notifications
You must be signed in to change notification settings - Fork 110
226 lines (208 loc) · 7.47 KB
/
CI-mac-arm64.yml
File metadata and controls
226 lines (208 loc) · 7.47 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
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
name: CI macOS 14 arm64
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
workflow_dispatch:
env:
BUILD_TYPE: Release
MACOSX_DEPLOYMENT_TARGET: 11.0
jobs:
build:
runs-on: macos-14
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
brew reinstall zlib
brew install openslide pcre libomp
# Install a specific version of libomp (14.0.6) since newer versions fail with cmake
#curl https://raw.githubusercontent.com/Homebrew/homebrew-core/c87d6a0c8360c4684e3375ce6c4576214acdd71b/Formula/libomp.rb > $(find $(brew --repository) -name libomp.rb) && brew reinstall libomp
- name: Setup pyenv
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
MACOSX_DEPLOYMENT_TARGET: 11.0
PYTHON_CONFIGURE_OPTS: "--enable-framework"
CFLAGS: "-Wno-implicit-function-declaration"
LDFLAGS: "-L/usr/local/opt/zlib/lib"
CPPFLAGS: "-I/usr/local/opt/zlib/include"
PKG_CONFIG_PATH: "/usr/local/opt/zlib/lib/pkgconfig"
uses: "gabrielfalcao/pyenv-action@v18"
with:
default: 3.8.18
- name: Install pip dependencies
run: |
pip3 install --upgrade pip
pip3 install twine wheel==0.37.1
- name: Debug
run: |
echo "$(dirname $(pyenv which python))"
echo $(ls "$(dirname $(pyenv which python))/../include/")
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}\
-DCMAKE_OSX_ARCHITECTURES:STRING="arm64" \
-DFAST_MODULE_OpenVINO=OFF \
-DFAST_MODULE_Dicom=ON \
-DFAST_MODULE_WholeSlideImaging=ON \
-DFAST_MODULE_OpenIGTLink=ON \
-DFAST_MODULE_Clarius=OFF \
-DFAST_MODULE_TensorFlow=OFF \
-DFAST_MODULE_HDF5=ON \
-DFAST_MODULE_Plotting=ON \
-DFAST_MODULE_Python=ON \
-DFAST_Python_Version="3.8" \
-DFAST_Python_Include="$(dirname $(pyenv which python))/../include/python3.8/" \
-DFAST_Python_Library="$(dirname $(pyenv which python))/../lib/libpython3.8.dylib" \
-DFAST_MODULE_RealSense=OFF \
-DFAST_BUILD_EXAMPLES=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
- name: Build Python wheel
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target python-wheel -j 4
- name: Package
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package -j 4
- name: Upload archive package
uses: actions/upload-artifact@v4
with:
name: Archive package (tar.xz)
path: ${{github.workspace}}/build/fast_*.tar.xz
if-no-files-found: error
- name: Upload Python wheel
uses: actions/upload-artifact@v4
with:
name: Python wheel
path: ${{github.workspace}}/build/python/dist/pyfast-*.whl
if-no-files-found: error
- name: Upload archive package to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/fast_*.tar.xz
file_glob: true
tag: ${{ github.ref }}
overwrite: true
- name: Upload Python wheel to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/python/dist/pyfast-*.whl
file_glob: true
tag: ${{ github.ref }}
overwrite: true
- name: Upload Python wheel to PyPi
if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }}
run: |
twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} ${{github.workspace}}/build/python/dist/pyfast-*.whl
test-python-wheel:
name: Test Python Wheel
needs: [build]
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.10', '3.12']
runs-on: macos-14
steps:
- name: Install dependencies
run: |
brew reinstall zlib
brew install openslide pcre libomp
# OpenCL on apple silicon only supports GPU which
# the GitHub nodes don't have, thus we install pocl
# which supports CPUs
brew install pocl
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
name: 'Python wheel'
path: ${{github.workspace}}/download/
- name: Create virtual environment and install wheel
run: |
cd ${{github.workspace}}
python -m venv venv # Get error if not using virtual environment for some reason
source venv/bin/activate
python -m pip install --prefer-binary ${{github.workspace}}/download/pyfast-*.whl
- name: Import FAST with Python
run: |
cd ${{github.workspace}}
source venv/bin/activate
# This will fail because there are no OpenCL plaforms available, thus we add || true
python -c "import fast" || true
# test-cpp:
# name: Run C++ Tests
# needs: [build]
# runs-on: [self-hosted, macos]
# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: 'Archive package (tar.xz)'
# path: ${{github.workspace}}/download/
# - name: Extract artifact
# run: |
# mkdir -p ${{github.workspace}}/download/
# cd ${{github.workspace}}/download/
# tar -xf fast_*.tar.xz -C ${{github.workspace}}
# - name: Download test data
# run: |
# cd ${{github.workspace}}
# cd fast*
# cd fast/bin/
# ./downloadTestData
# - name: Run tests
# run: |
# cd ${{github.workspace}}
# cd fast_*
# cd fast/bin/
# ./testFAST ~[visual]~[unstablemac]
# - name: Cleanup
# if: always()
# run: |
# rm -Rf ${{github.workspace}}
# rm -Rf $HOME/FAST/kernel_binaries/*
#
# test-python:
# name: Run Python Tests
# needs: [build]
# runs-on: [self-hosted, macos]
# steps:
# - uses: actions/checkout@v2
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: 'Python wheel'
# path: ${{github.workspace}}/download/
# - name: Create environment and install python packages
# run: |
# cd ${{github.workspace}}
# mkdir tmp
# cd tmp
# virtualenv -p python3 venv
# source venv/bin/activate
# pip3 install pytest
# pip3 install ${{github.workspace}}/download/pyfast-*.whl
# - name: Run tests
# run: |
# cd ${{github.workspace}}/tmp/
# source venv/bin/activate
# pytest ../source/FAST/
# - name: Cleanup
# if: always()
# run: |
# rm -Rf ${{github.workspace}}/download/
# rm -Rf ${{github.workspace}}/tmp/
# rm -Rf $HOME/FAST/kernel_binaries/*