Skip to content

Commit df91036

Browse files
authored
Travis to Github Actions (#16)
* fix test.sh * add arm * drop 3.6 * set seed * update pybind11 * move to github actions * fix ci * fix ci * fix * fix * fix readme * fix * fix * fix * fix
1 parent 07db856 commit df91036

7 files changed

Lines changed: 85 additions & 40 deletions

File tree

.github/workflows/cibuildwheel.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build_wheels:
13+
name: Build wheels on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-20.04, windows-2019, macos-10.15]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
submodules: recursive
23+
- uses: actions/setup-python@v2
24+
name: Install Python
25+
with:
26+
python-version: 3.8
27+
- name: Set up QEMU
28+
if: runner.os == 'Linux'
29+
uses: docker/setup-qemu-action@v1
30+
with:
31+
platforms: all
32+
- name: Build wheels
33+
uses: pypa/cibuildwheel@v2.0.0
34+
env:
35+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
36+
CIBW_BUILD: cp3?-*
37+
CIBW_SKIP: cp27-* cp36-* *-win32 *-manylinux_i686
38+
CIBW_ARCHS_LINUX: x86_64 aarch64
39+
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
40+
CIBW_BEFORE_BUILD: pip install pybind11
41+
CIBW_TEST_COMMAND: pytest {project}/tests
42+
CIBW_TEST_REQUIRES: pytest numpy
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
path: ./wheelhouse/*.whl
46+
47+
build_sdist:
48+
name: Build source distribution
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
with:
53+
submodules: recursive
54+
- uses: actions/setup-python@v2
55+
name: Install Python
56+
with:
57+
python-version: 3.8
58+
- name: Build sdist
59+
run: python setup.py sdist
60+
- uses: actions/upload-artifact@v2
61+
with:
62+
path: dist/*.tar.gz
63+
64+
upload_pypi:
65+
needs: [build_wheels, build_sdist]
66+
runs-on: ubuntu-latest
67+
# upload to PyPI on every tag starting with 'v'
68+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
69+
steps:
70+
- uses: actions/download-artifact@v2
71+
with:
72+
name: artifact
73+
path: dist
74+
- uses: pypa/gh-action-pypi-publish@v1.4.2
75+
with:
76+
user: __token__
77+
password: ${{ secrets.PYPI_API_TOKEN }}

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ print(result)
2929
# [[1], [1, 2]]
3030
```
3131

32-
## New features (`python-prtree>=0.4.0`)
32+
## New features
33+
### `python-prtree>=0.4.0`
3334
You can use PRTree3D:
3435

3536
```python
@@ -49,8 +50,7 @@ print(result)
4950
# [[1], [1, 2]]
5051
```
5152

52-
53-
## New features (`python-prtree>=0.3.0`)
53+
### `python-prtree>=0.3.0`
5454
You can save and load a binary file as follows:
5555

5656
```python

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def build_extension(self, ext):
8080

8181
setup(
8282
name='python_prtree',
83-
version='0.4.0',
83+
version='0.4.2',
8484
license='MIT',
8585
description='Python implementation of Priority R-Tree',
8686
author='atksh',

test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
clear
21
rm -rf build dist .pytest_cache
32
CXX=/usr/bin/g++ pip install .
43
pytest tests -vv --capture=no

tests/test_PRTree.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def has_intersect(x, y, dim):
1111

1212
@pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)])
1313
def test_result(PRTree, dim):
14+
np.random.seed(1)
1415
idx = np.arange(100)
1516
x = np.random.rand(len(idx), 2 * dim)
1617
for i in range(dim):
@@ -25,6 +26,7 @@ def test_result(PRTree, dim):
2526

2627
@pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)])
2728
def test_io(PRTree, dim, tmp_path):
29+
np.random.seed(1)
2830
idx = np.arange(100)
2931
x = np.random.rand(len(idx), 2 * dim)
3032
for i in range(dim):
@@ -53,6 +55,7 @@ def test_io(PRTree, dim, tmp_path):
5355

5456
@pytest.mark.parametrize("PRTree, dim", [(PRTree2D, 2), (PRTree3D, 3)])
5557
def test_insert_erase(PRTree, dim):
58+
np.random.seed(1)
5659
N = 10000
5760
idx = np.arange(N)
5861
x = np.random.rand(N, 2 * dim)

third/pybind11

Submodule pybind11 updated 105 files

0 commit comments

Comments
 (0)