Skip to content

Commit

Permalink
Merge pull request #3 from WFP-VAM/actions
Browse files Browse the repository at this point in the history
Add automatic github actions
  • Loading branch information
valpesendorfer authored Apr 16, 2021
2 parents 734b883 + 5628855 commit 0196355
Show file tree
Hide file tree
Showing 12 changed files with 1,109 additions and 13,401 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and test
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build_and_test:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install dependencies
run: pip install cython numpy
- name: build
run: pip install $GITHUB_WORKSPACE
- name: test
run: python $GITHUB_WORKSPACE/setup.py test
65 changes: 65 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: publish

on:
release:
types: [published]

jobs:
build_wheels:
name: Build wheels
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.10.0

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: "pip install cython numpy"
CIBW_BUILD: "{cp,pp}3*-*"
CIBW_SKIP: "cp35-* *-manylinux_i686"

- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'

- name: Install dependencies
run: python -m pip install numpy cython

- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ __pycache__/

# C extensions
*.so
*.c
*/*.c

# Distribution / packaging
.Python
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

include _version/__init__.py
include README.rst
recursive-include tests *py
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
vam.whittaker
-------------

|version| |downloads| |license|
|CI| |version| |downloads| |license|

.. |CI| image:: https://github.com/WFP-VAM/vam.whittaker/actions/workflows/ci.yml/badge.svg
:target: https://github.com/vam.whittaker/modape/actions/

.. |version| image:: https://img.shields.io/pypi/v/vam.whittaker.svg
:target: https://pypi.org/project/vam.whittaker/
Expand Down Expand Up @@ -79,6 +82,8 @@ CHANGES
- new function `wsdp` & fix for `ws2doptvp`
- v2.0.1:
- minor bugfix in `wsdp`
- v2.0.2:
- distribute built extension on pypi


-----
Expand Down
2 changes: 1 addition & 1 deletion _version/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

VERSION_MAJOR = 2
VERSION_MINOR = 0
VERSION_PATCH = 1
VERSION_PATCH = 2

VERSION_STRING = '%s.%s.%s' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)

Expand Down
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[aliases]
test=pytest

[tool:pytest]
python_files = tests/test_*.py
filterwarnings =
ignore::UserWarning
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
ext_modules=ext_modules,
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
setup_requires=['pytest-runner'],
Expand All @@ -54,5 +53,5 @@
'numpy>=1.15.1',
'mock;python_version<"3.0"'
],
python_requires='>=2.7.11, <4',
python_requires='>=3, <4',
)
Loading

0 comments on commit 0196355

Please sign in to comment.