Skip to content

Commit

Permalink
ci: use cibuildwheel for pyodide test
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Nov 7, 2024
1 parent 5145bce commit 2f7cc25
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 108 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -156,7 +155,6 @@ jobs:
CIBW_BUILD: cp${{ matrix.python }}-*
CIBW_ARCHS: ${{ matrix.arch }}
with:
config-file: cibuildwheel.toml
package-dir: awkward-cpp

- name: Check metadata
Expand Down
83 changes: 6 additions & 77 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -70,53 +28,24 @@ 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/[email protected]
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
with:
name: awkward-cpp-wasm
path: awkward-cpp/dist/awkward*wasm32.whl


awkward-cpp-x86-64:
runs-on: ubuntu-22.04
name: Build C++ x86
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/packaging-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ jobs:
CIBW_ARCHS_MACOS: universal2
CIBW_BUILD: cp39-win_amd64 cp310-manylinux_x86_64 cp38-macosx_universal2
with:
config-file: cibuildwheel.toml
package-dir: awkward-cpp

- uses: pypa/[email protected]
if: matrix.os == 'ubuntu-latest'
env:
CIBW_BUILD: cp312-manylinux_x86_64
with:
config-file: cibuildwheel.toml
package-dir: awkward-cpp

- name: Upload wheels
Expand Down
33 changes: 33 additions & 0 deletions awkward-cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
27 changes: 0 additions & 27 deletions cibuildwheel.toml

This file was deleted.

0 comments on commit 2f7cc25

Please sign in to comment.