Skip to content

Commit a281c02

Browse files
committed
Split up CI to separate test/publish workflows for simplicity.
Also only rebuild documentation upon creating a new tag.
1 parent d78ad86 commit a281c02

File tree

3 files changed

+67
-70
lines changed

3 files changed

+67
-70
lines changed

.github/workflows/build-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Build documentation
22

33
on:
44
push:
5-
branches:
6-
- master
5+
tags:
6+
- '*'
77

88
jobs:
99
test:

.github/workflows/pypi-publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build_wheels:
10+
name: Build wheels on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
# macos-13 is an intel runner, higher macos's are apple silicon
15+
# At some point, maybe get this to work on windows-latest
16+
os: [ubuntu-latest, macos-13, macos-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: true
22+
23+
- name: Build wheels
24+
uses: pypa/cibuildwheel@v2.22.0
25+
env:
26+
CIBW_ARCHS_LINUX: x86_64
27+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
28+
CIBW_SKIP: pp*
29+
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
33+
path: ./wheelhouse/*.whl
34+
35+
build_sdist:
36+
name: Build source distribution
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
submodules: true
42+
43+
- name: Build sdist
44+
run: pipx run build --sdist
45+
46+
- uses: actions/upload-artifact@v4
47+
with:
48+
name: cibw-sdist
49+
path: dist/*.tar.gz
50+
51+
upload_pypi:
52+
needs: [build_wheels, build_sdist]
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/download-artifact@v4
56+
with:
57+
pattern: cibw-*
58+
path: dist
59+
merge-multiple: true
60+
61+
- uses: pypa/gh-action-pypi-publish@v1.12.2
62+
with:
63+
user: __token__
64+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/pypi-test.yml

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: Test the library
52

63
on:
74
push:
85
branches:
96
- master
10-
tags:
11-
- "*"
127
pull_request:
138

149
jobs:
1510
test:
1611
runs-on: ubuntu-latest
1712
strategy:
1813
matrix:
19-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
14+
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
2015

2116
name: Python ${{ matrix.python-version }}
2217
steps:
@@ -37,65 +32,3 @@ jobs:
3732
run: |
3833
pip install tox
3934
tox
40-
41-
build_wheels:
42-
name: Build wheels on ${{ matrix.os }}
43-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
44-
runs-on: ${{ matrix.os }}
45-
strategy:
46-
matrix:
47-
# macos-13 is an intel runner, higher macos's are apple silicon
48-
# At some point, maybe get this to work on windows-latest
49-
os: [ubuntu-latest, macos-13, macos-latest]
50-
51-
steps:
52-
- uses: actions/checkout@v4
53-
with:
54-
submodules: true
55-
56-
- name: Build wheels
57-
uses: pypa/cibuildwheel@v2.22.0
58-
env:
59-
CIBW_ARCHS_LINUX: x86_64
60-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
61-
CIBW_SKIP: pp*
62-
63-
- uses: actions/upload-artifact@v4
64-
with:
65-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
66-
path: ./wheelhouse/*.whl
67-
68-
build_sdist:
69-
name: Build source distribution
70-
runs-on: ubuntu-latest
71-
steps:
72-
- uses: actions/checkout@v4
73-
with:
74-
submodules: true
75-
76-
- name: Build sdist
77-
run: pipx run build --sdist
78-
79-
- uses: actions/upload-artifact@v4
80-
with:
81-
name: cibw-sdist
82-
path: dist/*.tar.gz
83-
84-
upload_pypi:
85-
needs: [test, build_wheels, build_sdist]
86-
runs-on: ubuntu-latest
87-
# upload to PyPI on every tag starting with 'v'
88-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
89-
# alternatively, to publish when a GitHub Release is created, use the following rule:
90-
# if: github.event_name == 'release' && github.event.action == 'published'
91-
steps:
92-
- uses: actions/download-artifact@v4
93-
with:
94-
pattern: cibw-*
95-
path: dist
96-
merge-multiple: true
97-
98-
- uses: pypa/gh-action-pypi-publish@v1.12.2
99-
with:
100-
user: __token__
101-
password: ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)