-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (166 loc) · 6.93 KB
/
Copy pathbuild-matplotlib.yml
File metadata and controls
189 lines (166 loc) · 6.93 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
name: Build matplotlib wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'matplotlib version to build (git tag without leading v, e.g. 3.11.1)'
required: true
default: '3.11.1'
pull_request:
paths:
- '.github/workflows/build-matplotlib.yml'
- '.github/workflows/test-matplotlib.yml'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '3.11.1' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
# `inputs.version` is empty on pull_request events; default there.
MPL_VERSION: ${{ inputs.version || '3.11.1' }}
# Query PyPI + gitlab riscv64 mirror; pick best compatible wheel
# (`unsafe-best-match` = pip-like). Refuse sdist for dependencies so uv
# selects the gitlab riscv64 wheel when PyPI lacks one instead of falling
# back to a source build.
UV_EXTRA_INDEX_URL: https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
UV_INDEX_STRATEGY: unsafe-best-match
UV_ONLY_BINARY: ':all:'
jobs:
build_sdist:
name: Build matplotlib ${{ inputs.version || '3.11.1' }} sdist
runs-on: ubuntu-24.04-riscv
permissions:
contents: read
outputs:
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }}
steps:
- name: Checkout matplotlib v${{ env.MPL_VERSION }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: matplotlib/matplotlib
ref: v${{ env.MPL_VERSION }}
fetch-depth: 0
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: python-wheels
persist-credentials: false
- name: Install Python
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
# We need to patch the matplotlib source to increase a threading test
# timeout for the native runners
- name: patch matplotlib source
run: |
git apply python-wheels/patches/matplotlib/${{ env.MPL_VERSION }}/00*.patch
# Something changed somewhere that prevents the downloaded-at-build-time
# licenses from being included in built wheels, so pre-download them so
# that they exist before the build and are included.
- name: Pre-download bundled licenses
run: >
curl -Lo LICENSE/LICENSE_QHULL
https://github.com/qhull/qhull/raw/2020.2/COPYING.txt
- name: Install dependencies
run: uv pip install build twine
- name: Build sdist
id: sdist
run: |
python -m build --sdist
python ci/export_sdist_name.py
- name: Check README rendering for PyPI
run: twine check dist/*
- name: Upload sdist result
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: matplotlib-${{ env.MPL_VERSION }}-cibw-sdist
path: dist/*.tar.gz
if-no-files-found: error
build_wheels:
needs: build_sdist
name: Build matplotlib ${{ inputs.version || '3.11.1' }} wheels for riscv64
permissions:
contents: read
runs-on: ubuntu-24.04-riscv
steps:
- name: Checkout python-wheels
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: python-wheels
persist-credentials: false
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: matplotlib-${{ env.MPL_VERSION }}-cibw-sdist
path: dist/
- name: Build wheels for CPython 3.14
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp314-* cp314t-*"
CIBW_ARCHS: "riscv64"
# Skip musllinux: upstream matplotlib isn't building it either
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_ENVIRONMENT: >-
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
UV_INDEX_STRATEGY=unsafe-best-match
UV_ONLY_BINARY=:all:
- name: Build wheels for CPython 3.13
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp313-*"
CIBW_ARCHS: "riscv64"
# Skip musllinux: upstream matplotlib isn't building it either
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_ENVIRONMENT: >-
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
UV_INDEX_STRATEGY=unsafe-best-match
UV_ONLY_BINARY=:all:
- name: Build wheels for CPython 3.12
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: "riscv64"
# Skip musllinux: upstream matplotlib isn't building it either
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_ENVIRONMENT: >-
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
UV_INDEX_STRATEGY=unsafe-best-match
UV_ONLY_BINARY=:all:
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: matplotlib-${{ env.MPL_VERSION }}-cibw-wheels-riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish matplotlib ${{ inputs.version || '3.11.1' }} to GitLab
needs: build_wheels
# Only publish when the workflow was triggered from main with a specific
# version. Manual trigger is the only entry point that reaches main;
# PR runs sit on refs/pull/<n>/merge and skip this job.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Publish wheels and open docs PR
uses: riseproject-dev/python-wheels/actions/publish-wheels@main
with:
artifact-pattern: matplotlib-${{ env.MPL_VERSION }}-*-manylinux_riscv64
gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }}
gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }}
gh-token: ${{ secrets.GITHUB_TOKEN }}