-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* iterating on ci * added emsdk patched installer * use setup-micromamba * use emscripten 3.1.45 * explicit dirs * remove core detector action * docs * rename upload dir * added script * clone differently * deps * added readme * added post build * added post build * path corrections * use emscripten 3.1.45 * use emscripten 3.1.45 * changed docs
- Loading branch information
1 parent
f420f59
commit 9ca3b97
Showing
21 changed files
with
1,076 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: docs | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
pull_request: | ||
|
||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
|
||
jobs: | ||
|
||
build_pyjs_docs: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
emsdk_ver: ["3.1.45"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get number of CPU cores | ||
uses: SimenB/github-actions-cpu-cores@v1 | ||
|
||
|
||
- name: Install micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: environment-dev.yml | ||
environment-name: pyjs-wasm | ||
|
||
- name: build the docs | ||
shell: bash -el {0} | ||
run: | | ||
./build_docs.sh | ||
|
||
################################################################ | ||
# upload to github pages | ||
################################################################ | ||
- name: Upload Pages artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: docs/_build/html | ||
|
||
|
||
deploy: | ||
# only run on main branch | ||
if: github.ref == 'refs/heads/main' && github.repository == 'emscripten-forge/pyjs' | ||
|
||
# Add a dependency to the build job | ||
needs: build_pyjs_docs | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
contents: read # to read the Pages artifact | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
# Specify runner + deployment step | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ build_tests/ | |
node_modules | ||
package-lock.json | ||
docs/_build | ||
*.wasm | ||
nxtgm_javascript_runtime.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# dir of this script | ||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
WASM_ENV_NAME=pyjs-wasm-dev | ||
WASM_ENV_PREFIX=$MAMBA_ROOT_PREFIX/envs/$WASM_ENV_NAME | ||
EMSDK_DIR=$THIS_DIR/emsdk_install | ||
EMSDK_VERSION="3.1.45" | ||
|
||
|
||
|
||
|
||
if [ ! -d "$EMSDK_DIR" ]; then | ||
echo "Creating emsdk dir $EMSDK_DIR" | ||
$THIS_DIR/emsdk/setup_emsdk.sh $EMSDK_VERSION $EMSDK_DIR | ||
else | ||
echo "Emsdk dir $EMSDK_DIR already exists" | ||
fi | ||
|
||
PYJS_PROBE_FILE=$WASM_ENV_PREFIX/lib_js/pyjs/pyjs_runtime_browser.js | ||
|
||
if [ ! -d "$WASM_ENV_PREFIX" ]; then | ||
echo "Creating wasm env $WASM_ENV_NAME" | ||
micromamba create -n $WASM_ENV_NAME \ | ||
--platform=emscripten-wasm32 \ | ||
-c https://repo.mamba.pm/emscripten-forge \ | ||
-c https://repo.mamba.pm/conda-forge \ | ||
--yes \ | ||
python pybind11 nlohmann_json pybind11_json numpy \ | ||
bzip2 sqlite zlib libffi exceptiongroup \ | ||
xeus xeus-lite xeus-python-shell xeus-javascript xtl | ||
|
||
else | ||
echo "Wasm env $WASM_ENV_NAME already exists" | ||
fi | ||
|
||
|
||
|
||
|
||
if [ ! -f "$PYJS_PROBE_FILE" ]; then | ||
echo "Building pyjs" | ||
|
||
cd $THIS_DIR | ||
source $EMSDK_DIR/emsdk_env.sh | ||
|
||
mkdir -p build | ||
cd build | ||
|
||
export PREFIX=$WASM_ENV_PREFIX | ||
export CMAKE_PREFIX_PATH=$PREFIX | ||
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX | ||
|
||
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 \ | ||
.. | ||
|
||
emmake make -j2 | ||
emmake make install | ||
|
||
else | ||
echo "Skipping build pyjs" | ||
fi | ||
|
||
# if there is no xeus-python dir, clone it | ||
if [ ! -d "$THIS_DIR/xeus-python" ]; then | ||
cd $THIS_DIR | ||
git clone https://github.com/jupyter-xeus/xeus-python/ | ||
else | ||
echo "xeus-python dir already exists" | ||
fi | ||
|
||
|
||
PYJS_PROBE_FILE=$WASM_ENV_PREFIX/share/jupyter/kernels/xpython/kernel.json | ||
if [ ! -f "$PYJS_PROBE_FILE" ]; then | ||
echo "Building xeus-python" | ||
|
||
cd $THIS_DIR | ||
source $EMSDK_DIR/emsdk_env.sh | ||
|
||
|
||
cd xeus-python | ||
|
||
export PREFIX=$WASM_ENV_PREFIX | ||
export CMAKE_PREFIX_PATH=$PREFIX | ||
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX | ||
|
||
|
||
# remove the fake python | ||
rm -rf $PREFIX/bin/python* | ||
rm -rf $PREFIX/bin/pip* | ||
mkdir -p build_wasm | ||
cd build_wasm | ||
|
||
|
||
emcmake cmake .. \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ | ||
-DCMAKE_INSTALL_PREFIX=$PREFIX \ | ||
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON\ | ||
|
||
|
||
emmake make -j8 install | ||
|
||
rm -rf $WASM_ENV_PREFIX/share/jupyter/kernels/xpython-raw | ||
|
||
else | ||
echo "Skipping build xeus-python" | ||
fi | ||
|
||
|
||
|
||
if true ; then | ||
|
||
export PREFIX=$MAMBA_ROOT_PREFIX/envs/pyjs-wasm | ||
echo "Building docs" | ||
|
||
cd $THIS_DIR/docs | ||
|
||
WASM_ENV_PREFIX=$WASM_ENV_PREFIX LITE=1 make html | ||
|
||
# post-build | ||
|
||
WASM_ENV_PREFIX=$WASM_ENV_PREFIX python ./post_build.py | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.