-
-
Notifications
You must be signed in to change notification settings - Fork 182
224 lines (187 loc) · 6.41 KB
/
build_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
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
name: Build and upload to PyPI
on: [push, pull_request]
jobs:
wheels_linux:
name: 🏗 ${{ matrix.os }} - ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: "*-${{ matrix.platform }}"
strategy:
matrix:
os: [ubuntu-20.04]
platform: [manylinux_x86_64, manylinux_i686] # manylinux_aarch64 (too expensive)
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0" # 0=all, needed for setuptools-scm to resolve version tags
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"
- name: Set up QEMU
if: matrix.platform == 'manylinux_aarch64'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
uses: joerick/cibuildwheel@v2.1.1
if: matrix.platform != 'manylinux_aarch64'
- name: Build wheels (emulated)
uses: joerick/cibuildwheel@v2.1.1
if: matrix.platform == 'manylinux_aarch64'
env:
CIBW_ARCHS_LINUX: aarch64
- name: Upload built wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse/*.whl
if-no-files-found: error
- name: Upload wheel for ReadTheDocs
uses: actions/upload-artifact@v2
if: matrix.platform == 'manylinux_x86_64'
with:
name: rtd-wheel
path: ./wheelhouse/pikepdf-*-cp37-*.manylinux2010_x86_64.whl
if-no-files-found: error
wheels_macos:
name: 🏗 ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"
- name: Build wheels
uses: joerick/cibuildwheel@v2.1.1
#env:
# CIBW_ARCHS_MACOS: x86_64 universal2 # for Apple Silicon
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse/*.whl
wheels_windows:
name: 🏗 ${{ matrix.os }} - ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: "*-${{ matrix.platform }}"
CIBW_ENVIRONMENT: >-
INCLUDE="$INCLUDE;d:\\qpdf\\include"
LIB="$LIB;d:\\qpdf\\lib"
LIBPATH="$LIBPATH;d:\\qpdf\\lib"
strategy:
matrix:
os: [windows-2019]
platform: [win_amd64, win32]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"
- name: Install toml and read environment from pyproject.toml
run: |
python -m pip install toml
python build-scripts/environ-from-pyproject.py >> $env:GITHUB_ENV
dir env:
- name: Download QPDF
run: |
build-scripts/win-download-qpdf.ps1 $env:QPDF_VERSION ${{ matrix.platform }}
- name: Build wheels
uses: joerick/cibuildwheel@v2.1.1
- uses: actions/upload-artifact@v2
with:
name: wheels
path: ./wheelhouse/*.whl
sdist:
name: 🏗 source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.8"
- name: Install apt packages
run: sudo apt-get install -y jbig2dec lcov
- name: Install toml and read environment from pyproject.toml
run: |
python -m pip install toml
python build-scripts/environ-from-pyproject.py >> $GITHUB_ENV
- name: Add /usr/local/lib to dynamic linker path
run: echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/local-lib.conf
- name: Download QPDF
run: build-scripts/linux-download-qpdf.bash $QPDF_MIN_VERSION
- name: Build QPDF
run: build-scripts/linux-build-sdist-deps.bash
- name: Build sdist
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python setup.py sdist
- name: Install and test sdist
run: |
python -m venv v
source v/bin/activate
SDIST=dist/*.tar.gz
SDIST_EXPANDED=$(echo -n $SDIST)
python -m pip install ${SDIST_EXPANDED}[test] # yes this works
python -m pytest -nauto
deactivate
- name: Install natively
run: |
env CFLAGS="--coverage" CXXFLAGS="--coverage" python -m pip install -e .[test]
python -m pytest -nauto --cov-report xml --cov=src
- name: Generate C++ coverage reports
run: |
lcov --no-external --capture --directory . --output-file cpp_coverage_all.info
lcov --remove cpp_coverage_all.info '*/pybind11/*' -o cpp_coverage.info
rm cpp_coverage_all.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml,./cpp_coverage.info
- uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*.tar.gz
trigger_rtd:
name: Trigger ReadTheDocs
runs-on: ubuntu-latest
needs: [wheels_linux, wheels_macos, wheels_windows, sdist]
if: startsWith(github.ref, 'refs/heads/') && !startsWith(github.ref, 'refs/heads/actions')
steps:
- name: Get branch name
id: get_branch
run: |
echo "::set-output name=branch::${GITHUB_REF##refs/heads/}"
- name: Trigger ReadTheDocs webhook
run: |
curl -X POST -d "branches=${{ steps.get_branch.outputs.branch }}" \
-d "token=${{ secrets.TOKEN_RTD }}" \
https://readthedocs.org/api/v2/webhook/pikepdf/163029/
upload_pypi:
needs: [wheels_linux, wheels_macos, wheels_windows, sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TOKEN_PYPI }}
# repository_url: https://test.pypi.org/legacy/