Skip to content

Commit 5108aec

Browse files
CI: Update the release process
1 parent c086c6b commit 5108aec

3 files changed

Lines changed: 78 additions & 67 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 42 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,101 +13,77 @@ 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+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest]
2222

2323
steps:
2424
- uses: actions/checkout@v4
2525

2626
# 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
27+
- name: Build wheel
28+
uses: pypa/cibuildwheel@v3.0.1
5429
with:
55-
name: wheels
56-
path: wheelhouse/*.whl
30+
output-dir: wheelhouse
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: cibw-wheels-${{ matrix.os }}
34+
path: ./wheelhouse/*.whl
5735

58-
make_sdist:
36+
make-sdist:
5937
name: Make source distribution
6038
runs-on: ubuntu-latest
6139
steps:
6240
- 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)"
7141
- 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-
42+
run: source etc/make-libsemigroups.sh && sudo make install
8143
- name: Build SDist
8244
run: pipx run build --sdist
83-
84-
- uses: actions/upload-artifact@v2
45+
- uses: actions/upload-artifact@v4
8546
with:
8647
name: sdist
8748
path: dist/*.tar.gz
8849

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

100-
- name: Download sdist artifact
101-
uses: actions/download-artifact@v2
102-
with:
103-
name: sdist
76+
# Destination path
10477
path: dist
10578

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

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 }}
88+
- name: Publish package distributions to PyPI
89+
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: 24 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,30 @@ dev = [
10099
{ include-group = "docs" },
101100
]
102101

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

0 commit comments

Comments
 (0)