Skip to content

Commit

Permalink
added emsdk and build script
Browse files Browse the repository at this point in the history
inital build script

change wasm workflow

trigger

use new mamba action

local build works localy =)

local build works localy =)

cleanup

build with custom pkgs works

 via build.py

make it verbose

fixit

ignore lite

try to adapt build workflow

adding cmake

fixing env

disable check links atm

remove build dir after build

changed path

changed path

changed path

fix tests

added ui tests
  • Loading branch information
DerThorsten committed Nov 13, 2023
1 parent 416d8d1 commit 2f21a78
Show file tree
Hide file tree
Showing 13 changed files with 1,036 additions and 64 deletions.
218 changes: 218 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
name: Build

on:
push:
branches: main
pull_request:
branches: '*'

defaults:
run:
shell: bash -l {0}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Lint
run: |
cd lite
set -eux
jlpm
jlpm run build
rm -rf build
jlpm run lint:check
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Build the extension
run: |
cd lite
set -eux
python -m build
rm -rf build
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
path: lite/dist
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
- name: Install and Test
run: |
cd lite
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install "jupyterlab>=4.0.0,<5" jupyterlite_xeus_python*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlite/xeus-python-kernel.*OK"
python -m jupyterlab.browser_check --no-browser-test
python-tests-mamba-python:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
path: ./lite/dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Make sure the Mamba Python API is available
run: |
cd lite
mamba install mamba
python -c "from mamba.api import create"
- name: Install
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: lite/dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
working-directory: lite/tests

python-tests-mamba:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
path: ./lite/dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Install
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: lite/dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
working-directory: lite/tests

python-tests-micromamba:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
path: ./lite/dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Install
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: lite/dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
working-directory: lite/tests

python-tests-conda:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v2
with:
name: jupyterlite-xeus-python-dist-${{ github.run_number }}
path: ./lite/dist

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: lite/environment.yml
cache-environment: true

- name: Install
run: pip install jupyterlite_xeus_python*.tar.gz
working-directory: lite/dist

- name: Run tests
run: pytest -rP test_xeus_python_env.py
working-directory: lite/tests


# check_links:
# name: Check Links
# runs-on: ubuntu-latest
# timeout-minutes: 15
# steps:
# - uses: actions/checkout@v3
# - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
# - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
66 changes: 20 additions & 46 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
push:
branches:
- main
- merge-xeus-python-kernel
pull_request:
branches:
- main
- merge-xeus-python-kernel

defaults:
run:
Expand Down Expand Up @@ -78,7 +80,7 @@ jobs:
# working-directory: build/test

- name: Test xeus-python Python
run: pytest . -vvv
run: pytest . -vvv --ignore=lite

test-win:

Expand Down Expand Up @@ -155,7 +157,7 @@ jobs:
shell: cmd
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate xeus-python
pytest . -vvv
pytest . -vvv --ignore=lite
test-wasm:

Expand All @@ -172,58 +174,30 @@ jobs:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1

- name: Install mamba
uses: mamba-org/provision-with-micromamba@main


################################################################
# MAMBA
################################################################
- name: micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-wasm-build.yml
environment-name: xeus-python-wasm-build
init-shell: >-
bash
cache-environment: true
post-cleanup: 'all'


- name: "setup emsdk"
shell: bash -l {0}
run: |
micromamba activate xeus-python-wasm-build
cd $HOME
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install ${{ matrix.emsdk_ver }}
./emsdk activate ${{ matrix.emsdk_ver }}
- name: Build and pack xeus-python
- name: Build xeus-python-wasm and jupyterlite-xeus-python
run: |
micromamba activate xeus-python-wasm-build
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
source $HOME/emsdk/emsdk_env.sh
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
mkdir build
pushd build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-python-wasm-host
export CMAKE_PREFIX_PATH=$PREFIX
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
# remove all the fake pythons binaries
rm -f $PREFIX/bin/python*
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DXPYT_EMSCRIPTEN_WASM_BUILD=ON \
..
make -j5
popd
# Patch output
python wasm_patches/patch_it.py
cd lite
python -m pip install -e . -v
- uses: actions/upload-artifact@v2
with:
name: xeus-python-wasm
path: |
build/xpython_wasm.js
build/xpython_wasm.wasm
lite/build/xeus-python/xpython_wasm.js
lite/build/xeus-python/xpython_wasm.wasm
Loading

0 comments on commit 2f21a78

Please sign in to comment.