-
Notifications
You must be signed in to change notification settings - Fork 1
258 lines (255 loc) · 14.4 KB
/
python.yaml
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#
# python.yaml
# Created by Perry Naseck on 6/20/21.
#
# Copyright (c) 2021, Wireless Sensing and Embedded Systems Lab, Carnegie
# Mellon University
# All rights reserved.
#
# This source code is licensed under the BSD-3-Clause license found in the
# LICENSE file in the root directory of this source tree.
#
name: Python
on: [push, pull_request]
jobs:
build-python-sdist:
name: Build Source Distribution
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: 3.9
- name: Install Python build tool
run: python -m pip install build
- name: Build sdist
run: python -m build --sdist --outdir dist/
- name: Display structure of dist files
run: ls -R
working-directory: dist
- name: SHA256 files
run: find . -type f -exec sha256sum {} \;
working-directory: dist
- uses: actions/upload-artifact@v2
with:
name: python-dist
path: dist/*.tar.gz
test-python-sdist:
name: 'Test Source Distribution (${{ matrix.python-version }}-${{ matrix.id }}: ${{ matrix.os }})'
needs: [build-python-sdist]
strategy:
fail-fast: false
matrix:
include:
- { id: linux-gcc, os: ubuntu-20.04, python-version: "3.9", compiler: gcc }
- { id: windows-gcc, os: windows-2019, python-version: "3.9", compiler: gcc }
- { id: windows-cl, os: windows-2019, python-version: "3.9", compiler: cl }
- { id: macos-gcc, os: macos-10.15, python-version: "3.9", compiler: gcc }
- { id: linux-gcc, os: ubuntu-20.04, python-version: "pypy-3.8", compiler: gcc }
- { id: windows-gcc, os: windows-2019, python-version: "pypy-3.8", compiler: gcc }
- { id: windows-cl, os: windows-2019, python-version: "pypy-3.8", compiler: cl }
- { id: macos-gcc, os: macos-10.15, python-version: "pypy-3.8", compiler: gcc }
runs-on: ${{ matrix.os }}
steps:
- name: Add VS build tools
if: runner.os == 'Windows' && matrix.compiler == 'cl'
uses: ilammy/msvc-dev-cmd@v1
# - name: Install OpenBLAS # Allows PyPy to build NumPy
# if: runner.os == 'macOS'
# shell: bash
# run: >
# brew install openblas &&
# echo "OPENBLAS='$(brew --prefix openblas)'" >> $GITHUB_ENV
- name: Download python-dist artifact
uses: actions/download-artifact@v2
with:
name: python-dist
path: dist/
- name: SHA256 files
shell: bash
run: find . -type f -exec sha256sum {} \;
working-directory: dist
- uses: actions/setup-python@v2
name: Install Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install sdist
shell: bash
run: python -m pip install dist/*.tar.gz
- uses: actions/checkout@v2
- name: Before Test
shell: bash
run: >
(if [[ "${{ matrix.os }}" = *"windows"* ]]; then export SHARED_EXT=".exe";
else export SHARED_EXT=""; fi) &&
mkdir build_test &&
${{ matrix.compiler }} -o build_test/test-${{ matrix.python-version }}-${{ matrix.id }}$SHARED_EXT -Iparticlefilter/include particlefilter/src/*.c test/test.c -lm &&
./build_test/test-${{ matrix.python-version }}-${{ matrix.id }}$SHARED_EXT --nofail ./test/data/ ./test/out/test1_ParticleFilterLoc_test_out_c_${{ matrix.python-version }}-${{ matrix.id }}.csv
- name: Test
shell: bash
run: >
time python test/test.py ./test/data/ ./test/out/test1_ParticleFilterLoc_test_out_py_${{ matrix.python-version }}-${{ matrix.id }}.csv ./test/out/test1_ParticleFilterLoc_test_out_c_${{ matrix.python-version }}-${{ matrix.id }}.csv
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: python-test-out
path: ./test/out/*.csv
build-test-python-wheel:
name: Build${{ matrix.title }} Wheel ${{ matrix.python-version }}-${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: cp36, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: cp37, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: cp38, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: cp39, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: cp310, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: pp37, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_x86_64, python-version: pp38, title: " & Test" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: cp36, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: cp37, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: cp38, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: cp39, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: cp310, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: pp37, title: "" }
- { os: ubuntu-20.04, arch: manylinux_i686, python-version: pp38, title: "" }
- { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: cp36, title: "" }
- { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: cp37, title: "" }
- { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: cp38, title: "" }
- { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: cp39, title: "" }
- { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: cp310, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: pp37, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_aarch64, python-version: pp38, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_ppc64le, python-version: cp36, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_ppc64le, python-version: cp37, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_ppc64le, python-version: cp38, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_ppc64le, python-version: cp39, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_ppc64le, python-version: cp310, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_s390x, python-version: cp36, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_s390x, python-version: cp37, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_s390x, python-version: cp38, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_s390x, python-version: cp39, title: "" }
# - { os: ubuntu-20.04, arch: manylinux_s390x, python-version: cp310, title: "" }
- { os: windows-2019, arch: win_amd64, python-version: cp36, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: cp37, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: cp38, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: cp39, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: cp310, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: pp37, title: " & Test" }
- { os: windows-2019, arch: win_amd64, python-version: pp38, title: " & Test" }
# - { os: windows-2019, arch: win_arm64, python-version: cp39, title: " & Test" }
# - { os: windows-2019, arch: win_arm64, python-version: cp310, title: " & Test" }
- { os: windows-2019, arch: win32, python-version: cp36, title: " & Test" }
- { os: windows-2019, arch: win32, python-version: cp37, title: " & Test" }
- { os: windows-2019, arch: win32, python-version: cp38, title: " & Test" }
- { os: windows-2019, arch: win32, python-version: cp39, title: " & Test" }
- { os: windows-2019, arch: win32, python-version: cp310, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: cp36, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: cp37, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: cp38, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: cp39, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: cp310, title: " & Test" }
# - { os: macos-10.15, arch: macosx_x86_64, python-version: pp37, title: " & Test" }
- { os: macos-10.15, arch: macosx_x86_64, python-version: pp38, title: " & Test" }
- { os: macos-10.15, arch: macosx_arm64, python-version: cp38, title: "" }
- { os: macos-10.15, arch: macosx_arm64, python-version: cp39, title: "" }
- { os: macos-10.15, arch: macosx_arm64, python-version: cp310, title: "" }
- { os: macos-10.15, arch: macosx_universal2, python-version: cp38, title: " & Mostly Test" }
- { os: macos-10.15, arch: macosx_universal2, python-version: cp39, title: " & Mostly Test" }
- { os: macos-10.15, arch: macosx_universal2, python-version: cp310, title: " & Mostly Test" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch != 'manylinux_x86_64'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build${{ matrix.title }} Wheel
uses: pypa/[email protected]
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: ${{ matrix.python-version }}-${{ matrix.arch }}
CIBW_ARCHS: 'all'
CIBW_BEFORE_TEST: >
cd {package} &&
bash -c "
(if [[ \"${{ matrix.os }}\" = *\"windows\"* ]]; then export SHARED_EXT=\".exe\";
else export SHARED_EXT=\"\"; fi) &&
mkdir -p build_test &&
gcc -o build_test/test-${{ matrix.id }}$SHARED_EXT -Iparticlefilter/include particlefilter/src/*.c test/test.c -lm &&
./build_test/test-${{ matrix.id }}$SHARED_EXT --nofail ./test/data/ ./test/out/test1_ParticleFilterLoc_test_out_c.csv
"
CIBW_TEST_COMMAND: >
python {project}/test/test.py {project}/test/data/ {project}/test/out/test1_ParticleFilterLoc_test_out_py.csv {project}/test/out/test1_ParticleFilterLoc_test_out_c.csv
CIBW_TEST_SKIP: '*-macosx_arm64 *-macosx_universal2:arm64 *-manylinux_{aarch64,i686,ppc64le,s390x}' # Cannot yet test on Mac non x86_64, some QEMU+Cython float precision issue
# CIBW_BEFORE_BUILD_MACOS: "brew install openblas" # Allows PyPy to build NumPy
# CIBW_ENVIRONMENT_MACOS: "OPENBLAS='$(brew --prefix openblas)'"
- name: Display structure of wheelhouse files
run: ls -R
working-directory: wheelhouse
- name: SHA256 files
shell: bash
run: find . -type f -name "*.whl" -exec sha256sum {} \;
working-directory: wheelhouse
- uses: actions/upload-artifact@v2
# Some QEMU+Cython float precision issue, so do not upload/bundle artifact for now
# Just want to be sure builds and runs without error
if: matrix.arch != 'manylinux_i686' && matrix.arch != 'manylinux_aarch64'
with:
name: python-dist
path: ./wheelhouse/*.whl
publish-python:
name: Publish distributions to PyPI
needs: [build-python-sdist, build-test-python-wheel]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Download python-dist artifact
uses: actions/download-artifact@v2
with:
name: python-dist
path: dist/
- name: Display structure of dist files
run: ls -R
working-directory: dist
- name: Publish distribution to PyPI
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
if: env.PYPI_API_TOKEN != null
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
publish-release-artifacts:
name: Publish Release Artifacts to GitHub
needs: [build-python-sdist, build-test-python-wheel]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Download Python artifacts
uses: actions/download-artifact@v2
with:
name: python-dist
path: python-dist/
- name: Display structure of python-dist files
run: ls -R
working-directory: python-dist
- name: Archive python-dist
run: >
tar -czvf python-dist-slam3d-${GITHUB_REF##*/}-all.tar.gz -C python-dist . &&
(cd python-dist; for f in *.tar.gz; do cp "$f" "../python-sdist-$f"; done; cd ../)
- name: SHA256 files
run: find . -type f -name "*.tar.gz" -exec sha256sum {} \;
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ contains(github.event.ref, '-pre') || contains(github.event.ref, '-alpha') || contains(github.event.ref, '-beta') || contains(github.event.ref, '-rc') || contains(github.event.ref, '-dev') }}
files: |
*.tar.gz