-
Notifications
You must be signed in to change notification settings - Fork 11
232 lines (197 loc) · 8.35 KB
/
python.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
name: Python Build
on:
push:
branches:
- main
tags:
- v*
- py_v*
pull_request:
branches:
- main
workflow_dispatch:
jobs:
Linux:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64:latest
steps:
- uses: actions/checkout@v3
- name: install gfortran-7
run: |
yum install -y devtoolset-7-toolchain
echo "FFLAGS += -march=x86-64" >> make.inc
echo "CFLAGS += -march=x86-64" >> make.inc
echo "CXXFLAGS += -march=x86-64" >> make.inc
- name: Compile python bindings
run: |
scl enable devtoolset-7 bash
.github/workflows/python_build_posix.sh /opt/python/cp36-cp36m/bin/python
.github/workflows/python_build_posix.sh /opt/python/cp37-cp37m/bin/python
.github/workflows/python_build_posix.sh /opt/python/cp38-cp38/bin/python
.github/workflows/python_build_posix.sh /opt/python/cp39-cp39/bin/python
.github/workflows/python_build_posix.sh /opt/python/cp310-cp310/bin/python
.github/workflows/python_build_posix.sh /opt/python/cp311-cp311/bin/python
ls python/dist/*.whl | xargs -n1 auditwheel repair
- name: Test python bindings
run: |
.github/workflows/python_test_posix.sh /opt/python/cp36-cp36m/bin/python
.github/workflows/python_test_posix.sh /opt/python/cp37-cp37m/bin/python
.github/workflows/python_test_posix.sh /opt/python/cp38-cp38/bin/python
.github/workflows/python_test_posix.sh /opt/python/cp39-cp39/bin/python
.github/workflows/python_test_posix.sh /opt/python/cp310-cp310/bin/python
.github/workflows/python_test_posix.sh /opt/python/cp311-cp311/bin/python
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: linux-wheels
path: wheelhouse/*.whl
MacOS:
runs-on: macos-11
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
steps:
- uses: actions/checkout@v3
- name: Install gcc-10
run: |
brew install gcc@10
ln -s `which gfortran-10` /usr/local/bin/gfortran
cp make.inc.macos.gnu make.inc
echo "FC=gfortran-10" >> make.inc
echo "CC=gcc-10" >> make.inc
echo "CXX=g++-10" >> make.inc
echo "FFLAGS += -march=x86-64" >> make.inc
echo "CFLAGS += -march=x86-64" >> make.inc
echo "CXXFLAGS += -march=x86-64" >> make.inc
# link statically to libgcc, libgfortran and libquadmath
# otherwise binaries are incompatible with older systems
echo "LIBS += -static-libgfortran -static-libgcc -static-libstdc++" >> make.inc
# hack to make libquadmath link statically
sudo rm /usr/local/opt/gcc@10/lib/gcc/10/libquadmath.*dylib
# Download and install Python instead of using the setup_python
# as the python interpreters in the Github machines
# were compiled in 10.14, the wheels built with them
# are incompatible with older MacOS versions
- name: Download and install Python
run: |
curl \
https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
curl \
https://www.python.org/ftp/python/3.7.7/python-3.7.7-macosx10.9.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
curl \
https://www.python.org/ftp/python/3.8.3/python-3.8.3-macosx10.9.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
curl \
https://www.python.org/ftp/python/3.9.9/python-3.9.9-macosx10.9.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
curl \
https://www.python.org/ftp/python/3.10.9/python-3.10.9-macos11.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
curl \
https://www.python.org/ftp/python/3.11.1/python-3.11.1-macos11.pkg \
--output python_installer.pkg
sudo installer -pkg python_installer.pkg -target /
- name: Compile python bindings
run: |
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
.github/workflows/python_build_posix.sh /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
PYTHON_BIN=/Library/Frameworks/Python.framework/Versions/3.7/bin/
$PYTHON_BIN/python3 -m pip install delocate
ls python/dist/*.whl | xargs -n1 $PYTHON_BIN/delocate-wheel -w wheelhouse/
- name: Test python bindings
run: |
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
.github/workflows/python_test_posix.sh /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: macos-wheels
path: wheelhouse/*.whl
Windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install GCC and make
run: C:\msys64\usr\bin\bash.exe -lc "pacman -Sy --noconfirm make mingw-w64-x86_64-toolchain mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-gcc-libgfortran mingw-w64-x86_64-gcc-libs mingw-w64-x86_64-gcc-lto-dump mingw-w64-x86_64-gcc-objc"
- name: Build and Test Python 3.6
uses: actions/setup-python@v3
with:
python-version: '3.6'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Build and Test Python 3.7
uses: actions/setup-python@v3
with:
python-version: '3.7'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Build and Test Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.8'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Build and Test Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Build and Test Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Build and Test Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
architecture: 'x64'
- run: |
.\.github\workflows\python_build_win.ps1
.\.github\workflows\python_test_win.ps1
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: windows-wheels
path: wheelhouse\*.whl
PyPI:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
needs: [Linux, MacOS, Windows]
steps:
- name: Setup Python
uses: actions/setup-python@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Upload to PyPI
run: |
python -m pip install twine
python -m twine upload ./**/*.whl -u __token__ -p "$PASSWORD"
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}