-
Notifications
You must be signed in to change notification settings - Fork 96
129 lines (108 loc) · 4.16 KB
/
ci-emscripten.yaml
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
# Attributed to NumPy https://github.com/numpy/numpy/pull/25894
# https://github.com/numpy/numpy/blob/d2d2c25fa81b47810f5cbd85ea6485eb3a3ffec3/.github/workflows/emscripten.yml
#
name: Pyodide CI
on:
# TODO: refine after this is ready to merge
[push, pull_request, workflow_dispatch]
env:
FORCE_COLOR: 3
# Disable instructions: AVX2 and SSE2 because Emscripten-specific SIMD
# support has not been implemented yet
DISABLE_NUMCODECS_AVX2: 1
DISABLE_NUMCODECS_SSE2: 1
# Common environment variables for both build and test jobs
PYODIDE_VERSION: 0.25.1
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
# The appropriate versions can be found in the Pyodide repodata.json
# "info" field, or in Makefile.envs:
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
PYTHON_VERSION: 3.11.3
EMSCRIPTEN_VERSION: 3.1.46
NODE_VERSION: 18
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build-wasm-emscripten:
name: Build numcodecs Pyodide distribution
runs-on: ubuntu-22.04
# To enable this workflow on a fork, comment out:
# FIXME: uncomment after this is ready to merge
# if: github.repository == 'zarr-developers/numcodecs'
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Emscripten toolchain
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache
- name: Apply necessary patch(es)
run: |
patch -p1 < tools/ci/patches/0001-disable-multiprocessing-and-pthreads.patch
patch -p1 < tools/ci/patches/0002-add-missing-unistd-headers.patch
- name: Install pyodide-build
run: python -m pip install "pydantic<2" "pyodide-build==${{ env.PYODIDE_VERSION }}"
- name: Build numcodecs for Pyodide
run: |
pyodide build
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Upload Pyodide wheel artifact
uses: actions/upload-artifact@v4
with:
name: numcodecs-pyodide-wheel
path: dist/*.whl
test-wasm-emscripten:
name: Test numcodecs Pyodide distribution
runs-on: ubuntu-22.04
needs: [build-wasm-emscripten]
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Checkout necessary patch(es)
uses: actions/checkout@v4
with:
sparse-checkout: tools/ci/patches/0003-fix-npy-file-access.patch
sparse-checkout-cone-mode: false
- name: Set up Emscripten toolchain
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache
- name: Apply necessary patch(es)
# We just need the third patch to fix the npy file access this time
run: patch -d $EMSDK/upstream/emscripten/ -p1 < tools/ci/patches/0003-fix-npy-file-access.patch
- name: Install pyodide-build
run: python -m pip install "pydantic<2" "pyodide-build==${{ env.PYODIDE_VERSION }}"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download Pyodide wheel artifact
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Set up Pyodide virtual environment and test numcodecs for Pyodide
run: |
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
python -m pip install dist/*.whl
python -m pip install pytest pytest-cov coverage
python -m pytest --pyargs numcodecs