Skip to content

Commit 6526f2c

Browse files
CI: Update the release process
1 parent 598c8d5 commit 6526f2c

3 files changed

Lines changed: 80 additions & 67 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 43 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,101 +13,78 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
build_wheels:
16+
build-wheels:
1717
name: Build wheels on ${{ matrix.os }}
1818
runs-on: ${{ matrix.os }}
1919
strategy:
2020
matrix:
21-
os: [ubuntu-20.04, macOS-11, macOS-12]
21+
# macos-13 is an intel runner, macos-14 is apple silicon
22+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14]
2223

2324
steps:
2425
- uses: actions/checkout@v4
2526

2627
# Used to host cibuildwheel
27-
- uses: actions/setup-python@v2
28-
- name: Install pkgconfig
29-
run: python -m pip install pkgconfig
30-
- name: Install packaging
31-
run: python -m pip install packaging
32-
- name: Get libsemigroups version
33-
id: libsemigroups_version
34-
run: echo "::set-output name=version::$(python etc/libsemigroups_version.py)"
35-
- name: Install cibuildwheel
36-
run: python -m pip install cibuildwheel==2.11.3
37-
38-
- name: Build wheels
39-
env:
40-
CIBW_BEFORE_ALL: >
41-
curl -L -O https://github.com/libsemigroups/libsemigroups/releases/download/v${{ steps.libsemigroups_version.outputs.version }}/libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
42-
43-
tar -xf libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
44-
rm -f libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
45-
cd libsemigroups-${{ steps.libsemigroups_version.outputs.version }} &&
46-
./configure --disable-hpcombi &&
47-
make -j4 && make install
48-
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig
49-
CIBW_ARCHS_MACOS: x86_64
50-
51-
run: python -m cibuildwheel --output-dir wheelhouse
52-
53-
- uses: actions/upload-artifact@v2
28+
- name: Build wheel
29+
uses: pypa/cibuildwheel@v3.1.3
5430
with:
55-
name: wheels
56-
path: wheelhouse/*.whl
31+
output-dir: wheelhouse
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: cibw-wheels-${{ matrix.os }}
35+
path: ./wheelhouse/*.whl
5736

58-
make_sdist:
37+
make-sdist:
5938
name: Make source distribution
6039
runs-on: ubuntu-latest
6140
steps:
6241
- uses: actions/checkout@v4
63-
- uses: actions/setup-python@v2
64-
- name: Install pkgconfig
65-
run: python -m pip install pkgconfig
66-
- name: Install packaging
67-
run: python -m pip install packaging
68-
- name: Get libsemigroups version
69-
id: libsemigroups_version
70-
run: echo "::set-output name=version::$(python etc/libsemigroups_version.py)"
7142
- name: Install libsemigroups
72-
run: |
73-
curl -L -O https://github.com/libsemigroups/libsemigroups/releases/download/v${{ steps.libsemigroups_version.outputs.version }}/libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
74-
75-
tar -xf libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
76-
rm -f libsemigroups-${{ steps.libsemigroups_version.outputs.version }}.tar.gz &&
77-
cd libsemigroups-${{ steps.libsemigroups_version.outputs.version }} &&
78-
./configure --disable-hpcombi &&
79-
make -j4 && sudo make install
80-
43+
run: source etc/make-libsemigroups.sh && sudo make install
8144
- name: Build SDist
8245
run: pipx run build --sdist
83-
84-
- uses: actions/upload-artifact@v2
46+
- uses: actions/upload-artifact@v4
8547
with:
8648
name: sdist
8749
path: dist/*.tar.gz
8850

89-
upload:
51+
# TODO(1): Add a TestPyPI step
52+
53+
publish-to-pypi:
9054
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
91-
needs: [build_wheels, make_sdist]
55+
name: Publish Python distribution to PyPI
56+
needs:
57+
- build-wheels
58+
- make-sdist
9259
runs-on: ubuntu-latest
60+
# TODO(1): Uncomment below and configure a publishing environment
61+
# See https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
62+
# environment:
63+
# name: pypi
64+
# url: https://pypi.org/p/libsemigroups-pybind11/
65+
permissions:
66+
id-token: write
67+
9368
steps:
94-
- name: Download wheels artifact
95-
uses: actions/download-artifact@v2
69+
- name: Download wheels and sdist artifacts
70+
uses: actions/download-artifact@v4
9671
with:
97-
name: wheels
98-
path: dist
72+
# Here, we could specify a name of an artifact, or a pattern that
73+
# matches the names of artifacts. However, by not specifying these
74+
# values, all of the artifacts from this run are downloaded (which is
75+
# what we want).
9976

100-
- name: Download sdist artifact
101-
uses: actions/download-artifact@v2
102-
with:
103-
name: sdist
77+
# Destination path
10478
path: dist
10579

80+
# If true, the downloaded artifacts will be in the same directory
81+
# specified by path.
82+
# If false, the downloaded artifacts will be extracted into individual
83+
# named directories within the specified path.'
84+
merge-multiple: true
85+
10686
- name: List directory contents
10787
run: ls dist
10888

109-
- name: Publish
110-
uses: pypa/gh-action-pypi-publish@v1.4.2
111-
with:
112-
user: ${{ secrets.PYPI_USERNAME }}
113-
password: ${{ secrets.PYPI_PASSWORD }}
89+
- name: Publish package distributions to PyPI
90+
uses: pypa/gh-action-pypi-publish@release/v1

etc/make-libsemigroups.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# If a command fails, exit this script with an error code
4+
set -e
5+
set -o pipefail
6+
7+
VERSION=$(python etc/libsemigroups_version.py)
8+
curl -L -O https://github.com/libsemigroups/libsemigroups/releases/download/v$VERSION/libsemigroups-$VERSION.tar.gz
9+
tar -xf libsemigroups-$VERSION.tar.gz
10+
rm -f libsemigroups-$VERSION.tar.gz
11+
cd libsemigroups-$VERSION
12+
./configure --disable-hpcombi && make -j4

pyproject.toml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# TODO:
2-
# * Run check-manifest and populate MANIFEST.in
32
# * Use ruff
43
# * Decide on good configurations for tools
54
# * Remove requirements.txt
@@ -100,6 +99,31 @@ docs = [
10099
]
101100
test = ["pytest==8.4.1"]
102101

102+
[tool.cibuildwheel]
103+
build-frontend = "build"
104+
build-verbosity = 1
105+
skip = "cp314*"
106+
test-command = "pytest {project}/tests"
107+
test-groups = ["test"]
108+
109+
[tool.cibuildwheel.linux]
110+
before-all = ["source {project}/etc/make-libsemigroups.sh", "make install"]
111+
112+
113+
[tool.cibuildwheel.linux.environment]
114+
CXX = "g++"
115+
CXXFLAGS = "-O2"
116+
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:/usr/lib:/usr/local/lib"
117+
PKG_CONFIG_PATH = "$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig"
118+
119+
[tool.cibuildwheel.macos]
120+
before-all = ["source {project}/etc/make-libsemigroups.sh", "sudo make install"]
121+
122+
[tool.cibuildwheel.macos.environment]
123+
CXX = "clang++"
124+
CXXFLAGS = "-O2"
125+
MACOSX_DEPLOYMENT_TARGET = "11.0"
126+
103127
[tool.codespell]
104128
ignore-multiline-regex = "codespell:begin-ignore.*codespell:end-ignore"
105129
ignore-words-list = "nd,toword,groupe,theses"

0 commit comments

Comments
 (0)