Skip to content

Convert from setup.py to pyproject.toml and change license to MIT #132

Convert from setup.py to pyproject.toml and change license to MIT

Convert from setup.py to pyproject.toml and change license to MIT #132

Workflow file for this run

name: build
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
jobs:
build-and-test:
name: Testing on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5.0.0
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build and Test Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: "cp3*-manylinux_x86_64"
CIBW_BEFORE_TEST: pip install ".[dev]"
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
sdist:
if: startsWith(github.ref, 'refs/tags')
needs: build-and-test
name: Source distribution
runs-on: macos-latest
steps:
- uses: actions/checkout@v5.0.0
- name: Install requirements
run: |
pip3 install --user check-manifest twine
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install ".[dev]"
- name: Run check-manifest
run: python3 -m check_manifest
- name: Build sdist
run: python3 -m build --sdist --outdir wheelhouse
- name: Install from sdist
run: pip3 install --user wheelhouse/*.tar.gz
- name: Check sdist
run: python3 -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: wheelhouse/*.tar.gz
wheels_macos:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build macOS ${{ matrix.cibw_python }} ${{ matrix.cibw_arch }} wheels
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
cibw_arch: [ "x86_64", "arm64" ]
steps:
- uses: actions/checkout@v5.0.0
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
echo DEPLOYMENT_TARGET=10.9 >> $GITHUB_ENV
- name: Changing deployment target
if: matrix.cibw_arch == 'arm64'
run: echo DEPLOYMENT_TARGET=12.0 >> $GITHUB_ENV
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_ENVIRONMENT: MACOSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }}
CIBW_BUILD: "cp3*"
CIBW_ARCHS_MACOS: ${{ matrix.cibw_arch }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CFLAGS: "-Wno-implicit-function-declaration"
CIBW_BEFORE_TEST: pip install ".[dev]"
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
wheels_linux:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build ${{ matrix.cibw_buildlinux }} ${{ matrix.cibw_arch }} wheels
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
cibw_buildlinux: [ manylinux, musllinux ]
cibw_arch: [ "x86_64", "aarch64" ]
steps:
- uses: actions/checkout@v5.0.0
- name: Set up QEMU
if: matrix.cibw_arch == 'aarch64'
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp3*-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS_LINUX: ${{ matrix.cibw_arch }}
CIBW_BEFORE_TEST: pip install ".[dev]"
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
wheels_windows:
if: startsWith(github.ref, 'refs/tags')
needs: [build-and-test, sdist]
name: Build Windows wheels
runs-on: windows-latest
steps:
- uses: actions/checkout@v5.0.0
- name: Install cibuildwheel
run: |
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel twine
- name: 🛠 Build Hexhamming Python C extension
run: cibuildwheel
env:
CIBW_BUILD: "cp3*"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_BEFORE_TEST: pip install ".[dev]"
CIBW_TEST_COMMAND: "pytest -s {project}"
CIBW_BUILD_VERBOSITY: 1
- name: Check built wheels
run: twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v4.6.2
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error
publish-wheels:
if: startsWith(github.ref, 'refs/tags')
needs: [wheels_macos, wheels_linux, wheels_windows]
name: Publish wheels
environment:
name: pypi
url: https://pypi.org/p/hexhamming
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Collect sdist and wheels
uses: actions/download-artifact@v5.0.0
with:
name: wheels
path: dist
- name: 📦 Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1