Add Cython build infra + initial extension module #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package and Publish | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
pull_request: | |
jobs: | |
build_sdist: | |
name: Build Source Package | |
runs-on: ubuntu-latest | |
outputs: | |
filename: ${{steps.build.outputs.filename}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch Git tags | |
run: git fetch --tags | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Python deps | |
run: pip install -U build | |
- name: Build source distribution | |
id: build | |
run: | | |
python -m build -s | |
basename dist/*.tar.gz |sed -e 's/^/filename=/' >> "$GITHUB_OUTPUT" | |
cat "$GITHUB_OUTPUT" | |
- name: Save archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-src | |
path: dist | |
- name: List dist dir | |
run: ls -R dist | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: [build_sdist] | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-11] | |
steps: | |
- name: Fetch compiled package distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-src | |
path: dist | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: dist/${{needs.build_sdist.outputs.filename}} | |
output-dir: dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-wheels-${{ matrix.os }} | |
path: ./dist/*.whl | |
pypi-publish: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: [build_sdist, build_wheels] | |
if: github.event_name == 'release' | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- name: Fetch compiled package distributions | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
path: dist | |
merge-multiple: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |