-
Notifications
You must be signed in to change notification settings - Fork 41
133 lines (120 loc) · 3.79 KB
/
python-package.yml
File metadata and controls
133 lines (120 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches:
- main
tags:
- v**
pull_request:
branches:
- main
env:
VERSION: ${{ github.ref_name }}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
- '3.14t'
- 'pypy3.9'
- 'pypy3.10'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 radix --count --select=E9,F63,F7,F82 --show-source --statistics
# For now, ignore the single occurrence of E741 in _prefix_match(),
# ignore W503 in favor of PEP 8 suggesting Knuth's style, accept the
# max. complexity of 23 for RadixTree.add() - and just fail otherwise
flake8 radix --count --ignore=E741,W503 --max-complexity=23 --max-line-length=127 --statistics
- name: Test with pytest
run: pytest -v
build-wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request'
strategy:
matrix:
include:
- os: linux-intel
runs-on: ubuntu-latest
- os: linux-arm
runs-on: ubuntu-24.04-arm
- os: windows-intel
runs-on: windows-latest
- os: windows-arm
runs-on: windows-11-arm
- os: macos-intel
# macos-15-intel is the last x86_64 runner
runs-on: macos-15-intel
- os: macos-arm
# macos-14+ (including latest) are ARM64 runners
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
env:
CIBW_SKIP: "cp38-* *_ppc64le *_s390x *_riscv64"
CIBW_PLATFORM: ${{ matrix.platform || 'auto' }}
CIBW_ARCHS: ${{ matrix.archs || 'auto' }}
CIBW_ENVIRONMENT_PASS_LINUX: VERSION
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build-wheels
- build-sdist
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/py-radix/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v5
with:
pattern: cibw-*
merge-multiple: true
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1