-
Notifications
You must be signed in to change notification settings - Fork 104
138 lines (118 loc) · 4.52 KB
/
wheels.yml
File metadata and controls
138 lines (118 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Wheel build
on:
release:
types: [created]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "42 3 * * 4"
push:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
permissions: {}
jobs:
sdist:
# Avoid Ubuntu 24.04 in sdist workflows, because it contains libxmlsec1-dev
# v1.2.39, which has a bug that causes tests/test_pkcs11.py to fail.
# (It thinks the softhsm engine has a public key instead of a private key.)
# libxmlsec1 <=1.2.33 or >=1.2.42 works. TODO: Try 26.04 when available.
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: "3.x"
- name: Install build dependencies
run: |
pip install --upgrade pip setuptools wheel
- name: Package source dist
run: python setup.py sdist
- name: Install test dependencies
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q libxml2-dev libxslt1-dev libxmlsec1-dev libxmlsec1-openssl opensc softhsm2 libengine-pkcs11-openssl
pip install --upgrade -r requirements-test.txt --no-binary lxml
pip install dist/xmlsec-$(python setup.py --version).tar.gz
- name: Run tests
run: pytest -v --color=yes
- name: Upload sdist
uses: actions/upload-artifact@v4.3.1
with:
name: sdist
path: dist/*.tar.gz
generate-wheels-matrix:
# Create a matrix of all architectures & versions to build.
# This enables the next step to run cibuildwheel in parallel.
# From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210
name: Generate wheels matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
# Nb. keep cibuildwheel version pin consistent with job below
run: pipx install cibuildwheel==3.1.4
- id: set-matrix
# Once we have the windows build figured out, it can be added here
# by updating the matrix to include windows builds as well.
# See example here:
# https://github.com/lxml/lxml/blob/3ccc7d583e325ceb0ebdf8fc295bbb7fc8cd404d/.github/workflows/wheels.yml#L95C1-L106C51
run: |
MATRIX=$(
{
cibuildwheel --print-build-identifiers --platform linux \
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos \
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --platform windows \
| jq -nRc '{"only": inputs, "os": "windows-2022"}' \
&& cibuildwheel --print-build-identifiers --platform windows --archs ARM64 \
| jq -nRc '{"only": inputs, "os": "windows-11-arm"}'
} | jq -sc
)
echo "include=$MATRIX"
echo "include=$MATRIX" >> $GITHUB_OUTPUT
build_wheels:
name: Build for ${{ matrix.only }}
needs: generate-wheels-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
env:
PYXMLSEC_LIBXML2_VERSION: 2.14.6
PYXMLSEC_LIBXSLT_VERSION: 1.1.43
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
with:
only: ${{ matrix.only }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4.3.1
with:
path: ./wheelhouse/*.whl
name: xmlsec-wheel-${{ matrix.only }}