summaryrefslogtreecommitdiff
path: root/.github/workflows/build-python-package.yml
diff options
context:
space:
mode:
authorJohn J. Camilleri <john@digitalgrammars.com>2020-06-15 08:59:40 +0200
committerGitHub <noreply@github.com>2020-06-15 08:59:40 +0200
commit383ff5e22798402eacf52543ecc20c37a28d0b39 (patch)
treee29de7538355aaf2eb9c7d940178f25702b237db /.github/workflows/build-python-package.yml
parentf31bccca1cbd7df0c1d7b5504eec13c3a26c29b5 (diff)
parent71a98cdf0030d77abc3460af44329cdf653b1da3 (diff)
Merge pull request #60 from miracle2k/wheels
WIP: Add Github action workflow to build Python wheels.
Diffstat (limited to '.github/workflows/build-python-package.yml')
-rw-r--r--.github/workflows/build-python-package.yml92
1 files changed, 92 insertions, 0 deletions
diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml
new file mode 100644
index 000000000..138ad4f21
--- /dev/null
+++ b/.github/workflows/build-python-package.yml
@@ -0,0 +1,92 @@
+name: Build & Publish Python Package
+
+on: [push, pull_request]
+
+jobs:
+ build_wheels:
+ name: Build wheel on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: true
+ matrix:
+ os: [ubuntu-18.04, macos-latest]
+
+ steps:
+ - uses: actions/checkout@v1
+
+ - uses: actions/setup-python@v1
+ name: Install Python
+ with:
+ python-version: '3.7'
+
+ - name: Install cibuildwheel
+ run: |
+ python -m pip install cibuildwheel==1.4.2
+
+ - name: Install build tools for OSX
+ if: startsWith(matrix.os, 'macos')
+ run: |
+ brew install automake
+
+ - name: Build wheels on Linux
+ if: startsWith(matrix.os, 'macos') != true
+ env:
+ CIBW_BEFORE_BUILD: cd src/runtime/c && autoreconf -i && ./configure && make && make install
+ run: |
+ python -m cibuildwheel src/runtime/python --output-dir wheelhouse
+
+ - name: Build wheels on OSX
+ if: startsWith(matrix.os, 'macos')
+ env:
+ CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install
+ run: |
+ python -m cibuildwheel src/runtime/python --output-dir wheelhouse
+
+ - uses: actions/upload-artifact@v2
+ with:
+ path: ./wheelhouse
+
+ 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.7'
+
+ - name: Build sdist
+ run: cd src/runtime/python && python setup.py sdist
+
+ - uses: actions/upload-artifact@v2
+ with:
+ path: ./src/runtime/python/dist/*.tar.gz
+
+ upload_pypi:
+ needs: [build_wheels, build_sdist]
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+
+ - name: Install twine
+ run: pip install twine
+
+ - uses: actions/download-artifact@v2
+ with:
+ name: artifact
+ path: ./src/runtime/python/dist
+
+ - name: Publish
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.pypi_password }}
+ run: |
+ (cd ./src/runtime/python && curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload dist/*