Skip to content

Commit

Permalink
Update python-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon authored Jan 30, 2021
1 parent 2d00ddb commit 3601d4f
Showing 1 changed file with 81 additions and 26 deletions.
107 changes: 81 additions & 26 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Publish sdist and wheels macos-manylinux

on:
release:
types: [created]
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
Expand All @@ -16,28 +14,85 @@ env:
CIBW_SKIP: 'cp35-* cp39-* *-manylinux_i686'
CIBW_BEFORE_TEST: pip install nose mock h5py numpy
CIBW_TEST_COMMAND: nosetests -s -v -P {project}/tests

jobs:
deploy:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

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

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==1.6.4 pybind11
- name: Build wheels on Linux
if: runner.os == 'Linux'
env:
CIBW_BEFORE_BUILD: 'yum update -y'
run: |
python -m cibuildwheel --output-dir dist
- name: Build wheels Mac OS
if: runner.os == 'macOS'
env:
CIBW_BEFORE_BUILD: |
brew update
brew unlink gcc@8 gcc@9
brew install cmake
run: |
python -m cibuildwheel --output-dir dist
- name: Store wheel as artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist

build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Build a source tarball
run:
python setup.py sdist
- name: Store sdist as artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist

upload_wheels:
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
name: Upload wheels to PyPI
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pybind11
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Download artifacts produced during the build_wheels and build_sdist jobs
uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Display structure of downloaded files
run: ls -R
working-directory: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: dist/

0 comments on commit 3601d4f

Please sign in to comment.