Repository navigation
166 lines (145 loc) · 5.14 KB
/
Copy pathbuild-cffi.yml
File metadata and controls
166 lines (145 loc) · 5.14 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
name: Build cffi wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/cffi.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-cffi.yml'
- 'docs/packages/cffi.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-cffi.yml'
- 'docs/packages/cffi.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY: unsafe-best-match
UV_ONLY_BINARY: ':all:'
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: cffi
version: ${{ inputs.version }}
python_sdist:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
runs-on: ubuntu-24.04-riscv
env:
CFFI_VERSION: ${{ matrix.version }}
steps:
- name: checkout cffi
uses: actions/checkout@v7
with:
repository: python-cffi/cffi
ref: v${{ env.CFFI_VERSION }}
submodules: true
persist-credentials: false
- name: setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
- name: build sdist
run: |
rm -rf dist/
uv pip install build
python -m build --sdist
- name: upload sdist artifact
uses: actions/upload-artifact@v7
with:
name: cffi-${{ env.CFFI_VERSION }}-sdist
path: dist/*.tar.gz
if-no-files-found: error
# always upload the sdist artifact- all the wheel build jobs require it
linux:
# Unlike upstream, we depend only on python_sdist, since we don't need to
# build a large matrix of targets
needs: [setup, python_sdist]
if: needs.setup.outputs.versions != '[]'
name: Build cffi ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
python: ["cp312", "cp313", "cp314", "cp314t"]
env:
CFFI_VERSION: ${{ matrix.version }}
steps:
- name: fetch sdist artifact
id: fetch_sdist
uses: actions/download-artifact@v8
with:
name: cffi-${{ env.CFFI_VERSION }}-sdist
- name: setup uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
- name: build/test wheels
id: build
env:
CFLAGS: -Dffi_call=cffistatic_ffi_call # override name for ffi_call to break hard if we linked against someone else's libffi
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
CIBW_ENVIRONMENT_PASS_LINUX: CFLAGS # ensure that the build container can see our overridden build config
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_BEFORE_BUILD: |
set -eux && \
curl -L -O https://github.com/libffi/libffi/archive/v3.4.6.tar.gz && \
tar zxf v3.4.6.tar.gz && cd libffi-3.4.6 && \
((command -v apk && apk add libtool) || true) && \
./autogen.sh && \
./configure --without-gcc-arch --disable-docs --with-pic --enable-shared=no && \
make install && \
cd .. && \
rm -rf libffi-3.4.6
CIBW_TEST_REQUIRES: pytest setuptools meson-python ninja # 3.12+ no longer includes distutils, just always ensure setuptools is present
CIBW_TEST_COMMAND: PYTHONUNBUFFERED=1 python -m pytest {project}
run: |
set -eux
mkdir cffi
tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi
uv pip install --upgrade cibuildwheel
# actually build libffi + wheel (using env tweaks above)
python -m cibuildwheel --output-dir dist ./cffi
echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cffi-${{ env.CFFI_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: ./dist/*.whl
if-no-files-found: error
publish:
name: Publish cffi ${{ matrix.version }}
needs: [setup, linux]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
secrets:
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
with:
artifact-pattern: cffi-${{ matrix.version }}-*-manylinux_riscv64