Skip to content

Commit bd3101a

Browse files
committed
add cibw workflow
1 parent 08a3af0 commit bd3101a

2 files changed

Lines changed: 108 additions & 22 deletions

File tree

.github/workflows/main.yml

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: "0"
2224

2325
- name: Set up Python 3.11
2426
uses: actions/setup-python@v5
@@ -28,8 +30,7 @@ jobs:
2830
- name: Install dependencies
2931
run: |
3032
python -m pip install --upgrade pip
31-
pip install --editable .[check,test]
32-
pip install "coveralls>=3.0.0"
33+
pip install -v --editable '.[check]'
3334
3435
- name: black check
3536
run: |
@@ -47,60 +48,134 @@ jobs:
4748
run: |
4849
python -m pylint src/anaflow/
4950
50-
- name: coveralls check
51+
- name: cython-lint check
5152
run: |
52-
python -m pytest --cov anaflow --cov-report term-missing -v tests/
53-
python -m coveralls --service=github
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
cython-lint src/anaflow/
5654
57-
build_sdist:
58-
name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }}
55+
build_wheels:
56+
name: wheels for ${{ matrix.os }}
5957
runs-on: ${{ matrix.os }}
6058
strategy:
6159
fail-fast: false
6260
matrix:
63-
os: [ubuntu-latest, windows-latest, macos-13]
64-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
61+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]
6562

6663
steps:
6764
- uses: actions/checkout@v4
6865
with:
69-
fetch-depth: '0'
66+
fetch-depth: "0"
67+
68+
- name: Build wheels
69+
uses: pypa/cibuildwheel@v3.2.1
70+
with:
71+
output-dir: dist-wheel-${{ matrix.os }}
72+
73+
- uses: actions/upload-artifact@v4
74+
with:
75+
name: dist-wheel-${{ matrix.os }}
76+
path: ./dist-wheel-${{ matrix.os }}/*.whl
7077

71-
- name: Set up Python ${{ matrix.python-version }}
78+
build_sdist:
79+
name: sdist on ${{ matrix.os }} with py ${{ matrix.ver.py }} numpy${{ matrix.ver.np }}
80+
runs-on: ${{ matrix.os }}
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
os:
85+
[ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-14]
86+
ver:
87+
- { py: "3.8", np: "==1.20.0", sp: "==1.5.4" }
88+
- { py: "3.9", np: "==1.20.0", sp: "==1.5.4" }
89+
- { py: "3.10", np: "==1.21.6", sp: "==1.7.2" }
90+
- { py: "3.11", np: "==1.23.2", sp: "==1.9.2" }
91+
- { py: "3.12", np: "==1.26.2", sp: "==1.11.2" }
92+
- { py: "3.13", np: "==2.1.0", sp: "==1.14.1" }
93+
# - { py: "3.14", np: "==2.3.2", sp: "==1.16.1" }
94+
# - { py: "3.14", np: ">=2.3.2", sp: ">=1.16.1" }
95+
exclude:
96+
- os: ubuntu-24.04-arm
97+
ver: { py: "3.8", np: "==1.20.0", sp: "==1.5.4" }
98+
- os: macos-14
99+
ver: { py: "3.8", np: "==1.20.0", sp: "==1.5.4" }
100+
- os: macos-14
101+
ver: { py: "3.9", np: "==1.20.0", sp: "==1.5.4" }
102+
- os: macos-14
103+
ver: { py: "3.10", np: "==1.21.6", sp: "==1.7.2" }
104+
steps:
105+
- uses: actions/checkout@v4
106+
with:
107+
fetch-depth: "0"
108+
109+
- name: Set up Python ${{ matrix.ver.py }}
72110
uses: actions/setup-python@v5
73111
with:
74-
python-version: ${{ matrix.python-version }}
112+
python-version: ${{ matrix.ver.py }}
75113

76114
- name: Install dependencies
77115
run: |
78116
python -m pip install --upgrade pip
79117
pip install build
80-
pip install --editable .[test]
118+
119+
- name: Install anaflow
120+
run: |
121+
pip install -v --editable .[test]
81122
82123
- name: Run tests
83124
run: |
84-
python -m pytest --cov anaflow --cov-report term-missing -v tests/
125+
pip install "numpy${{ matrix.ver.np }}" "scipy${{ matrix.ver.sp }}"
126+
python -m pytest -v tests/
85127
86128
- name: Build sdist
87129
run: |
88-
python -m build
130+
# PEP 517 package builder from pypa
131+
python -m build --sdist --outdir dist-sdist .
89132
90133
- uses: actions/upload-artifact@v4
91-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
134+
if: matrix.os == 'ubuntu-latest' && matrix.ver.py == '3.11'
92135
with:
93-
name: dist
94-
path: dist/*
136+
name: dist-sdist
137+
path: dist-sdist/*.tar.gz
138+
139+
coverage:
140+
name: coverage
141+
runs-on: ubuntu-latest
142+
143+
steps:
144+
- uses: actions/checkout@v4
145+
with:
146+
fetch-depth: '0'
147+
148+
- name: Set up Python 3.11
149+
uses: actions/setup-python@v5
150+
with:
151+
python-version: 3.11
152+
153+
- name: Install dependencies
154+
run: |
155+
python -m pip install --upgrade pip
156+
pip install "coveralls>=3.0.0"
157+
158+
- name: Install anaflow
159+
run: |
160+
pip install -v --editable .[test]
161+
162+
- name: Run tests
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
run: |
166+
pip install "numpy${{ matrix.ver.np }}"
167+
python -m pytest --cov anaflow --cov-report term-missing -v tests/
168+
python -m coveralls --service=github
95169
96170
upload_to_pypi:
97-
needs: [build_sdist]
171+
needs: [build_wheels, build_sdist]
98172
runs-on: ubuntu-latest
99173

100174
steps:
101175
- uses: actions/download-artifact@v4
102176
with:
103-
name: dist
177+
pattern: dist-*
178+
merge-multiple: true
104179
path: dist
105180

106181
- name: Publish to Test PyPI

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,14 @@ target-version = [
141141
max-attributes = 25
142142
max-public-methods = 75
143143
max-positional-arguments=25
144+
145+
[tool.cibuildwheel]
146+
# Switch to using build
147+
build-frontend = "build"
148+
# explicitly enable pypy
149+
enable = ["pypy"]
150+
# Disable building py3.6/7/8, pp3.8, 32bit linux
151+
skip = ["cp314*", "cp36-*", "cp37-*", "cp38-*", "pp38-*", "*_i686"]
152+
# Run the package tests using `pytest`
153+
test-extras = "test"
154+
test-command = "pytest -v {package}/tests"

0 commit comments

Comments
 (0)