Skip to content

Commit c66e806

Browse files
committed
Update CI to build wheels for linux + osx with cibuildwheel
1 parent 802dff2 commit c66e806

10 files changed

+243
-209
lines changed

.github/workflows/linuxbrew.yml

-34
This file was deleted.

.github/workflows/macosx.yml

-44
This file was deleted.

.github/workflows/manylinux.yml

-48
This file was deleted.

.github/workflows/opensuse-tumbleweed.yml

-29
This file was deleted.

.github/workflows/sdist.yml

-26
This file was deleted.

.github/workflows/wheels.yml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Wheel build
2+
3+
on:
4+
release:
5+
types: [created]
6+
schedule:
7+
# ┌───────────── minute (0 - 59)
8+
# │ ┌───────────── hour (0 - 23)
9+
# │ │ ┌───────────── day of the month (1 - 31)
10+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
11+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
12+
# │ │ │ │ │
13+
- cron: "42 3 * * 4"
14+
push:
15+
pull_request:
16+
workflow_dispatch:
17+
18+
permissions: {}
19+
20+
jobs:
21+
sdist:
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: write
26+
27+
steps:
28+
- uses: actions/[email protected]
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Python
33+
uses: actions/[email protected]
34+
with:
35+
python-version: "3.x"
36+
37+
- name: Install build dependencies
38+
run: |
39+
pip install --upgrade pip setuptools wheel
40+
41+
- name: Package source dist
42+
run: python setup.py sdist
43+
44+
- name: Install test dependencies
45+
run: |
46+
sudo apt-get update -y -q
47+
sudo apt-get install -y -q libxml2-dev libxslt1-dev libxmlsec1-dev libxmlsec1-openssl opensc softhsm2 libengine-pkcs11-openssl
48+
pip install --upgrade -r requirements-test.txt --no-binary lxml
49+
pip install dist/xmlsec-$(python setup.py --version).tar.gz
50+
51+
- name: Run tests
52+
run: pytest -v --color=yes
53+
54+
- name: Upload sdist
55+
uses: actions/[email protected]
56+
with:
57+
name: sdist
58+
path: dist/*.tar.gz
59+
60+
generate-wheels-matrix:
61+
# Create a matrix of all architectures & versions to build.
62+
# This enables the next step to run cibuildwheel in parallel.
63+
# From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210
64+
name: Generate wheels matrix
65+
runs-on: ubuntu-latest
66+
outputs:
67+
include: ${{ steps.set-matrix.outputs.include }}
68+
steps:
69+
- uses: actions/checkout@v4
70+
- name: Install cibuildwheel
71+
# Nb. keep cibuildwheel version pin consistent with job below
72+
run: pipx install cibuildwheel==2.16.5
73+
- id: set-matrix
74+
# Once we have the windows build figured out, it can be added here
75+
# by updating the matrix to include windows builds as well.
76+
# See example here:
77+
# https://github.com/lxml/lxml/blob/3ccc7d583e325ceb0ebdf8fc295bbb7fc8cd404d/.github/workflows/wheels.yml#L95C1-L106C51
78+
run: |
79+
MATRIX=$(
80+
{
81+
cibuildwheel --print-build-identifiers --platform linux \
82+
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
83+
&& cibuildwheel --print-build-identifiers --platform macos \
84+
| jq -nRc '{"only": inputs, "os": "macos-latest"}'
85+
} | jq -sc
86+
)
87+
echo "include=$MATRIX"
88+
echo "include=$MATRIX" >> $GITHUB_OUTPUT
89+
90+
build_wheels:
91+
name: Build for ${{ matrix.only }}
92+
needs: generate-wheels-matrix
93+
runs-on: ${{ matrix.os }}
94+
95+
strategy:
96+
fail-fast: false
97+
matrix:
98+
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
99+
100+
steps:
101+
- name: Check out the repo
102+
uses: actions/checkout@v4
103+
with:
104+
fetch-depth: 0
105+
106+
- name: Set up QEMU
107+
if: runner.os == 'Linux'
108+
uses: docker/setup-qemu-action@v3
109+
with:
110+
platforms: all
111+
112+
- name: Build wheels
113+
uses: pypa/[email protected]
114+
with:
115+
only: ${{ matrix.only }}
116+
117+
- uses: actions/[email protected]
118+
with:
119+
path: ./wheelhouse/*.whl
120+
name: xmlsec-wheel-${{ matrix.only }}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
*.pyo
1515
*.egg*
1616
*.so
17+
18+
# Built wheels
19+
/wheelhouse
20+
/libs

pyproject.toml

+28-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,31 @@ known_first_party = ['xmlsec']
4444
known_third_party = ['lxml', 'pytest', '_pytest', 'hypothesis']
4545

4646
[build-system]
47-
requires = ['setuptools>=42', 'wheel', 'setuptools_scm[toml]>=3.4', "pkgconfig>=1.5.1", "lxml>=3.8, !=4.7.0"]
47+
requires = ['setuptools>=42', 'wheel', 'setuptools_scm[toml]>=3.4', "pkgconfig>=1.5.1", "lxml>=5.0.0"]
48+
49+
[tool.cibuildwheel]
50+
build-verbosity = 1
51+
build-frontend = "build"
52+
skip = ["pp*", "*-musllinux_i686"]
53+
test-command = "pytest -v --color=yes {package}/tests"
54+
before-test = "pip install -r requirements-test.txt"
55+
test-skip = "*-macosx_arm64"
56+
57+
[tool.cibuildwheel.environment]
58+
PYXMLSEC_LIBXML2_VERSION = "2.12.3"
59+
PYXMLSEC_LIBXSLT_VERSION = "1.1.39"
60+
PYXMLSEC_STATIC_DEPS = "true"
61+
62+
[tool.cibuildwheel.linux]
63+
archs = ["x86_64", "aarch64", "i686"]
64+
environment-pass = [
65+
"PYXMLSEC_LIBXML2_VERSION",
66+
"PYXMLSEC_LIBXSLT_VERSION",
67+
"PYXMLSEC_STATIC_DEPS"
68+
]
69+
70+
[tool.cibuildwheel.windows]
71+
archs = ["AMD64", "x86"]
72+
73+
[tool.cibuildwheel.macos]
74+
archs = ["x86_64", "arm64"]

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lxml >= 3.8.0, !=4.7.0
1+
lxml >= 5.0.0

0 commit comments

Comments
 (0)