From f6df4881e6d7d6c4937e313a70682819b6a5622b Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 25 Apr 2024 00:49:52 +0530 Subject: [PATCH] Use separate build and test jobs and share wheel --- .github/workflows/ci-emscripten.yaml | 57 +++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-emscripten.yaml b/.github/workflows/ci-emscripten.yaml index d78efe7f..f3850195 100644 --- a/.github/workflows/ci-emscripten.yaml +++ b/.github/workflows/ci-emscripten.yaml @@ -14,6 +14,15 @@ env: # support has not been implemented yet DISABLE_NUMCODECS_AVX2: 1 DISABLE_NUMCODECS_SSE2: 1 + # Common environment variables for both build and test jobs + PYODIDE_VERSION: 0.25.1 + # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION. + # The appropriate versions can be found in the Pyodide repodata.json + # "info" field, or in Makefile.envs: + # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2 + PYTHON_VERSION: 3.11.3 + EMSCRIPTEN_VERSION: 3.1.46 + NODE_VERSION: 18 concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -24,20 +33,11 @@ permissions: jobs: build-wasm-emscripten: - name: Build numcodecs distribution for Pyodide + name: Build numcodecs Pyodide distribution runs-on: ubuntu-22.04 # To enable this workflow on a fork, comment out: # FIXME: uncomment after this is ready to merge # if: github.repository == 'zarr-developers/numcodecs' - env: - PYODIDE_VERSION: 0.25.1 - # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION. - # The appropriate versions can be found in the Pyodide repodata.json - # "info" field, or in Makefile.envs: - # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2 - PYTHON_VERSION: 3.11.3 - EMSCRIPTEN_VERSION: 3.1.46 - NODE_VERSION: 18 steps: - name: Checkout source uses: actions/checkout@v4 @@ -73,6 +73,43 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} + - name: Upload Pyodide wheel artifact + uses: actions/upload-artifact@v4 + with: + name: numcodecs-pyodide-wheel + path: dist/*.whl + + test-wasm-emscripten: + name: Test numcodecs Pyodide distribution + runs-on: ubuntu-22.04 + needs: [build-wasm-emscripten] + steps: + - name: Set up Python ${{ env.PYTHON_VERSION }} + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Set up Emscripten toolchain + uses: mymindstorm/setup-emsdk@v14 + with: + version: ${{ env.EMSCRIPTEN_VERSION }} + actions-cache-folder: emsdk-cache + + - name: Install pyodide-build + run: python -m pip install "pydantic<2" "pyodide-build==${{ env.PYODIDE_VERSION }}" + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Download Pyodide wheel artifact + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + - name: Set up Pyodide virtual environment and test numcodecs for Pyodide run: | pyodide venv .venv-pyodide