Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
name: benchmarks

# The benchmarks (benchmarks/, build_local.sh bench) for every architecture x
# The benchmarks (benchmarks/, pixi run bench) for every architecture x
# browser, main thread + worker. The results are shown on the summary page of
# each job (benchmarks/report.py) and uploaded as json. CI runners are shared
# and noisy: compare the rows of one run, not absolute numbers across runs.
# Manual only (Actions -> benchmarks -> Run workflow): nothing uses the
# results automatically.

on:
workflow_dispatch:
push:
branches: [main]
pull_request:

# a new run (push / PR update) cancels the older run of the same workflow on
# the same branch / PR (release tags: each tag its own group, never cancelled)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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

jobs:
bench:
name: bench ${{ matrix.wasm }} / ${{ matrix.browser }}
Expand All @@ -33,31 +28,26 @@ jobs:
wasm: [wasm32, wasm64]
browser: [chromium, firefox, webkit]

env:
BROWSERS: ${{ matrix.browser }}
PLAYWRIGHT_INSTALL_ARGS: --with-deps

steps:
- uses: actions/checkout@v4

- name: Install micromamba and the dev env
uses: mamba-org/setup-micromamba@v2
- uses: prefix-dev/setup-pixi@v0.11.3
with:
environment-file: environment-dev.yml
environment-name: pyjs-build
cache-environment: true
init-shell: bash
pixi-version: v0.84.2
cache: true

- name: Install the browser
run: pixi run playwright install --with-deps ${{ matrix.browser }}

- name: Run the benchmarks (main thread + worker)
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
./build_local.sh bench ${{ matrix.wasm }}
run: pixi run bench ${{ matrix.wasm }} ${{ matrix.browser }}

# (a fresh runner: the json files of this run only)
- name: Report
if: always()
run: |
shopt -s nullglob
results=(build_root/benchmarks/${{ matrix.wasm }}/latest_*.json)
results=(build_root/benchmarks/${{ matrix.wasm }}/*.json)
if [ ${#results[@]} -eq 0 ]; then
echo "no benchmark results" >> "$GITHUB_STEP_SUMMARY"
exit 0
Expand Down
21 changes: 4 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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


jobs:

build_pyjs_docs:
Expand All @@ -30,23 +25,15 @@ jobs:
steps:
- uses: actions/checkout@v4

# creates (and caches) the dev env (incl. sphinx),
# build_local.sh uses it via BUILD_ENV_PREFIX
- name: Install micromamba and the dev env
uses: mamba-org/setup-micromamba@v2
- uses: prefix-dev/setup-pixi@v0.11.3
with:
environment-file: environment-dev.yml
environment-name: pyjs-build
cache-environment: true
init-shell: bash
pixi-version: v0.84.2
cache: true

# builds the npm package (wasm32 + wasm64, deployed next to the html for
# the playground) and the sphinx docs
- name: Build the docs
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
export DOCS_OUT_DIR="$GITHUB_WORKSPACE/docs_build/html"
./build_local.sh docs
run: pixi run docs docs_build/html

################################################################
# upload to github pages
Expand Down
45 changes: 12 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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


jobs:

test-browser:
Expand All @@ -32,45 +27,29 @@ jobs:
wasm: [wasm32, wasm64]
browser: [chromium, firefox, webkit]

env:
BROWSERS: ${{ matrix.browser }}
# install the system libraries the browser needs (via apt)
PLAYWRIGHT_INSTALL_ARGS: --with-deps

steps:
- uses: actions/checkout@v4

# creates (and caches) the dev env (incl. playwright), build_local.sh
# uses it via BUILD_ENV_PREFIX and creates the host / test envs itself
- name: Install micromamba and the dev env
uses: mamba-org/setup-micromamba@v2
# pixi + the default (dev) environment from pixi.lock, cached; the
# emscripten environments are installed by the tasks
- uses: prefix-dev/setup-pixi@v0.11.3
with:
# one dev env for wasm32 and wasm64 (build_local.sh sets -m64)
environment-file: environment-dev.yml
environment-name: pyjs-build
cache-environment: true
init-shell: bash
pixi-version: v0.84.2
cache: true

# the browser + the system libraries it needs (apt)
- name: Install the browser
run: pixi run playwright install --with-deps ${{ matrix.browser }}

# one build for all browsers: JSPI (pyjs.run_sync) is used when the browser
# supports it (needs python with the wasm-gc call trampoline,
# emscripten-forge python >= build 6)
- name: Build and test (browser main thread + worker)
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
./build_local.sh test ${{ matrix.wasm }}
run: pixi run test ${{ matrix.wasm }} ${{ matrix.browser }}

# the same build, JSPI switched off at runtime (like a browser without JSPI)
- name: Test without JSPI (browser main thread + worker)
env:
DISABLE_JSPI: "1"
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
./build_local.sh test ${{ matrix.wasm }}
run: pixi run test ${{ matrix.wasm }} ${{ matrix.browser }} "main worker" numpy no-jspi

- name: Test without numpy (browser main thread)
env:
TEST_ENV: no-numpy
MODES: main
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
./build_local.sh test ${{ matrix.wasm }}
run: pixi run test ${{ matrix.wasm }} ${{ matrix.browser }} main no-numpy
30 changes: 9 additions & 21 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: npm

# The npm package (npm/, build_local.sh npm): built + tested on every push /
# The npm package (npm/, pixi run test-npm): built + tested on every push /
# PR, published on release tags (e.g. `4.1.0`, must equal the version in
# CMakeLists.txt) or manually (workflow_dispatch with publish=true).
#
Expand Down Expand Up @@ -28,10 +28,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

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

env:
NPM_PACKAGE_NAME: ${{ vars.NPM_PACKAGE_NAME || '@derthorsten/pyjs' }}

Expand All @@ -42,33 +38,25 @@ jobs:
# a failed JSPI suspension can hang the browser instead of failing
timeout-minutes: 120

env:
BROWSERS: chromium firefox webkit
PLAYWRIGHT_INSTALL_ARGS: --with-deps

steps:
- uses: actions/checkout@v4

# one dev env (cached) for both architectures
- name: Install micromamba and the dev env
uses: mamba-org/setup-micromamba@v2
- uses: prefix-dev/setup-pixi@v0.11.3
with:
environment-file: environment-dev.yml
environment-name: pyjs-build
cache-environment: true
init-shell: bash
pixi-version: v0.84.2
cache: true

- name: Install the browsers
run: pixi run playwright install --with-deps chromium firefox webkit

# wasm32 + wasm64, main thread + module worker, offline + network
- name: Build and test the npm package
run: |
export BUILD_ENV_PREFIX="$MAMBA_ROOT_PREFIX/envs/pyjs-build"
./build_local.sh npm --test
run: pixi run test-npm

- name: Upload the package
uses: actions/upload-artifact@v4
with:
name: npm-package
path: build_root/npm/*.tgz
path: build_root/npm/tgz/*.tgz
if-no-files-found: error

publish:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ emsdk_*
docs_build/
empack_config.yaml
build_root/
# pixi environments (pixi.toml)
.pixi/
docs/_generated/
# jupyterlite build state (written by the docs build)
.jupyterlite.doit.db
Expand Down
Loading
Loading