8000 ci: Add a build for wasm · matplotlib/matplotlib@83191d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83191d5

Browse 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 2f92b80 commit 83191d5

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/wasm.yml

Lines 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@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- uses: actions/setup-python@v5
45+
name: Install Python
46+
with:
47+
python-version: '3.12'
48+
49+
- name: Build wheels for wasm
50+
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
51+
env:
52+
CIBW_PLATFORM: "pyodide"
53+
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }}
57+
path: ./wheelhouse/*.whl
58+
if-no-files-found: error

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,17 @@ testpaths = ["lib"]
318318
addopts = [
319319
"--import-mode=importlib",
320320
]
321+
322+
# This build is just for testing right now.
323+
[tool.cibuildwheel.pyodide]
324+
build-frontend = "build; args: --exports whole_archive"
325+
test-requires = "pytest"
326+
test-command = "pytest -p no:cacheprovider --pyargs matplotlib --maxfail=50 -v"
327+
[tool.cibuildwheel.pyodide.config-settings]
328+
install-args = "--tags=data,python-runtime,runtime,tests"
329+
[tool.cibuildwheel.pyodide.environment]
330+
# Exceptions are needed for pybind11:
331+
# https://github.com/pybind/pybind11/pull/5298
332+
CFLAGS = "-fexceptions"
333+
CXXFLAGS = "-fexceptions"
334+
LDFLAGS = "-fexceptions"

0 commit comments

Comments
 (0)
0