diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 00000000..27308859 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,66 @@ +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 + - 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 + - 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 build --sdist + 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 build --wheel + python -m twine upload "dist/*.whl" --skip-existing