Skip to content

Commit d5199bc

Browse files
committed
Fix JS tests, merge gha scripts
1 parent ac28753 commit d5199bc

File tree

6 files changed

+54
-73
lines changed

6 files changed

+54
-73
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,56 @@ jobs:
10331033
path: python/perspective/dist/*.tar.gz
10341034
if: ${{ matrix.os == 'macos-11' }}
10351035

1036+
build-pyodide:
1037+
runs-on: ubuntu-22.04
1038+
needs: [initialize]
1039+
env:
1040+
PYODIDE_VERSION: 0.23.2
1041+
# PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION.
1042+
# The appropriate versions can be found in the Pyodide repodata.json
1043+
# "info" field, or in Makefile.envs:
1044+
# https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2
1045+
PYTHON_VERSION: 3.11.2
1046+
EMSCRIPTEN_VERSION: 3.1.32
1047+
steps:
1048+
- name: Checkout perspective
1049+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
1050+
1051+
- name: set up python
1052+
id: setup-python
1053+
uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b # v4.6.0
1054+
with:
1055+
python-version: ${{ env.PYTHON_VERSION }}
1056+
1057+
- uses: mymindstorm/setup-emsdk@ab889da2abbcbb280f91ec4c215d3bb4f3a8f775 # v12
1058+
with:
1059+
version: ${{ env.EMSCRIPTEN_VERSION }}
1060+
actions-cache-folder: emsdk-cache
1061+
1062+
- name: copy files
1063+
run: |
1064+
npm install -g yarn
1065+
yarn --frozen-lockfile
1066+
yarn build_python --setup-only
1067+
1068+
- name: Linux init steps
1069+
run: sudo node scripts/install_tools.js
1070+
1071+
- name: Install pyodide-build
1072+
run: pip install pyodide-build==$PYODIDE_VERSION
1073+
1074+
- name: Build
1075+
# Without --exports=pyinit, pyodide-build tries to export all symbols from every .o,
1076+
# which causes the em++ linker command line invocation to be so long
1077+
# that the command fails.
1078+
run: pyodide build python/perspective --exports=pyinit
1079+
1080+
- name: Upload pyodide wheel
1081+
uses: actions/upload-artifact@v3
1082+
with:
1083+
name: perspective-python-dist-pyodide
1084+
path: dist/*.whl
1085+
10361086
##########################################################################################################################
10371087
##########################################################################################################################
10381088

.github/workflows/pyodide.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

cpp/perspective/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ set(PSP_WASM_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
541541
-s EXPORT_NAME=\"load_perspective\" \
542542
-s MAXIMUM_MEMORY=4gb \
543543
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
544-
-s ENVIRONMENT=worker \
545544
")
546545

547546
if(PSP_WASM_BUILD)
@@ -594,7 +593,6 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
594593
add_library(psp STATIC ${PYTHON_SOURCE_FILES})
595594
add_library(binding SHARED ${PYTHON_BINDING_SOURCE_FILES})
596595
if(PSP_PYODIDE)
597-
set(CMAKE_EXE_LINKER_FLAGS "${PSP_WASM_LINKER_FLAGS}")
598596
set(PSP_PYTHON_DEFS PSP_ENABLE_WASM=1)
599597
else()
600598
set(PSP_PYTHON_DEFS PSP_ENABLE_PYTHON_THREADING=1)

cpp/perspective/src/cpp/computed_function.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ namespace computed_function {
20232023
number = val.to_double();
20242024
}
20252025

2026-
#if defined(PSP_ENABLE_WASM) && defined(PSP_ENABLE_PYTHON)
2026+
#if defined(PSP_ENABLE_WASM) && !defined(PSP_ENABLE_PYTHON)
20272027
// check for overflow
20282028
if (number > std::numeric_limits<std::int32_t>::max()
20292029
|| number < std::numeric_limits<std::int32_t>::min()) {

scripts/build_python.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ try {
5959
} else if (IS_INSTALL) {
6060
cmd = `${PYTHON} -m pip install .`;
6161
} else if (IS_PYODIDE) {
62-
cmd = `pyodide build`;
62+
cmd = `pyodide build . --exports=pyinit`;
6363
} else {
6464
cmd = bash`${PYTHON} setup.py build -v`;
6565
}

scripts/script_utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ exports.run_with_scope = async function run_recursive(strings, ...args) {
306306
const workspaces = JSON.parse(stdout.toString());
307307
const compiled = new Set(
308308
Object.keys(workspaces.dependencies).filter(
309-
(x) => !workspaces.dependencies[x].resolved.startsWith("file:")
309+
(x) => !workspaces.dependencies[x].resolved?.startsWith("file:")
310310
)
311311
);
312312

313313
let uncompiled = Object.keys(workspaces.dependencies).filter(
314314
(x) =>
315-
workspaces.dependencies[x].resolved.startsWith("file:") &&
315+
workspaces.dependencies[x].resolved?.startsWith("file:") &&
316316
(scope === null || scope.indexOf(x) >= 0)
317317
);
318318

0 commit comments

Comments
 (0)