@@ -71,3 +71,117 @@ 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+ -Dtabulate_DIR=$PREFIX/lib/cmake/tabulate \
120+ -DXSQL_BUILD_XSQLITE_EXECUTABLE=OFF \
121+ -DXSQL_BUILD_SHARED=OFF \
122+ -DXSQL_BUILD_STATIC=ON \
123+ -DXSQL_USE_SHARED_XEUS=ON \
124+ -DXSQL_USE_SHARED_XEUS_SQLITE=OFF \
125+ -DXVEGA_STATIC_LIBRARY=$PREFIX/lib/libxvega.a \
126+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
127+ ..
128+
129+ make -j${{ steps.cpu-cores.outputs.count }} install
130+
131+ # ###############################################################
132+ # jupyterlite page
133+ # ###############################################################
134+ - name : Build jupyterlite page
135+ shell : bash -l {0}
136+ run : |
137+ export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-sqlite-wasm-host
138+ # build jupyterlite
139+ jupyter lite build \
140+ --contents=examples \
141+ --XeusAddon.prefix=$PREFIX
142+
143+
144+
145+ # ###############################################################
146+ # fix permissions
147+ # ###############################################################
148+ - name : Fix permissions
149+ run : |
150+ chmod -c -R +rX "build_wasm/_output/" | while read line; do
151+ echo "::warning title=Invalid file permissions automatically fixed::$line"
152+ done
153+
154+ # ###############################################################
155+ # upload to github pages
156+ # ###############################################################
157+ - name : Upload Pages artifact
158+ uses : actions/upload-pages-artifact@v3
159+ with :
160+ path : _output
161+
162+ # Deploy job (only for the repo and **not** for forks)
163+
164+ deploy :
165+ # only run on main branch
166+ if : github.ref == 'refs/heads/main' && github.repository == 'jupyter-xeus/xeus-sqlite'
167+
168+ # Add a dependency to the build job
169+ needs : emscripten_wasm_build
170+
171+ # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
172+ permissions :
173+ contents : read # to read the Pages artifact
174+ pages : write # to deploy to Pages
175+ id-token : write # to verify the deployment originates from an appropriate source
176+
177+ # Deploy to the github-pages environment
178+ environment :
179+ name : github-pages
180+ url : ${{ steps.deployment.outputs.page_url }}
181+
182+ # Specify runner + deployment step
183+ runs-on : ubuntu-latest
184+ steps :
185+ - name : Deploy to GitHub Pages
186+ id : deployment
187+ uses : actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
0 commit comments