-
Notifications
You must be signed in to change notification settings - Fork 9
152 lines (120 loc) · 4.45 KB
/
main.yml
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
name: CI
on:
workflow_dispatch:
push:
pull_request:
defaults:
run:
shell: bash -l {0}
jobs:
test-browser:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- emsdk_ver: "3.1.45"
python_version: "3.11"
pybind11_version: "<2.12.0"
# - emsdk_ver: "3.1.58"
# python_version: "3.12"
# pybind11_version: ""
steps:
- uses: actions/checkout@v2
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev_${{matrix.emsdk_ver}}.yml
environment-name: pyjs-wasm
condarc: |
channels:
- https://repo.mamba.pm/emscripten-forge
- conda-forge
- name: Install Playwright
run: |
playwright install
- name: Build pyjs
run: |
micromamba activate pyjs-wasm
# emsdk activate ${{matrix.emsdk_ver}}
# source $(pwd)/emsdk_install/emsdk_env.sh
micromamba create -n pyjs-build-wasm \
--platform=emscripten-wasm32 \
-c https://repo.mamba.pm/emscripten-forge \
-c https://repo.mamba.pm/conda-forge \
--yes \
python=${{matrix.python_version}} "pybind11${{matrix.pybind11_version}}" nlohmann_json pybind11_json "numpy<2" "pytest==7.1.1" bzip2 sqlite zlib zstd libffi exceptiongroup emscripten-abi==${{matrix.emsdk_ver}}
mkdir build
pushd build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm
export CMAKE_PREFIX_PATH=$PREFIX
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
# build pyjs
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DBUILD_RUNTIME_BROWSER=ON \
-DBUILD_RUNTIME_NODE=OFF \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
..
make -j2
make install
popd
- name: setup env with numpy
run: |
micromamba activate pyjs-wasm
micromamba create -n pyjs-build-wasm \
--platform=emscripten-wasm32 \
-c https://repo.mamba.pm/emscripten-forge \
-c https://repo.mamba.pm/conda-forge \
--yes \
"python=${{matrix.python_version}}" "pytest==7.1.1" "numpy<2" exceptiongroup
- name: Test in browser-main
run: |
micromamba activate pyjs-wasm
pyjs_code_runner run script \
browser-main \
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm \
--mount $(pwd)/tests:/tests \
--mount $(pwd)/module/pyjs:/lib/python3.11/site-packages/pyjs \
--script main.py \
--work-dir /tests \
--pyjs-dir $(pwd)/build \
--headless \
--async-main
- name: Test in browser-worker
run: |
micromamba activate pyjs-wasm
pyjs_code_runner run script \
browser-worker \
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm \
--mount $(pwd)/tests:/tests \
--mount $(pwd)/module/pyjs:/lib/python3.11/site-packages/pyjs \
--script main.py \
--work-dir /tests \
--pyjs-dir $(pwd)/build \
--headless \
--async-main
- name: setup minimal env without numpy
run: |
micromamba activate pyjs-wasm
micromamba create -n pyjs-build-wasm \
--platform=emscripten-wasm32 \
-c https://repo.mamba.pm/emscripten-forge \
-c https://repo.mamba.pm/conda-forge \
--yes \
"python=${{matrix.python_version}}" "pytest==7.1.1" exceptiongroup
- name: Test in browser-main-no-numpy
run: |
micromamba activate pyjs-wasm
pyjs_code_runner run script \
browser-main \
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm \
--mount $(pwd)/tests:/tests \
--mount $(pwd)/module/pyjs:/lib/python3.11/site-packages/pyjs \
--script main.py \
--work-dir /tests \
--pyjs-dir $(pwd)/build \
--headless \
--async-main \
--no-cache