Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b11bcde

Browse filesBrowse files
committed
ci: Add a build for wasm
This adds a `pyproject.toml` config for it, so you can replicate locally with cibuildwheel.
1 parent 2ac1fd2 commit b11bcde
Copy full SHA for b11bcde

File tree

4 files changed

+101
-21
lines changed
Filter options

4 files changed

+101
-21
lines changed

‎.github/labeler.yml

Copy file name to clipboardExpand all lines: .github/labeler.yml
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
"CI: Run cibuildwheel":
33
- changed-files:
4-
- any-glob-to-any-file: ['.github/workflows/cibuildwheel.yml']
4+
- any-glob-to-any-file:
5+
- '.github/workflows/cibuildwheel.yml'
6+
- '.github/workflows/wasm.yml'
57
"CI: Run cygwin":
68
- changed-files:
79
- any-glob-to-any-file: ['.github/workflows/cygwin.yml']

‎.github/workflows/nightlies.yml

Copy file name to clipboardExpand all lines: .github/workflows/nightlies.yml
+20-20Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ jobs:
3131
run: |
3232
PROJECT_REPO="matplotlib/matplotlib"
3333
BRANCH="main"
34-
WORKFLOW_NAME="cibuildwheel.yml"
3534
ARTIFACT_PATTERN="cibw-wheels-*"
3635
37-
gh run --repo "${PROJECT_REPO}" \
38-
list --branch "${BRANCH}" \
39-
--workflow "${WORKFLOW_NAME}" \
40-
--json event,status,conclusion,databaseId > runs.json
41-
RUN_ID=$(
42-
jq --compact-output \
43-
'[
44-
.[] |
45-
# Filter on "push" events to main (merged PRs) ...
46-
select(.event == "push") |
47-
# that have completed successfully ...
48-
select(.status == "completed" and .conclusion == "success")
49-
] |
50-
# and get ID of latest build of wheels.
51-
sort_by(.databaseId) | reverse | .[0].databaseId' runs.json
52-
)
53-
gh run --repo "${PROJECT_REPO}" view "${RUN_ID}"
54-
gh run --repo "${PROJECT_REPO}" \
55-
download "${RUN_ID}" --pattern "${ARTIFACT_PATTERN}"
36+
for WORKFLOW_NAME in cibuildwheel.yml wasm.yml; do
37+
gh run --repo "${PROJECT_REPO}" \
38+
list --branch "${BRANCH}" \
39+
--workflow "${WORKFLOW_NAME}" \
40+
--json event,status,conclusion,databaseId > runs.json
41+
RUN_ID=$(
42+
jq --compact-output \
43+
'[
44+
.[] |
45+
# Filter on "push" events to main (merged PRs) ...
46+
select(.event == "push") |
47+
# that have completed successfully ...
48+
select(.status == "completed" and .conclusion == "success")
49+
] |
50+
# and get ID of latest build of wheels.
51+
sort_by(.databaseId) | reverse | .[0].databaseId' runs.json
52+
)
53+
gh run --repo "${PROJECT_REPO}" view "${RUN_ID}"
54+
gh run --repo "${PROJECT_REPO}" download "${RUN_ID}" --pattern "${ARTIFACT_PATTERN}"
55+
done
5656
5757
mkdir dist
5858
mv ${ARTIFACT_PATTERN}/*.whl dist/

‎.github/workflows/wasm.yml

Copy file name to clipboard
+58Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: Build wasm wheels
3+
4+
on:
5+
# Save CI by only running this on release branches or tags.
6+
push:
7+
branches:
8+
- main
9+
- v[0-9]+.[0-9]+.x
10+
tags:
11+
- v*
12+
# Also allow running this action on PRs if requested by applying the
13+
# "Run cibuildwheel" label.
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
- labeled
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
build_wasm:
26+
if: >-
27+
github.event_name == 'push' ||
28+
github.event_name == 'pull_request' && (
29+
(
30+
github.event.action == 'labeled' &&
31+
github.event.label.name == 'CI: Run cibuildwheel'
32+
) ||
33+
contains(github.event.pull_request.labels.*.name,
34+
'CI: Run cibuildwheel')
35+
)
36+
name: Build wasm
37+
runs-on: ubuntu-24.04
38+
39+
steps:
40+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
fetch-depth: 0
43+
44+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
45+
name: Install Python
46+
with:
47+
python-version: '3.13'
48+
49+
- name: Build wheels for wasm
50+
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
51+
env:
52+
CIBW_PLATFORM: "pyodide"
53+
54+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
55+
with:
56+
name: cibw-wheels-wasm
57+
path: ./wheelhouse/*.whl
58+
if-no-files-found: error

‎pyproject.toml

Copy file name to clipboardExpand all lines: pyproject.toml
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,23 @@ testpaths = ["lib"]
340340
addopts = [
341341
"--import-mode=importlib",
342342
]
343+
344+
[tool.cibuildwheel.pyodide]
345+
test-requires = "pytest"
346+
test-command = [
347+
# Wheels are built without test images, so copy them into the testing directory.
348+
"basedir=$(python -c 'import pathlib, matplotlib; print(pathlib.Path(matplotlib.__file__).parent.parent)')",
349+
"cp -a {package}/lib/matplotlib/tests/data $basedir/matplotlib/tests/",
350+
"""
351+
for subdir in matplotlib mpl_toolkits/axes_grid1 mpl_toolkits/axisartist mpl_toolkits/mplot3d; do
352+
cp -a {package}/lib/${subdir}/tests/baseline_images $basedir/${subdir}/tests/
353+
done""",
354+
# Test installed, not repository, copy as we aren't using an editable install.
355+
"pytest -p no:cacheprovider --pyargs matplotlib mpl_toolkits.axes_grid1 mpl_toolkits.axisartist mpl_toolkits.mplot3d",
356+
]
357+
[tool.cibuildwheel.pyodide.environment]
358+
# Exceptions are needed for pybind11:
359+
# https://github.com/pybind/pybind11/pull/5298
360+
CFLAGS = "-fexceptions"
361+
CXXFLAGS = "-fexceptions"
362+
LDFLAGS = "-fexceptions"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.