Skip to content

Commit 955787c

Browse files
committed
wasm ci
1 parent f1052f4 commit 955787c

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed

.github/workflows/main.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,109 @@ jobs:
7171
- name: Test xeus-sqlite (C++)
7272
run: ./test_xeus_sqlite
7373
working-directory: build/test
74+
75+
76+
emscripten_wasm_build:
77+
78+
runs-on: ubuntu-latest
79+
80+
strategy:
81+
fail-fast: false
82+
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Get number of CPU cores
88+
uses: SimenB/github-actions-cpu-cores@v2
89+
90+
- name: Install micromamba
91+
uses: mamba-org/setup-micromamba@v1
92+
with:
93+
environment-file: environment-wasm-build.yml
94+
environment-name: xeus-sqlite-wasm-build
95+
96+
################################################################
97+
# C++ build
98+
################################################################
99+
- name: Build
100+
shell: bash -l {0}
101+
run: |
102+
103+
104+
105+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 --yes
106+
107+
mkdir build
108+
pushd build
109+
110+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-sqlite-wasm-host
111+
export CMAKE_PREFIX_PATH=$PREFIX
112+
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
113+
114+
emcmake cmake \
115+
-DCMAKE_BUILD_TYPE=Release \
116+
-DCMAKE_PREFIX_PATH=$PREFIX \
117+
-DCMAKE_INSTALL_PREFIX=$PREFIX \
118+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
119+
..
120+
121+
make -j${{ steps.cpu-cores.outputs.count }} install
122+
123+
################################################################
124+
# jupyterlite page
125+
################################################################
126+
- name: Build jupyterlite page
127+
shell: bash -l {0}
128+
run: |
129+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-sqlite-wasm-host
130+
# build jupyterlite
131+
jupyter lite build \
132+
--contents=notebooks \
133+
--XeusAddon.prefix=$PREFIX
134+
135+
136+
137+
################################################################
138+
# fix permissions
139+
################################################################
140+
- name: Fix permissions
141+
run: |
142+
chmod -c -R +rX "build_wasm/_output/" | while read line; do
143+
echo "::warning title=Invalid file permissions automatically fixed::$line"
144+
done
145+
146+
################################################################
147+
# upload to github pages
148+
################################################################
149+
- name: Upload Pages artifact
150+
uses: actions/upload-pages-artifact@v3
151+
with:
152+
path: _output
153+
154+
# Deploy job (only for the repo and **not** for forks)
155+
156+
deploy:
157+
# only run on main branch
158+
if: github.ref == 'refs/heads/main' && github.repository == 'jupyter-xeus/xeus-sqlite'
159+
160+
# Add a dependency to the build job
161+
needs: emscripten_wasm_build
162+
163+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
164+
permissions:
165+
contents: read # to read the Pages artifact
166+
pages: write # to deploy to Pages
167+
id-token: write # to verify the deployment originates from an appropriate source
168+
169+
# Deploy to the github-pages environment
170+
environment:
171+
name: github-pages
172+
url: ${{ steps.deployment.outputs.page_url }}
173+
174+
# Specify runner + deployment step
175+
runs-on: ubuntu-latest
176+
steps:
177+
- name: Deploy to GitHub Pages
178+
id: deployment
179+
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

environment-wasm-build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: xeus-sqlite-wasm-build
2+
channels:
3+
- https://repo.prefix.dev/emscripten-forge-dev
4+
- conda-forge
5+
dependencies:
6+
- cmake
7+
- pkg-config
8+
- emscripten_emscripten-wasm32==3.1.73
9+
- anywidget
10+
- cmake
11+
- jupyter_server # to enable contents
12+
- jupyterlite-core
13+
- jupyterlite-xeus
14+
- notebook >=7,<8 # to include the extension to switch between JupyterLab and Notebook

environment-wasm-host.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: xeus-sqlite-wasm-host
2+
channels:
3+
- https://repo.prefix.dev/emscripten-forge-dev
4+
- https://repo.mamba.pm/conda-forge
5+
dependencies:
6+
- nlohmann_json
7+
- sqlite
8+
- sqlitecpp
9+
- cpp-tabulate=1.5
10+
- xvega>=0.1.3
11+
- xproperty>=0.12.1
12+
- xvega-bindings>=0.1.1
13+
- xeus-lite >= 4.0.0
14+
- xeus >= 2.4.0

0 commit comments

Comments
 (0)