solvespace/.github/workflows/python.yml

63 lines
1.9 KiB
YAML

name: Python
on:
push:
branches: [ python ]
tags: [ py* ]
jobs:
python-build:
strategy:
matrix:
pyver:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
steps:
- uses: actions/checkout@v2
- run: git submodule update --init extlib/mimalloc extlib/eigen
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyver }}
- name: Build and test
working-directory: cython
run: |
python -m pip install -U pip setuptools wheel build
python -m pip install -e .
python -m unittest
- name: Pack
working-directory: cython
run: python -m build --sdist --wheel
- if: matrix.os == 'ubuntu-latest'
name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-py${{ matrix.pyver }}
path: cython/dist/*.tar.gz
- if: matrix.os != 'ubuntu-latest'
name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-py${{ matrix.pyver }}
path: cython/dist/*.whl
- if: startsWith(github.ref, 'refs/tags/py')
run: python -m pip install twine
- if: startsWith(github.ref, 'refs/tags/py') && matrix.os == 'ubuntu-latest'
name: release
working-directory: cython
run: python -m twine upload "dist/*.tar.gz" --skip-existing
- if: startsWith(github.ref, 'refs/tags/py') && matrix.os != 'ubuntu-latest'
name: release
working-directory: cython
run: python -m twine upload "dist/*.whl" --skip-existing