-
Notifications
You must be signed in to change notification settings - Fork 24
198 lines (164 loc) · 6.32 KB
/
publish-sdist-wheels.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
name: Publish sdist and wheels for macos, manylinux, and windows, publish to pypi if a release
on: [pull_request, push]
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: 'cp*'
CIBW_SKIP: 'cp35-* cp36-* cp37-* *-manylinux_i686 *-musllinux_* *-win32 cp311-macosx_x86_64'
CIBW_BEFORE_TEST: pip install -r {project}/tests/requirement_tests.txt
CIBW_TEST_COMMAND: pytest -s -v {project}/tests
WINDOWS_HDF5: 1.14.2
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2022]
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.7'
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Build wheels on Linux
if: runner.os == 'Linux'
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL: |
AEC_VERSION="1.0.4"
HDF5_VERSION="1.12.1"
yum update -y
yum -y install zlib-devel
pushd /tmp
echo "Downloading & unpacking aec ${AEC_VERSION}"
curl -fsSLO https://gitlab.dkrz.de/k202009/libaec/uploads/ea0b7d197a950b0c110da8dfdecbb71f/libaec-${AEC_VERSION}.tar.gz
tar zxf libaec-$AEC_VERSION.tar.gz
echo "Building & installing libaec"
pushd libaec-$AEC_VERSION
./configure
make -j 2
make install
ldconfig
popd
echo "Downloading & unpacking HDF5 ${HDF5_VERSION}"
curl -fsSLO "https://www.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz"
tar -xzvf hdf5-$HDF5_VERSION.tar.gz
echo "Building & installing HDF5"
pushd hdf5-$HDF5_VERSION
./configure \
--prefix=/usr \
--enable-build-mode=production \
--with-szlib \
--enable-tools=no \
--enable-tests=no
make -j 2
make install
ldconfig
popd
run: |
python -m cibuildwheel --output-dir dist
- name: Build wheels Mac OS
if: runner.os == 'macOS'
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
CIBW_BEFORE_BUILD: |
#brew update
#brew --version
export HOMEBREW_NO_AUTO_UPDATE=1
export HDF5_DIR="$(brew --prefix hdf5)";
brew install hdf5
run: |
python -m cibuildwheel --output-dir dist
- name: Cache HDF5 On Windows
if: runner.os == 'Windows'
id: cache-hdf5-windows
uses: actions/cache@v3
env:
cache-name: cache-hdf5-windows
with:
path: C:\cache\hdf5\${{ env.WINDOWS_HDF5 }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.WINDOWS_HDF5 }}
- name: Fill Windows Cache
if: runner.os == 'Windows' && steps.cache-hdf5-windows.outputs.cache-hit != 'true'
continue-on-error: false
shell: cmd
run: |
mkdir C:\cache\hdf5\${{ env.WINDOWS_HDF5 }}
curl -L -o C:\cache\hdf5\${{ env.WINDOWS_HDF5 }}\hdf5.zip https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.2/bin/windows/hdf5-1.14.2-Std-win10_64-vs16.zip
- name: Build wheels Windows
if: runner.os == 'Windows'
shell: cmd
# the v140 toolchain is used, so that fewer vc_redist installs are required
# some of the information is available here:
# https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
# but tracking down the 14.0 magic number (and especially newer ones isn't always easy)
# this has a partial table:
# https://devblogs.microsoft.com/cppblog/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/
run: |
C:\windows\system32\tar.exe xf C:\cache\hdf5\${{ env.WINDOWS_HDF5 }}\hdf5.zip
start /wait msiexec /a "%cd%\hdf\HDF5-${{ env.WINDOWS_HDF5 }}-win64.msi" /qn TARGETDIR="c:\hdf5\"
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.1
set HDF5_DIR=C:\hdf5\HDF_Group\HDF5\${{ env.WINDOWS_HDF5 }}\cmake
python -m cibuildwheel --output-dir dist
- name: Store wheel as artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
build_sdist:
name: Build sdist
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run:
- name: Install Dependencies
run:
python -m pip install build
- name: Build a source tarball
run:
python -m build --sdist
- name: Test tarball
run: |
sudo apt install -y libhdf5-dev
pip install -r tests/requirement_tests.txt
pip install dist/*
pytest -s -v tests
- name: Store sdist as artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz
upload_artifacts:
name: Upload wheels to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- name: Download artifacts produced during the build_wheels and build_sdist jobs
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Display structure of downloaded files
run: ls -R
working-directory: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: dist/