Skip to content

Commit 3bd87e7

Browse files
committed
update github actions to use cibuildwheel
1 parent 384fc1f commit 3bd87e7

File tree

3 files changed

+91
-35
lines changed

3 files changed

+91
-35
lines changed

.github/workflows/build-docs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build documentation
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
test:
10+
name: Build docs
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.12
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.12
20+
cache: 'pip'
21+
22+
- name: Install Python dependencies
23+
run: |
24+
python -m pip install --upgrade pip setuptools
25+
pip install cmake pybind11 numpy tox
26+
27+
- name: Build docs
28+
run: |
29+
python setup.py build_ext --inplace
30+
cp build/lib*/biostrings/lib_biostrings* src/biostrings/
31+
tox -e docs
32+
touch ./docs/_build/html/.nojekyll
33+
34+
- name: GH Pages Deployment
35+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
branch: gh-pages # The branch the action should deploy to.
39+
folder: ./docs/_build/html
40+
clean: true # Automatically remove deleted files from the deploy branch

.github/workflows/publish-pypi.yml

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,64 @@ name: Publish to PyPI
22

33
on:
44
push:
5-
tags: "*"
5+
tags:
6+
- "*"
67

78
jobs:
8-
build:
9-
runs-on: ubuntu-latest
10-
permissions:
11-
id-token: write
12-
repository-projects: write
13-
contents: write
14-
pages: write
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]
1517

1618
steps:
17-
- uses: actions/checkout@v4
19+
- name: Check out repository
20+
uses: actions/checkout@v4
21+
22+
- name: Build wheels
23+
uses: pypa/[email protected]
24+
env:
25+
CIBW_ARCHS_LINUX: x86_64
26+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
27+
CIBW_SKIP: pp*
1828

19-
- name: Set up Python 3.12
20-
uses: actions/setup-python@v5
29+
- uses: actions/upload-artifact@v4
2130
with:
22-
python-version: 3.12
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl
2333

24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install tox
34+
build_sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
submodules: true
2841

29-
- name: Test with tox
30-
run: |
31-
tox
42+
- name: Build sdist
43+
run: pipx run build --sdist
3244

33-
- name: Build Project and Publish
34-
run: |
35-
python -m tox -e clean,build
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: cibw-sdist
48+
path: dist/*.tar.gz
49+
50+
upload_pypi:
51+
needs: [build_wheels, build_sdist]
52+
runs-on: ubuntu-latest
53+
permissions:
54+
id-token: write
55+
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
pattern: cibw-*
60+
path: dist
61+
merge-multiple: true
3662

3763
# This uses the trusted publisher workflow so no token is required.
3864
- name: Publish to PyPI
3965
uses: pypa/gh-action-pypi-publish@release/v1
40-
41-
- name: Build docs
42-
run: |
43-
tox -e docs
44-
45-
- run: touch ./docs/_build/html/.nojekyll
46-
47-
- name: GH Pages Deployment
48-
uses: JamesIves/github-pages-deploy-action@v4
49-
with:
50-
branch: gh-pages # The branch the action should deploy to.
51-
folder: ./docs/_build/html
52-
clean: true # Automatically remove deleted files from the deploy branch

.github/workflows/run-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
python -m pip install --upgrade pip
4949
pip install tox coverage
5050
51+
- name: Get latest CMake
52+
uses: lukka/get-cmake@latest
53+
5154
- name: Run tests
5255
run: >-
5356
pipx run --python '${{ steps.setup-python.outputs.python-path }}'

0 commit comments

Comments
 (0)