-
Notifications
You must be signed in to change notification settings - Fork 8
240 lines (196 loc) · 6.72 KB
/
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Build wheels
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Build mrob project
runs-on: ubuntu-latest
env:
PYTHONPATH: ./lib
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install required packages from distro
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends git build-essential g++ cmake python3-distutils python3-dev python3-numpy python3-pip
python3 -m pip install pytest
- name: Configure and build native mrob library with Python bindings
run: |
mkdir -p build
cmake -S $PWD -B $PWD/build \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$PWD/bin \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$PWD/lib \
&& cmake --build build -j $(nproc)
- name: C++ unit tests
run: make test -C build
- name: Python unit tests
run: python3 -m pytest mrobpy
build_wheel_linux:
name: Build wheel on GNU/Linux
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2010_x86_64
needs: build
strategy:
fail-fast: false
steps:
- name: Install additional utils
run: yum install -y git openssh-clients
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install fresh CMake into ManyLinux container
run: |
env pybin=$(LANG=C ls -d1r /opt/python/cp3*/bin | head -n 1) bash -c '$pybin/python -m pip install cmake && mkdir -p /usr/local/bin && ln -svf $pybin/cmake /usr/local/bin/cmake'
cmake --version
- name: Build Python wheel
run: scripts/build-wheel-linux.sh
- uses: actions/upload-artifact@v1
with:
name: artifact
path: ./wheelhouse
build_wheel_macOS:
name: Build wheel on macOS
runs-on: macos-10.15
needs: build
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Git fetch
run: git fetch --prune --unshallow --recurse-submodules=no
- name: Install packages
run: brew install coreutils
- name: Build wheel
run: ./scripts/build-wheel-macOS.sh
- uses: actions/upload-artifact@v2
with:
path: ./dist
build_wheel_windows:
name: Build wheel on Windows ${{ matrix.arch }}
needs: build
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Git fetch
run: git fetch --prune --unshallow --recurse-submodules=no
- name: Setup Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
architecture: ${{ matrix.arch }}
- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
architecture: ${{ matrix.arch }}
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: ${{ matrix.arch }}
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: ${{ matrix.arch }}
- name: Setup Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: ${{ matrix.arch }}
- name: Build wheel
run: .\scripts\build-wheels-windows.cmd ${{ matrix.arch }}
- uses: actions/upload-artifact@v2
with:
path: .\dist
test_wheel:
name: Test Python ${{ matrix.python }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [build_wheel_linux, build_wheel_macOS, build_wheel_windows]
if: ${{ always() && contains(needs.*.result, 'success') }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest, windows-2019]
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python }}
if: ${{ matrix.os != 'windows-2019' }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Setup Python ${{ matrix.python }}
if: ${{ matrix.os == 'windows-2019' }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: x86
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Install mrob & numpy on Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python -m pip install ./artifact/mrob-*-manylinux*.whl numpy pytest
- name: Install mrob & numpy on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
python -m pip install ./artifact/mrob-*-macosx_10_9_x86_64.whl numpy pytest
- name: Install mrob & numpy on Windows 64bit
if: ${{ matrix.os == 'windows-latest' }}
run: |
python -m pip install .\artifact\$(dir artifact -Name | findstr mrob-.*-win_amd64.whl) numpy pytest
- name: Install mrob & numpy on Windows 32bit
if: ${{ matrix.os == 'windows-2019' }}
run: |
python -m pip install .\artifact\$(dir artifact -Name | findstr mrob-.*-win32.whl) numpy
- name: Python unit tests
if: ${{ matrix.os != 'windows-2019' }}
run: |
python -m pytest mrobpy
- name: Python unit tests
if: ${{ matrix.os == 'windows-2019' }}
run: |
$files = Get-ChildItem -Path python_examples -Include *.py
foreach ($f in $files){
python $f.FullName || EXIT /B !ERRORLEVEL!
}
publish_pypi:
name: Publish macOS wheel to PyPI
needs: test_wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: artifact/
publish-github-release:
name: Publish macOS wheel to GitHub Releases
needs: test_wheel
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- uses: softprops/action-gh-release@v1
with:
files: artifact/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}