-
Notifications
You must be signed in to change notification settings - Fork 8
243 lines (226 loc) · 8.33 KB
/
build-pye3d.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
233
234
235
236
237
238
239
240
241
242
243
# This is a basic workflow that is manually triggered
name: Build pye3d
on:
pull_request:
push:
tags:
- "**"
schedule:
# run every 6 days to keep cache alive
- cron: "30 7 */6 * *"
workflow_dispatch:
inputs:
should_invalidate_cache_download:
description: "Fill to invalidate download cache"
default: ""
required: false
should_invalidate_cache_build:
description: "Fill to invalidate build cache"
default: ""
required: false
env:
eigen-download-url: "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip"
eigen-install-dir: ${{ github.workspace }}/eigen-build
eigen-install-dir-manylinux: /pye3d-deps/eigen
pye3d-test-input-download-url: "https://github.com/pupil-labs/pye3d-detector/wiki/files/pye3d_test_input.npz"
jobs:
build_eigen_manylinux:
name: Build Eigen on manylinux
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
container:
image: quay.io/pypa/manylinux2014_x86_64
env:
eigen-install-dir-manylinux: /pye3d-deps/eigen
steps:
- name: Cache Eigen source code download
id: eigen-source-cache
uses: actions/[email protected]
with:
path: eigen.zip
key: eigen-source-cache-${{ env.eigen-download-url }}
- name: Download on manylinux
if: (github.event.inputs.should_invalidate_cache_download || steps.eigen-source-cache.outputs.cache-hit != 'true')
run: curl -L ${{ env.eigen-download-url }} --output eigen.zip --silent
- name: Cache eigen build
id: eigen-build-cache
uses: actions/[email protected]
with:
path: ${{ env.eigen-install-dir-manylinux }}
key: eigen-build-cache-${{ matrix.os }}-${{ env.eigen-download-url }}
- name: Prepare build
shell: bash
run: |
set -xe
unzip -q eigen.zip
mv eigen-3.* eigen/
mkdir eigen/build
- name: Configure build
if: github.event.inputs.should_invalidate_cache_build || steps.eigen-build-cache.outputs.cache-hit != 'true'
working-directory: eigen/build
shell: bash
run: cmake .. -DCMAKE_INSTALL_PREFIX="${{ env.eigen-install-dir-manylinux }}"
- name: Compile on manylinux
if: (github.event.inputs.should_invalidate_cache_build || steps.eigen-build-cache.outputs.cache-hit != 'true')
working-directory: eigen/build
run: |
make
make install
- name: Upload build as artifact
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.os }}
path: ${{ env.eigen-install-dir-manylinux }}
build_eigen_macos_windows:
name: Build Eigen on ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
continue-on-error: false
steps:
- name: Cache Eigen source code download
id: eigen-source-cache
uses: actions/[email protected]
with:
path: eigen.zip
key: eigen-source-cache-${{ env.eigen-download-url }}
- name: Download on Unix
if: (github.event.inputs.should_invalidate_cache_download || steps.eigen-source-cache.outputs.cache-hit != 'true') && !contains(runner.os, 'windows')
run: wget -q -O eigen.zip ${{ env.eigen-download-url }}
- name: Download on Windows
if: (github.event.inputs.should_invalidate_cache_download || steps.eigen-source-cache.outputs.cache-hit != 'true') && contains(runner.os, 'windows')
run: Invoke-WebRequest ${{ env.eigen-download-url }} -OutFile eigen.zip
- name: Cache eigen build
id: eigen-build-cache
uses: actions/[email protected]
with:
path: ${{ env.eigen-install-dir }}
key: eigen-build-cache-${{ matrix.os }}-${{ env.eigen-download-url }}
- name: Prepare build
shell: bash
run: |
set -xe
unzip -q eigen.zip
mv eigen-3.* eigen/
mkdir eigen/build
- name: Configure build
if: github.event.inputs.should_invalidate_cache_build || steps.eigen-build-cache.outputs.cache-hit != 'true'
working-directory: eigen/build
shell: bash
run: cmake .. -DCMAKE_INSTALL_PREFIX="${{ env.eigen-install-dir }}"
- name: Compile on Windows
if: runner.os == 'Windows' && (github.event.inputs.should_invalidate_cache_build || steps.eigen-build-cache.outputs.cache-hit != 'true')
working-directory: eigen/build
run: cmake --build . --target INSTALL --config Release --parallel
- name: Compile on macOS
if: runner.os != 'Windows' && (github.event.inputs.should_invalidate_cache_build || steps.eigen-build-cache.outputs.cache-hit != 'true')
working-directory: eigen/build
run: |
make
make install
- name: Upload build as artifact
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.os }}
path: ${{ env.eigen-install-dir }}
build_wheels:
name: "Build pye3d wheels on ${{ matrix.os }}"
if: github.event_name != 'schedule'
needs:
- build_eigen_macos_windows
- build_eigen_manylinux
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
continue-on-error: true
runs-on: ${{ matrix.os }}
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v2
- name: Download build as artifact
uses: actions/download-artifact@v2
with:
name: build-${{ matrix.os }}
- name: Dump file list
shell: bash
run: ls -laR
- name: Build wheels
uses: pypa/[email protected]
env:
Eigen3_DIR: ${{ github.workspace }}
CIBW_ENVIRONMENT_LINUX: >
LD_LIBRARY_PATH=/project/lib64:$LD_LIBRARY_PATH
Eigen3_DIR=/project
CIBW_SKIP: "cp27-* cp35-* pp* *win32 *_aarch64 *_ppc64le *_s390x *_i686 *musllinux*"
CIBW_ARCHS_MACOS: "x86_64"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python scripts\repair_wheels_windows.py {wheel} {dest_dir}
CIBW_TEST_REQUIRES: pytest opencv-python==4.6.0.66 pandas scikit-image matplotlib
CIBW_TEST_COMMAND: >
curl -L ${{ env.pye3d-test-input-download-url }} --silent
--output {package}/tests/integration/input/pye3d_test_input.npz
&& pytest {package}/tests
CIBW_TEST_COMMAND_WINDOWS: >
curl -L ${{ env.pye3d-test-input-download-url }} --silent
--output {package}\tests\integration\input\pye3d_test_input.npz
&& pytest {package}\tests
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
- uses: actions/upload-artifact@v2
if: always()
with:
name: distribution
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Build source package
run: |
pip install build
python -m build --sdist .
- name: Upload source package
uses: actions/upload-artifact@v2
with:
name: distribution
path: dist/
build_docs:
name: Ensure documentation builds correctly
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Build docs via tox
run: |
pip install tox
tox -e docs
publish:
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist, build_docs]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: distribution
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}