From 40580c92ba8d5ee7881a7533553c823b6f5e4a42 Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Wed, 15 Nov 2023 14:06:57 -0600 Subject: [PATCH 1/8] add GitHub actions workflow for emscripten build --- .github/workflows/emscripten.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/emscripten.yml diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml new file mode 100644 index 000000000..2d361ac70 --- /dev/null +++ b/.github/workflows/emscripten.yml @@ -0,0 +1,33 @@ +name: Emscripten build and test + +on: + workflow_dispatch: + pull_request: + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - run: | + pip install pyodide-build + echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV + + - uses: mymindstorm/setup-emsdk@v12 + with: + version: ${{ env.EMSCRIPTEN_VERSION }} + + - run: pyodide build From dbaa7c8edca7de5e7fd7b6ba9d7e05511867e8e5 Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Wed, 15 Nov 2023 14:16:19 -0600 Subject: [PATCH 2/8] run tests --- .github/workflows/emscripten.yml | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 2d361ac70..a251dc682 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -16,18 +16,41 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - name: Setup Python + uses: actions/setup-python@v4 with: python-version: 3.11 - - run: | + - name: Install pyodide-build + run: | pip install pyodide-build echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV - - uses: mymindstorm/setup-emsdk@v12 + - name: Setup Emscripten + uses: mymindstorm/setup-emsdk@v12 with: version: ${{ env.EMSCRIPTEN_VERSION }} - - run: pyodide build + - name: Build + run: pyodide build + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Set up Pyodide virtual environment + run: | + pyodide venv .venv-pyodide + source .venv-pyodide/bin/activate + python -m pip install .[test] + python -m pip install dist/*.whl + python -c "import sys; print(sys.platform)" + + - name: Test + run: | + source .venv-pyodide/bin/activate + python -m pytest -vv tests From e1e7c125ed66bbe2a730882366e418a4a8c05cc7 Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Wed, 15 Nov 2023 14:24:26 -0600 Subject: [PATCH 3/8] install only pytest --- .github/workflows/emscripten.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index a251dc682..b95572737 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -46,7 +46,8 @@ jobs: run: | pyodide venv .venv-pyodide source .venv-pyodide/bin/activate - python -m pip install .[test] + # python -m pip install .[test] + python -m pip install pytest python -m pip install dist/*.whl python -c "import sys; print(sys.platform)" From b8ad995fca535e3735f8b96be3b0478a9eb1a62a Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Thu, 16 Nov 2023 16:46:58 -0600 Subject: [PATCH 4/8] add emscripten test marker --- .github/workflows/emscripten.yml | 2 +- pyproject.toml | 3 ++- tests/test_0014-all-ttree-versions.py | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index b95572737..ee528563f 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -54,4 +54,4 @@ jobs: - name: Test run: | source .venv-pyodide/bin/activate - python -m pytest -vv tests + python -m pytest -vv tests -m emscripten --reruns 3 --reruns-delay 30 --only-rerun "(?i)http|timeout|connection" diff --git a/pyproject.toml b/pyproject.toml index 23c34eb93..1fde08cb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,7 +94,8 @@ log_cli_level = "info" markers = [ "slow", "network", - "xrootd" + "xrootd", + "emscripten" ] minversion = "6.0" testpaths = ["tests"] diff --git a/tests/test_0014-all-ttree-versions.py b/tests/test_0014-all-ttree-versions.py index cb664d548..4c00653e9 100644 --- a/tests/test_0014-all-ttree-versions.py +++ b/tests/test_0014-all-ttree-versions.py @@ -1,16 +1,14 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE -import json -import sys from io import StringIO -import numpy import pytest import skhep_testdata import uproot +@pytest.mark.emscripten def test_streamerless_read(): with uproot.open( skhep_testdata.data_path("uproot-sample-5.23.02-uncompressed.root") From 51b5a2c63c76f9875af456658502aedc55397daf Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Mon, 20 Nov 2023 13:54:11 -0600 Subject: [PATCH 5/8] increase awkward version to fix dependency resolution conflict --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1fde08cb2..d104fe623 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ "Topic :: Utilities" ] dependencies = [ - "awkward>=2.4.6", + "awkward>=2.5.0", "importlib-metadata;python_version<\"3.8\"", "numpy", "packaging", From 285c17925d81231f98c0b834f954c3e715e454af Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Mon, 20 Nov 2023 15:22:46 -0600 Subject: [PATCH 6/8] build awkward wheel --- .github/workflows/emscripten.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index ee528563f..330e28b42 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -42,12 +42,22 @@ jobs: with: node-version: 20 + # clone awkward and build a wheel, copy the wheel + - name: Build awkward wheel + run: | + git clone https://github.com/scikit-hep/awkward.git + cd awkward + git checkout main + git submodule update --init --recursive + pyodide build --wheel --wheel-dir ../dist + - name: Set up Pyodide virtual environment run: | pyodide venv .venv-pyodide source .venv-pyodide/bin/activate # python -m pip install .[test] python -m pip install pytest + ls -l dist python -m pip install dist/*.whl python -c "import sys; print(sys.platform)" From 489fadcfdd4484be5c0248a0334fc672c11a51ab Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Mon, 20 Nov 2023 15:25:17 -0600 Subject: [PATCH 7/8] move wheel --- .github/workflows/emscripten.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 330e28b42..ac1766f40 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -43,13 +43,14 @@ jobs: node-version: 20 # clone awkward and build a wheel, copy the wheel - - name: Build awkward wheel + - name: Awkward wheel run: | git clone https://github.com/scikit-hep/awkward.git cd awkward git checkout main git submodule update --init --recursive - pyodide build --wheel --wheel-dir ../dist + pyodide build + mv dist/*.whl ../dist - name: Set up Pyodide virtual environment run: | From e1b8bcb8570e76dd941dd8e6eb0d37b33cf812af Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio <35803280+lobis@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:17:12 -0600 Subject: [PATCH 8/8] Update .github/workflows/emscripten.yml Co-authored-by: Angus Hollands --- .github/workflows/emscripten.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index ac1766f40..d02c5af01 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -49,6 +49,7 @@ jobs: cd awkward git checkout main git submodule update --init --recursive + pipx run nox -s prepare -- --headers --signatures --tests pyodide build mv dist/*.whl ../dist