Skip to content

Commit dd18448

Browse files
FEAT add wasm wheel in cibw (#95)
* FEAT add wasm wheel in cibw
1 parent 4e55ef8 commit dd18448

File tree

7 files changed

+546
-562
lines changed

7 files changed

+546
-562
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,11 @@ jobs:
1111
call-test:
1212
uses: ./.github/workflows/test.yml
1313
secrets: inherit
14-
15-
build-sdist:
16-
runs-on: ubuntu-latest
17-
needs: call-test
18-
steps:
19-
- uses: actions/checkout@v4
20-
- uses: prefix-dev/[email protected]
21-
with:
22-
environments: dev
23-
cache: true
24-
- name: Re-install local
25-
run: |
26-
pixi reinstall -e dev --frozen fastcan
27-
- name: Build SDist
28-
run: |
29-
pixi run build-sdist
30-
- name: Store artifacts
31-
uses: actions/upload-artifact@v4
32-
with:
33-
name: cibw-sdist
34-
path: dist/*.tar.gz
3514

36-
build-wheels:
37-
strategy:
38-
fail-fast: false
39-
matrix:
40-
os: [ubuntu-latest, windows-latest, macos-latest]
41-
runs-on: ${{ matrix.os }}
15+
call-wasm-wheel:
16+
needs: call-test
17+
uses: ./.github/workflows/emscripten.yml
18+
19+
call-wheel:
4220
needs: call-test
43-
steps:
44-
- uses: actions/checkout@v4
45-
- name: Build wheels
46-
uses: pypa/[email protected]
47-
env:
48-
CIBW_BUILD: cp3*-*
49-
CIBW_SKIP: pp* *i686* *musllinux* *-macosx_universal2 *-manylinux_ppc64le *-manylinux_s390x
50-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
51-
CIBW_ARCHS_LINUX: auto64
52-
CIBW_ARCHS_MACOS: x86_64 arm64
53-
CIBW_ARCHS_WINDOWS: auto64
54-
CIBW_BEFORE_ALL_LINUX: yum install -y ninja-build python3-devel
55-
# Needed on Windows CI to compile with Visual Studio compiler
56-
# otherwise Meson detects a MINGW64 platform and use MINGW64
57-
# toolchain
58-
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
59-
# Include free-threaded support
60-
CIBW_ENABLE: cpython-freethreading
61-
# Numpy, scipy, Cython only have free-threaded wheels on scientific-python-nightly-wheels
62-
CIBW_BUILD_FRONTEND: 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" --only-binary :all:'
63-
- name: Upload package
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
67-
path: ./wheelhouse/*.whl
21+
uses: ./.github/workflows/wheel.yml

.github/workflows/emscripten.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Emscripten/Pyodide build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-wasm-wheel:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Build WASM wheel
12+
uses: pypa/[email protected]
13+
env:
14+
CIBW_PLATFORM: pyodide
15+
- name: Upload package
16+
uses: actions/upload-artifact@v4
17+
with:
18+
name: wasm_wheel
19+
path: ./wheelhouse/*_wasm32.whl
20+
if-no-files-found: error

.github/workflows/publish-pypi.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ jobs:
2121
with:
2222
path: dist/
2323
merge-multiple: true
24+
pattern: cibw-*
2425

2526
- name: Publish distribution to PyPI
27+
if: github.event.release.prerelease == false
2628
uses: pypa/gh-action-pypi-publish@release/v1
29+
30+
- name: get wasm dist artifacts
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: wasm_wheel
34+
path: wasm/
35+
36+
- name: upload to github release
37+
uses: softprops/action-gh-release@v2
38+
with:
39+
files: |
40+
wasm/*.whl
41+
prerelease: ${{ contains(github.ref, '-pre') }}

.github/workflows/wheel.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Wheel build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-sdist:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: prefix-dev/[email protected]
12+
with:
13+
environments: dev
14+
cache: true
15+
- name: Re-install local
16+
run: |
17+
pixi reinstall -e dev --frozen fastcan
18+
- name: Build SDist
19+
run: |
20+
pixi run build-sdist
21+
- name: Store artifacts
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: cibw-sdist
25+
path: dist/*.tar.gz
26+
27+
build-wheels:
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: [ubuntu-latest, windows-latest, macos-latest]
32+
runs-on: ${{ matrix.os }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Build wheels
36+
uses: pypa/[email protected]
37+
env:
38+
CIBW_BUILD: cp3*-*
39+
CIBW_SKIP: pp* *i686* *musllinux* *-macosx_universal2 *-manylinux_ppc64le *-manylinux_s390x
40+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
41+
CIBW_ARCHS_LINUX: auto64
42+
CIBW_ARCHS_MACOS: x86_64 arm64
43+
CIBW_ARCHS_WINDOWS: auto64
44+
CIBW_BEFORE_ALL_LINUX: yum install -y ninja-build python3-devel
45+
# Needed on Windows CI to compile with Visual Studio compiler
46+
# otherwise Meson detects a MINGW64 platform and use MINGW64
47+
# toolchain
48+
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
49+
# Include free-threaded support
50+
CIBW_ENABLE: cpython-freethreading
51+
# Numpy, scipy, Cython only have free-threaded wheels on scientific-python-nightly-wheels
52+
CIBW_BUILD_FRONTEND: 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" --only-binary :all:'
53+
- name: Upload package
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
57+
path: ./wheelhouse/*.whl

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project(
22
'fastcan',
33
'c', 'cython',
4-
version: '0.3.2',
4+
version: '0.4.0',
55
license: 'MIT',
66
meson_version: '>= 1.1.0',
77
default_options: [

0 commit comments

Comments
 (0)