Windows pip support #26
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: Build Wheels (Windows) | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 90 | |
| strategy: | |
| matrix: | |
| os: [windows-latest] | |
| python-version: ['3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install CMake (Windows) | |
| run: | | |
| choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' | |
| refreshenv | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build wheel setuptools | |
| - name: Clone dependencies | |
| run: | | |
| git clone --single-branch --depth 1 https://github.com/pybind/pybind11.git pybind11 | |
| git clone -b 20250814.1 --single-branch --depth 1 https://github.com/abseil/abseil-cpp.git open_spiel/abseil-cpp | |
| git clone -b master https://github.com/nlohmann/json.git open_spiel/json | |
| cd open_spiel/json && git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 && cd ../.. | |
| git clone -b master https://github.com/pybind/pybind11_json.git open_spiel/pybind11_json | |
| cd open_spiel/pybind11_json && git checkout d0bf434be9d287d73a963ff28745542daf02c08f && cd ../.. | |
| git clone -b master https://github.com/pybind/pybind11_abseil.git open_spiel/pybind11_abseil | |
| cd open_spiel/pybind11_abseil && git checkout 73992b5 && cd ../.. | |
| git clone -b develop --single-branch --depth 1 https://github.com/jblespiau/dds.git open_spiel/games/bridge/double_dummy_solver | |
| - name: Build wheel | |
| run: | | |
| python -m build --wheel --outdir dist/ | |
| if (!(Test-Path dist/*.whl)) { Write-Error "No wheel file generated"; exit 1 } | |
| Get-ChildItem dist/*.whl | |
| shell: pwsh | |
| - name: Test wheel installation | |
| run: | | |
| $wheel = Get-ChildItem dist/*.whl | Select-Object -First 1 | |
| python -m pip install $wheel.FullName | |
| python -c "import pyspiel; game = pyspiel.load_game('tic_tac_toe'); print('OpenSpiel works! Game:', game.get_type().short_name)" | |
| shell: pwsh | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: dist/*.whl | |
| upload_pypi: | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| packages_dir: dist/*/ |