Merge pull request #5 from freakboy3742/cibw-config
Switch to cibuildwheel for CI builds.
This commit is contained in:
commit
2ee66db468
6 changed files with 146 additions and 30 deletions
87
.github/workflows/ci.yml
vendored
87
.github/workflows/ci.yml
vendored
|
|
@ -4,6 +4,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
# Cancel active CI runs for a PR before starting another run
|
# Cancel active CI runs for a PR before starting another run
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|
@ -25,26 +26,45 @@ jobs:
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
needs: [ pre-commit ]
|
needs: [ pre-commit ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
continue-on-error: ${{ matrix.experimental || false }}
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ "macos-13", "macos-latest", "ubuntu-24.04" ]
|
name: [ "macOS (x86_64)", "macOS (arm64)", "iOS", "Linux (x86_64)", "Linux (arm64)" ] # Android, Windows (x86_64), Windows (arm64)
|
||||||
# Test the min and max stable Python version on each OS.
|
|
||||||
python-version: [ "3.9", "3.13" ]
|
|
||||||
include:
|
include:
|
||||||
# Ensure the Python versions between min and max are tested
|
- name: macOS (x86_64)
|
||||||
- platform: "ubuntu-24.04"
|
platform: macos
|
||||||
python-version: "3.10"
|
runs-on: macos-13
|
||||||
- platform: "ubuntu-24.04"
|
archs: auto
|
||||||
python-version: "3.11"
|
- name: macOS (arm64)
|
||||||
- platform: "ubuntu-24.04"
|
platform: macos
|
||||||
python-version: "3.12"
|
runs-on: macos-latest
|
||||||
# Allow dev Python to fail without failing entire job
|
archs: auto,universal2
|
||||||
- platform: "ubuntu-24.04"
|
- name: iOS
|
||||||
python-version: "3.14"
|
platform: ios
|
||||||
experimental: true
|
runs-on: macos-latest
|
||||||
|
archs: auto
|
||||||
|
- name: Linux (x86_64)
|
||||||
|
platform: linux
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
archs: auto
|
||||||
|
- name: Linux (arm64)
|
||||||
|
platform: linux
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
archs: auto
|
||||||
|
# - name: Android
|
||||||
|
# platform: android
|
||||||
|
# runs-on: macos-latest
|
||||||
|
# archs: auto
|
||||||
|
# - name: Windows (x86_64)
|
||||||
|
# platform: windows
|
||||||
|
# runs-on: windows-latest
|
||||||
|
# archs: auto
|
||||||
|
# - name: Windows (arm64)
|
||||||
|
# platform: windows
|
||||||
|
# runs-on: windows-latest-arm??
|
||||||
|
# archs: auto
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
@ -54,16 +74,29 @@ jobs:
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5.4.0
|
uses: actions/setup-python@v5.4.0
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: "3.x"
|
||||||
allow-prereleases: true
|
|
||||||
|
|
||||||
- name: Install Tox
|
- name: Install cibuildwheel
|
||||||
uses: beeware/.github/.github/actions/install-requirement@main
|
|
||||||
with:
|
|
||||||
requirements: tox
|
|
||||||
extra: dev
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
id: test
|
|
||||||
run: |
|
run: |
|
||||||
tox -e py
|
python -m pip install -U pip
|
||||||
|
# Use a branch while iOS support is in development and test-sources is unpublished.
|
||||||
|
# python -m pip install cibuildwheel==3.0.0
|
||||||
|
python -m pip install git+https://github.com/freakboy3742/cibuildwheel.git@ios-support
|
||||||
|
|
||||||
|
- name: iOS testing set workaround
|
||||||
|
if: matrix.platform == 'ios'
|
||||||
|
run: |
|
||||||
|
# Temp workaround - make sure there is an iOS test devices directory
|
||||||
|
mkdir -p /Users/runner/Library/Developer/XCTestDevices
|
||||||
|
|
||||||
|
- name: Build wheels
|
||||||
|
run: python -m cibuildwheel
|
||||||
|
env:
|
||||||
|
CIBW_PLATFORM: ${{ matrix.platform }}
|
||||||
|
CIBW_ARCHS: ${{ matrix.archs }}
|
||||||
|
CIBW_BUILD: "cp*"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4.6.0
|
||||||
|
with:
|
||||||
|
name: wheels-${{ matrix.name }}
|
||||||
|
path: ./wheelhouse/*.whl
|
||||||
|
|
|
||||||
22
.github/workflows/publish.yml
vendored
Normal file
22
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Upload Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: published
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# This permission is required for trusted publishing.
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: dsaltares/fetch-gh-release-asset@1.1.2
|
||||||
|
with:
|
||||||
|
version: tags/${{ github.event.release.tag_name }}
|
||||||
|
file: ${{ github.event.repository.name }}.*
|
||||||
|
regex: true
|
||||||
|
target: dist/
|
||||||
|
|
||||||
|
- name: Publish release to production PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1.12.3
|
||||||
54
.github/workflows/release.yml
vendored
Normal file
54
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
name: Create Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: CI
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create Release
|
||||||
|
needs: ci
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
# This permission is required for trusted publishing.
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
steps:
|
||||||
|
- name: Set build variables
|
||||||
|
run: |
|
||||||
|
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5.4.0
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Get packages
|
||||||
|
uses: actions/download-artifact@v4.1.8
|
||||||
|
with:
|
||||||
|
pattern: wheels-*
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: ncipollo/release-action@v1.15.0
|
||||||
|
with:
|
||||||
|
name: ${{ env.VERSION }}
|
||||||
|
draft: true
|
||||||
|
artifacts: dist/*
|
||||||
|
artifactErrorsFailBuild: true
|
||||||
|
|
||||||
|
- name: Generate attestations
|
||||||
|
uses: actions/attest-build-provenance@v2.1.0
|
||||||
|
with:
|
||||||
|
subject-path: "dist/*"
|
||||||
|
|
||||||
|
# - name: Publish release to Test PyPI
|
||||||
|
# uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
# with:
|
||||||
|
# repository-url: https://test.pypi.org/legacy/
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -11,3 +11,4 @@ distribute-*
|
||||||
.tox/
|
.tox/
|
||||||
.vscode/
|
.vscode/
|
||||||
venv/
|
venv/
|
||||||
|
wheelhouse/
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ classifiers=[
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
"Programming Language :: Python :: 3.13",
|
"Programming Language :: Python :: 3.13",
|
||||||
"Programming Language :: Python :: 3.14",
|
|
||||||
"Topic :: Text Processing",
|
"Topic :: Text Processing",
|
||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
]
|
]
|
||||||
|
|
@ -39,9 +38,11 @@ classifiers=[
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
# Extras used by developers *of* briefcase are pinned to specific versions to
|
# Extras used by developers *of* briefcase are pinned to specific versions to
|
||||||
# ensure environment consistency.
|
# ensure environment consistency.
|
||||||
|
test = [
|
||||||
|
"pytest == 8.3.4",
|
||||||
|
]
|
||||||
dev = [
|
dev = [
|
||||||
"pre-commit == 4.1.0",
|
"pre-commit == 4.1.0",
|
||||||
"pytest == 8.3.4",
|
|
||||||
"ruff == 0.9.6",
|
"ruff == 0.9.6",
|
||||||
"setuptools_scm == 8.1.0",
|
"setuptools_scm == 8.1.0",
|
||||||
"tox == 4.24.1",
|
"tox == 4.24.1",
|
||||||
|
|
@ -52,6 +53,11 @@ Homepage = "https://github.com/freakboy3742/pyspamsum/"
|
||||||
Tracker = "https://github.com/freakboy3742/pyspamsum/issues"
|
Tracker = "https://github.com/freakboy3742/pyspamsum/issues"
|
||||||
Source = "https://github.com/freakboy3742/pyspamsum/"
|
Source = "https://github.com/freakboy3742/pyspamsum/"
|
||||||
|
|
||||||
|
[tool.cibuildwheel]
|
||||||
|
test-command = "pytest"
|
||||||
|
test-extras = ["test"]
|
||||||
|
test-sources = ["tests"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
filterwarnings = [
|
filterwarnings = [
|
||||||
|
|
|
||||||
2
tox.ini
2
tox.ini
|
|
@ -10,6 +10,6 @@ commands = pre-commit run --all-files --show-diff-on-failure --color=always
|
||||||
|
|
||||||
[testenv:py{,39,310,311,312,313,314}]
|
[testenv:py{,39,310,311,312,313,314}]
|
||||||
depends = pre-commit
|
depends = pre-commit
|
||||||
extras = dev
|
extras = test
|
||||||
commands =
|
commands =
|
||||||
python -m pytest {posargs:-vv --color yes}
|
python -m pytest {posargs:-vv --color yes}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue