Skip to content

Add reuse-lint-file pre-commit hook #18

Add reuse-lint-file pre-commit hook

Add reuse-lint-file pre-commit hook #18

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Johann Klähn <[email protected]>
#
# SPDX-License-Identifier: MIT
name: Build Python package
on:
push: {branches: [main]}
pull_request: {branches: [main]}
workflow_dispatch: {}
release: {types: [published]}
jobs:
build-wheels:
name: Build PyPI package for ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# TODO: Add other platforms
- os: ubuntu-latest
platform: manylinux_x86_64
steps:
- uses: actions/checkout@v4
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: auto64
CIBW_BUILD: cp3*-${{ matrix.platform }}
CIBW_SKIP: cp3{5,6,7,8}*
CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/kljohann/genpybind-manylinux_2_28_x86_64:llvm-18
CIBW_TEST_COMMAND: >-
genpybind-tool --version &&
pip install build scikit-build-core pybind11 cmake ninja &&
python -m build --wheel --no-isolation {package}/example-project --outdir ./dist &&
pip install dist/*.whl &&
python -c "from genpybind_example import Example; print(Example.__doc__)"
- uses: actions/upload-artifact@v4
with:
name: pypi-wheels-${{ matrix.platform }}
path: ./wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: pypi-sdist
path: dist/*.tar.gz
publish:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: [build-wheels, build-sdist]
environment: pypi
permissions: {id-token: write} # for “trusted publishing” on PyPI
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: pypi-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/