Skip to content

Commit

Permalink
Merge pull request #6 from andersy005/master
Browse files Browse the repository at this point in the history
Add Github Workflow for building Python wheels and publish them to PyPI
  • Loading branch information
cspencerjones authored Jan 6, 2020
2 parents 2e851b2 + 742ab08 commit 3091b06
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/pythonpublish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm numpy cibuildwheel wheel twine
- name: Build
env:
CIBW_BEFORE_BUILD: "pip install -U numpy"
CIBW_SKIP: "cp27-* cp34-* cp35-*"
run: |
python setup.py sdist -d wheelhouseLinux
python -m cibuildwheel --platform linux --output-dir wheelhouseLinux
- name: Archive wheels
uses: actions/upload-artifact@v1
with:
name: wheelhouseLinux
path: wheelhouseLinux


deploy-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
brew install gcc
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm numpy cibuildwheel wheel twine
- name: Build
env:
CIBW_BEFORE_BUILD: "pip install -U numpy"
CIBW_SKIP: "cp27-* cp34-* cp35-*"
run: |
python -m cibuildwheel --platform macos --output-dir wheelhouseMacOS
- name: Archive wheels
uses: actions/upload-artifact@v1
with:
name: wheelhouseMacOS
path: wheelhouseMacOS
deploy:
needs: [deploy-linux, deploy-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
- name: Download archived MacOS wheels
uses: actions/download-artifact@v1
with:
name: wheelhouseMacOS

- name: Download archived Linux wheels
uses: actions/download-artifact@v1
with:
name: wheelhouseLinux

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
ls -ltrh wheelhouseMacOS/ wheelhouseLinux/
twine upload --skip-existing wheelhouseLinux/* wheelhouseMacOS/*

0 comments on commit 3091b06

Please sign in to comment.