Skip to content

Commit 273912f

Browse files
committed
Add CI workflows (tests, buildwheel)
1 parent cfc853a commit 273912f

4 files changed

Lines changed: 138 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "CI: Run Tests on Linux"
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
name: Python ${{ matrix.python-version }} on Linux
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.12, 3.13]
12+
fail-fast: true # all versions must be supported
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install Package
23+
run: |
24+
pip install -v .
25+
pip install -r requirements-test.txt
26+
27+
- name: Run Tests
28+
run: |
29+
pytest -v
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "CI: Run Tests on MacOS"
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
name: Python ${{ matrix.python-version }} on MacOS
8+
runs-on: macos-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.12, 3.13]
12+
fail-fast: true # all versions must be supported
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install Package
23+
run: |
24+
pip install -v .
25+
pip install -r requirements-test.txt
26+
27+
- name: Run Tests
28+
run: |
29+
pytest -v
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "CI: Run Tests on Windows"
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
name: Python ${{ matrix.python-version }} on Windows
8+
runs-on: windows-latest
9+
strategy:
10+
matrix:
11+
python-version: [3.12, 3.13]
12+
fail-fast: true # all versions must be supported
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install Package
23+
run: |
24+
pip install -v .
25+
pip install -r requirements-test.txt
26+
27+
- name: Run Tests
28+
run: |
29+
pytest -v

.github/workflows/ci-wheels.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Wheels
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build_wheels:
11+
name: Build wheels on ${{ matrix.archs }} for ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Select architecture for MacOS
21+
run: |
22+
echo 'CIBW_ARCHS=x86_64 universal2' >> $GITHUB_ENV
23+
if: runner.os == 'macOS'
24+
25+
- uses: pypa/[email protected]
26+
name: Build wheels
27+
env:
28+
# cibuildwheel will build wheel once and test it for each CPython version
29+
CIBW_BUILD: "cp312-* cp313-*"
30+
CIBW_BUILD_VERBOSITY: 1
31+
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
35+
path: ./wheelhouse/*.whl
36+
37+
upload_all:
38+
needs: [build_wheels]
39+
environment: pypi
40+
permissions:
41+
id-token: write
42+
runs-on: ubuntu-latest
43+
if: github.event_name == 'release' && github.event.action == 'published'
44+
steps:
45+
- uses: actions/download-artifact@v5
46+
with:
47+
pattern: cibw-*
48+
path: dist
49+
merge-multiple: true
50+
51+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)