@@ -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
0 commit comments