mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
name: Build & Publish Python Package
|
|
|
|
# Trigger the workflow on push or pull request, but only for the master branch
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build_wheels:
|
|
name: Build wheel on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os: [ubuntu-18.04, macos-10.15]
|
|
|
|
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 git+https://github.com/joerick/cibuildwheel.git@master
|
|
|
|
- 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:
|
|
name: Upload to PyPI
|
|
needs: [build_wheels, build_sdist]
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
|
|
|
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: ./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/*
|