forked from Tulip-Dev/tulip
-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (174 loc) · 7.63 KB
/
macos-macports-wheels-build.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
name: macos-macports-wheels-build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
macos:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: Talipot wheels build on macOS x86_64
os: macos-13
macosx_deployment_target: "12.0"
- name: Talipot wheels build on macOS arm64
os: macos-14
macosx_deployment_target: "14.0"
env:
CLANG_VERSION: 16
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.macosx_deployment_target }}
TWINE_REPOSITORY: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
steps:
- name: Checkout Talipot code
uses: actions/checkout@v4
- name: Get wheel next dev version
run: |
JSON=$(curl -s 'https://test.pypi.org/pypi/talipot/json')
LAST_VERSION=$(echo $JSON | python -c "
import sys, json
print(json.load(sys.stdin)['info']['version'])" 2>/dev/null)
if [ $? -ne 0 ]
then
DEV_VERSION=1
else
echo last wheel dev version = $LAST_VERSION
# check if dev wheel version needs to be incremented
VERSION_INCREMENT=$(echo $JSON | python -c "
import sys, json, platform
releases = json.load(sys.stdin)['releases']['$LAST_VERSION']
machine = platform.uname().machine
print(any(['macosx' in r['filename'] and machine in r['filename'] for r in releases]))")
DEV_VERSION=$(echo $LAST_VERSION | cut -f4 -d '.' | sed 's/dev//')
if [ "$VERSION_INCREMENT" == "True" ]
then
let DEV_VERSION+=1
fi
fi
echo current wheel dev version = $DEV_VERSION
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_ENV
- name: Prepare ccache timestamp
id: get-current-date
run: |
echo "date=$(date -u "+%Y-%m-%d-%H-%m-%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache files
uses: actions/cache@v4
with:
path: |
/Users/runner/Library/Caches/ccache
/Users/runner/.macports-ci-ccache
key: macos-wheels-ccache-${{ steps.get-current-date.outputs.date }}
restore-keys: |
${{ matrix.config.os }}-ccache-
save-always: true
- name: Install MacPorts
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
source ./macports-ci install
- name: Install Talipot build dependencies
run: sudo port -N install
cmake
clang-${{ env.CLANG_VERSION }}
bison
zlib
zstd
libomp
qhull
yajl
libgit2
graphviz
- name: Install Python versions to build wheels against
run: |
os_ver=$(sw_vers -productVersion | cut -c1-2)
if [[ $os_ver -lt 13 ]]; then
curl -LO https://www.python.org/ftp/python/3.9.0/python-3.9.0-macosx10.9.pkg
sudo installer -pkg python-3.9.0-macosx10.9.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.9/bin/pip3 install wheel
fi
curl -LO https://www.python.org/ftp/python/3.10.10/python-3.10.10-macos11.pkg
sudo installer -pkg python-3.10.10-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.10/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.11.0/python-3.11.0-macos11.pkg
sudo installer -pkg python-3.11.0-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.11/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.12.7/python-3.12.7-macos11.pkg
sudo installer -pkg python-3.12.7-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.12/bin/pip3 install wheel
curl -LO https://www.python.org/ftp/python/3.13.0/python-3.13.0-macos11.pkg
sudo installer -pkg python-3.13.0-macos11.pkg -target /
sudo /Library/Frameworks/Python.framework/Versions/3.13/bin/pip3 install wheel twine
- name: Create build directory
run: mkdir build
- name: Build Talipot Python wheels
working-directory: ./build
run: |
os_ver=$(sw_vers -productVersion | cut -c1-2)
if [[ $os_ver -lt 13 ]]; then
py3Versions="3.9 3.10 3.11 3.12 3.13"
else
py3Versions="3.10 3.11 3.12 3.13"
fi
for py3Version in $py3Versions
do
rm -f CMakeCache.txt || true
sudo /Library/Frameworks/Python.framework/Versions/$py3Version/bin/pip3 install sip
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PWD/install \
-DCMAKE_C_COMPILER=/opt/local/bin/clang-mp-${{ env.CLANG_VERSION }} \
-DCMAKE_CXX_COMPILER=/opt/local/bin/clang++-mp-${{ env.CLANG_VERSION }} \
-DTALIPOT_ACTIVATE_PYTHON_WHEEL_TARGET=ON \
-DTALIPOT_PYTHON_TEST_WHEEL_SUFFIX=a3.dev${{ env.DEV_VERSION }}\
-DPython3_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/$py3Version/bin/python3 \
-DTALIPOT_USE_CCACHE=ON \
-DTALIPOT_BUILD_CORE_ONLY=ON \
-DTALIPOT_BUILD_DOC=OFF
make -j4 test-wheel
done
- name: Upload Talipot Python wheels on test PyPI
if: github.ref == 'refs/tags/dev-latest'
working-directory: ./build
run: make test-wheel-upload
- name: Test uploaded wheels in clean environment
if: github.ref == 'refs/tags/dev-latest'
run: |
os_ver=$(sw_vers -productVersion | cut -c1-2)
sudo port -N -f uninstall \
cmake \
clang-${CLANG_VERSION} \
qhull \
yajl \
libgit2 \
graphviz
sudo port -N install \
python39 \
py39-pip \
python310 \
py310-pip \
python311 \
py311-pip \
python312 \
py312-pip \
python313 \
py313-pip
if [[ $os_ver -lt 13 ]]; then
sudo pip-3.9 install --index-url https://test.pypi.org/simple/ talipot
python3.9 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.9 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
fi
sudo pip-3.10 install --index-url https://test.pypi.org/simple/ talipot
python3.10 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.10 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.11 install --index-url https://test.pypi.org/simple/ talipot
python3.11 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.11 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.12 install --index-url https://test.pypi.org/simple/ talipot
python3.12 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.12 -c "from talipot import tlp; print(tlp.getImportPluginsList())"
sudo pip-3.13 install --index-url https://test.pypi.org/simple/ talipot
python3.13 -c "from talipot import tlp; print(tlp.getLayoutAlgorithmPluginsList())"
python3.13 -c "from talipot import tlp; print(tlp.getImportPluginsList())"