Add Ruff formatter to pre-commit for Python #33
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🧩 WASM | |
| on: [push, pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Cross-compile the Python wheel for Pyodide (openPMD_USE_PYTHON=ON) and run the | |
| # FULL Python unittest suite inside the Pyodide runtime -- validates the shipped | |
| # Python wheel and its HDF5 read/write path end to end, the way a user loads it. | |
| # Catches wasm-specific regressions a wheel smoke test cannot (e.g. the HDF5 | |
| # 64-bit `long double` read path, #1902). | |
| pyodide-python: | |
| name: Pyodide / WASM (Python test suite) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| - name: Host Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install cibuildwheel | |
| run: python -m pip install "cibuildwheel==4.1.0" | |
| # cibuildwheel provisions the Emscripten + Pyodide xbuildenv, cross-compiles | |
| # the wheel (openPMD_USE_PYTHON defaults ON; install_wasm.sh builds the static | |
| # zlib + HDF5 into the Emscripten sysroot in BEFORE_BUILD), then runs the full | |
| # Python unittest suite in the matching-ABI Pyodide test runtime (node) -- so | |
| # there is no separate xbuildenv to keep in sync with the wheel. | |
| - name: Build wheel + run the Python suite in Pyodide | |
| run: python -m cibuildwheel --platform pyodide --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: "cp314-pyodide_wasm32" | |
| CIBW_BEFORE_BUILD_PYODIDE: "bash .github/workflows/dependencies/install_wasm.sh" | |
| CIBW_ENVIRONMENT_PYODIDE: > | |
| openPMD_CMAKE_openPMD_USE_HDF5='ON' | |
| openPMD_CMAKE_openPMD_USE_ADIOS2='OFF' | |
| openPMD_USE_MPI='OFF' | |
| HDF5_USE_STATIC_LIBRARIES='ON' | |
| ZLIB_USE_STATIC_LIBS='ON' | |
| # h5py is a SECOND, independently bundled HDF5 -- co-loading it with | |
| # openpmd_api reproduces the ImpactX WASM teardown fault (coload_repro.py). | |
| CIBW_TEST_REQUIRES: numpy h5py | |
| # APITest uses ../samples paths, so download the samples under test/python | |
| # and run Test.py from test/python/unittest -- mirroring the native ctest, | |
| # which runs `Test.py -v` from that WORKING_DIRECTORY (see CMakeLists.txt). | |
| CIBW_BEFORE_TEST: "bash {project}/share/openPMD/download_samples.sh {project}/test/python" | |
| # Co-load regression + full suite, both enforced. coload_repro.py imports | |
| # openpmd_api then h5py (a second, independently bundled HDF5) and runs a | |
| # round-trip; it crashed with a wasm OOB before the -sSIDE_MODULE=2 + | |
| # hidden-visibility deps fix. Then the full unittest suite runs with h5py | |
| # co-loaded (its own h5py-interop tests exercise the co-load too). | |
| CIBW_TEST_COMMAND: > | |
| python {project}/test/python/coload_repro.py && | |
| cd {project}/test/python/unittest && python Test.py -v |