Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use cibuildwheel for pyodide test #3270

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
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/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
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
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.

Loading