Testing wasm build #355
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: Python wheels for WASM upload | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| CIBW_BUILD_VERBOSITY: 1 | |
| # In case you want to specify a version of pyodide | |
| # PYODIDE_VERSION: 0.28.2 | |
| jobs: | |
| build_wheels_wasm: | |
| name: Build and test wheels for WASM on ${{ matrix.os }} for ${{ matrix.p_ver }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| CIBW_BUILD: ${{ matrix.cibw_build }} | |
| CMAKE_ARGS: "-DWITH_OPTIM=OFF" | |
| CIBW_TEST_COMMAND: "pytest {project}/tests/ndarray/test_reductions.py" | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| cibw_build: ["cp3{12,13,14}-*"] | |
| p_ver: ["3.12-3.14"] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake | |
| - name: Install cibuildwheel | |
| run: pip install cibuildwheel | |
| - name: Build wheels | |
| # Testing is automatically made by cibuildwheel | |
| run: cibuildwheel --platform pyodide | |
| - name: Publish wheels to orphan `wheels` branch | |
| # if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Create a fresh working directory | |
| rm -rf wheels-branch | |
| mkdir wheels-branch | |
| cd wheels-branch | |
| # Fetch existing wheels branch if it exists | |
| git init | |
| git remote add origin https://github.com/${{ github.repository }}.git | |
| git fetch origin wheels || true | |
| # Create an orphan branch (separate history) | |
| git checkout --orphan wheels | |
| # Clear all files in branch | |
| git reset --hard | |
| # Add wheels | |
| mkdir -p wheels | |
| cp ../wheelhouse/*.whl wheels/ | |
| echo "Wheels to publish:" | |
| ls -lh wheels/ | |
| # Commit | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git add wheels | |
| git commit -m "Update wheels for release ${{ github.ref_name }}" | |
| # Force push as this branch always resets | |
| git push origin wheels --force | |
| # This is not working yet | |
| # - name: Upload wheel to release | |
| # if: startsWith(github.ref, 'refs/tags/') | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # run: | | |
| # gh release upload ${GITHUB_REF_NAME} ./wheelhouse/*.whl |