From 30b149184eb97420c709d4e92e87ff9d5d086726 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 3 Oct 2024 12:37:29 -0400 Subject: [PATCH] ci: use cibuildwheel for pyodide test Signed-off-by: Henry Schreiner --- .github/workflows/build-wheels.yml | 2 - .github/workflows/docs.yml | 83 +++--------------------------- awkward-cpp/pyproject.toml | 33 ++++++++++++ cibuildwheel.toml | 27 ---------- 4 files changed, 39 insertions(+), 106 deletions(-) delete mode 100644 cibuildwheel.toml diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index e171eb5431..0a884553a6 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -110,7 +110,6 @@ jobs: CIBW_BUILD: "${{ matrix.build }}*" CIBW_ARCHS: ${{ matrix.arch }} with: - config-file: cibuildwheel.toml package-dir: awkward-cpp - name: Check metadata @@ -162,7 +161,6 @@ jobs: CIBW_BUILD: cp${{ matrix.python }}-* CIBW_ARCHS: ${{ matrix.arch }} with: - config-file: cibuildwheel.toml package-dir: awkward-cpp - name: Check metadata diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4e199a87c2..1bda2cecb4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,51 +17,9 @@ env: SOURCE_DATE_EPOCH: "1668811211" jobs: - pyodide-python-version: - name: Determine Pyodide Python version - runs-on: ubuntu-22.04 - outputs: - python-version: ${{ steps.retrieve-python-version.outputs.python-version }} - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Cache python version - id: cache-pyodide-python-version - uses: actions/cache@v4 - with: - path: pyodide-python-version - key: ${{ runner.os }}-docs-pyodide-python-version-${{ hashFiles('docs/requirements-wasm.txt') }} - - - name: Setup Python - if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true' - uses: actions/setup-python@v5 - with: - python-version: "${{ env.X86_64_PYTHON_VERSION }}" - - - name: Install dependencies - if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true' - run: python3 -m pip install -r docs/requirements-wasm.txt - - - name: Determine Python version - if: steps.cache-pyodide-python-version.outputs.cache-hit != 'true' - id: compute-python-version - run: | - # Save Python version - PYTHON_VERSION=$(pyodide config get python_version) - echo $PYTHON_VERSION > pyodide-python-version - - - name: Retrieve Python version - id: retrieve-python-version - run: | - PYTHON_VERSION=$(cat pyodide-python-version) - echo "python-version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT" - awkward-cpp-wasm: name: Build C++ WASM runs-on: ubuntu-22.04 - needs: [pyodide-python-version] steps: - uses: actions/checkout@v4 with: @@ -70,46 +28,16 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "${{ needs.pyodide-python-version.outputs.python-version }}" + python-version: "3.12" - name: Generate build files run: pipx run nox -s prepare -- --headers --signatures - - name: Cache wheel - id: cache-awkward-cpp-wasm-wheel - uses: actions/cache@v4 - with: - path: ./awkward-cpp/dist - key: ${{ runner.os }}-"${{ needs.pyodide-python-version.outputs.python-version }}-awkward-cpp-wasm-${{ hashFiles('awkward-cpp/**') }} - - - name: Install dependencies - if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true' - run: python3 -m pip install -r docs/requirements-wasm.txt - - - name: Determine EMSDK version - if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true' - id: compute-emsdk-version - run: | - # Prepare xbuild environment (side-effect) - pyodide config list - # Save EMSDK version - EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) - echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT - working-directory: awkward-cpp - - - name: Install EMSDK - uses: mymindstorm/setup-emsdk@v14 - if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true' + - uses: pypa/cibuildwheel@v2.21 with: - version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }} - - - name: Build wheel - if: steps.cache-awkward-cpp-wasm-wheel.outputs.cache-hit != 'true' - id: build-awkward-cpp-wasm-wheel - run: | - # pyodide-build doesn't work out of the box with pipx - CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build --exports whole_archive - working-directory: awkward-cpp + package-dir: awkward-cpp + env: + CIBW_PLATFORM: pyodide - name: Upload wheel uses: actions/upload-artifact@v4 @@ -117,6 +45,7 @@ jobs: name: awkward-cpp-wasm path: awkward-cpp/dist/awkward*wasm32.whl + awkward-cpp-x86-64: runs-on: ubuntu-22.04 name: Build C++ x86 diff --git a/awkward-cpp/pyproject.toml b/awkward-cpp/pyproject.toml index 43411b9299..cba8b125d8 100644 --- a/awkward-cpp/pyproject.toml +++ b/awkward-cpp/pyproject.toml @@ -75,3 +75,36 @@ sdist.include = [ [[tool.scikit-build.overrides]] if.platform-system = "darwin" cmake.version = ">=3.29" + + +[tool.cibuildwheel] +build-frontend = "build[uv]" +test-requires = ["pytest>=6", "."] +test-command = """ +pytest {project}/tests \ + {package}/tests-cpu-kernels \ + {package}/tests-cpu-kernels-explicit \ + {package}/tests-spec \ + {package}/tests-spec-explicit +""" +skip = [ + "pp*win*", + "pp*-manylinux_i686", +] +test-skip = [ + "*universal2:arm64", + "pp*", + "*musllinux*", +] +build-verbosity = 1 + +[tool.cibuildwheel.environment] +PIP_ONLY_BINARY = "cmake,numpy" + +[[tool.cibuildwheel.overrides]] +select = "cp313*" +environment.PYO3_USE_ABI3_FORWARD_COMPATIBILITY = "1" + +[[tool.cibuildwheel.overrides]] +select = "*pyodide*" +build-frontend = {name = "build", args = ["--exports", "whole_archive"]} diff --git a/cibuildwheel.toml b/cibuildwheel.toml deleted file mode 100644 index 91827c69a0..0000000000 --- a/cibuildwheel.toml +++ /dev/null @@ -1,27 +0,0 @@ -[tool.cibuildwheel] -build-frontend = "build[uv]" -test-requires = ["pytest>=6", "."] -test-command = """ -pytest {project}/tests \ - {package}/tests-cpu-kernels \ - {package}/tests-cpu-kernels-explicit \ - {package}/tests-spec \ - {package}/tests-spec-explicit -""" -skip = [ - "pp*win*", - "pp*-manylinux_i686", -] -test-skip = [ - "*universal2:arm64", - "pp*", - "*musllinux*", -] -build-verbosity = 1 - -[tool.cibuildwheel.environment] -PIP_ONLY_BINARY = "cmake,numpy" - -[[tool.cibuildwheel.overrides]] -select = "cp313*" -environment.PYO3_USE_ABI3_FORWARD_COMPATIBILITY = "1"