[deps] Upgrade Bazel to 9.2.0 and migrate to Bzlmod #1092
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: Release PyPI Wheel | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| pull_request: | |
| permissions: | |
| actions: write | |
| contents: read | |
| jobs: | |
| release-macos: | |
| name: release-macos (py${{ matrix.python-version }}) | |
| runs-on: macos-14 | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: >- | |
| ${{ fromJSON( | |
| (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| && '["3.12", "3.13", "3.14"]' | |
| || '["3.12"]' | |
| ) }} | |
| env: | |
| HOMEBREW_NO_AUTO_UPDATE: "1" | |
| steps: | |
| - name: Cancel previous run | |
| uses: styfle/cancel-workflow-action@0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Pin CMake 3 | |
| if: matrix.python-version == '3.14' | |
| run: | | |
| python -m pip install "cmake<4" | |
| CMAKE_BIN_DIR="$(python -c "import cmake; print(cmake.CMAKE_BIN_DIR)")" | |
| CMAKE_BIN="$CMAKE_BIN_DIR/cmake" | |
| echo "$CMAKE_BIN_DIR" >> "$GITHUB_PATH" | |
| sudo ln -sfn "$CMAKE_BIN" /usr/local/bin/cmake | |
| PATH="$CMAKE_BIN_DIR:$PATH" cmake --version | |
| - name: Install macOS dependencies | |
| run: | | |
| brew install ninja swig qt@5 | |
| if [ "${{ matrix.python-version }}" != "3.14" ]; then | |
| brew install cmake | |
| sudo ln -sfn "$(brew --prefix cmake)/bin/cmake" /usr/local/bin/cmake | |
| fi | |
| sudo ln -sfn "$(brew --prefix ninja)/bin/ninja" /usr/local/bin/ninja | |
| echo "BAZEL_RULES_QT_DIR=$(brew --prefix qt@5)" >> "$GITHUB_ENV" | |
| - name: Install bazelisk | |
| run: | | |
| go install github.com/bazelbuild/bazelisk@latest | |
| echo "$HOME/go/bin" >> "$GITHUB_PATH" | |
| - name: Build | |
| run: | | |
| rm -rf dist wheelhouse | |
| make RELEASE_PYTHON=${{ matrix.python-version }} pypi-wheel | |
| python -m pip install wheelhouse/*.whl --force-reinstall | |
| - name: Test | |
| run: | | |
| make release-test | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheel-macos-${{ matrix.python-version }} | |
| path: wheelhouse/ | |
| if-no-files-found: error | |
| release-linux: | |
| name: release-linux (${{ matrix.arch }}, py${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.container }} | |
| timeout-minutes: 120 | |
| env: | |
| MUJOCO_GL: egl | |
| EGL_PLATFORM: surfaceless | |
| LIBGL_ALWAYS_SOFTWARE: "1" | |
| MESA_LOADER_DRIVER_OVERRIDE: llvmpipe | |
| GALLIUM_DRIVER: llvmpipe | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: >- | |
| ${{ fromJSON( | |
| (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| && '[{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.12"},{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.13"},{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.14"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.12"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.13"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.14"}]' | |
| || '[{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.12"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.12"}]' | |
| ) }} | |
| steps: | |
| - name: Cancel previous run | |
| uses: styfle/cancel-workflow-action@0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| - name: Install build dependencies | |
| run: | | |
| dnf install -y git curl wget zsh gcc gcc-c++ cmake make ninja-build tmux golang java-17-openjdk-devel qt5-qtbase-devel qt5-qtdeclarative-devel mesa-libEGL-devel mesa-libGL-devel libglvnd-devel mesa-dri-drivers | |
| dnf clean all | |
| ln -sf "$(qmake-qt5 -query QT_INSTALL_HEADERS)" /usr/include/qt | |
| go install github.com/bazelbuild/bazelisk@latest | |
| ln -sf /root/go/bin/bazelisk /usr/local/bin/bazelisk | |
| ln -sf /root/go/bin/bazelisk /usr/local/bin/bazel | |
| - name: Set up Python ${{ matrix.python-version }} | |
| shell: bash | |
| run: | | |
| case "${{ matrix.python-version }}" in | |
| 3.12) PYBIN=/opt/python/cp312-cp312/bin ;; | |
| 3.13) PYBIN=/opt/python/cp313-cp313/bin ;; | |
| 3.14) PYBIN=/opt/python/cp314-cp314/bin ;; | |
| *) echo "unsupported python version: ${{ matrix.python-version }}" >&2; exit 1 ;; | |
| esac | |
| echo "$PYBIN" >> "$GITHUB_PATH" | |
| "$PYBIN/python3" --version | |
| - name: Pin CMake 3 | |
| if: matrix.python-version == '3.14' | |
| shell: bash | |
| run: | | |
| python -m pip install "cmake<4" | |
| CMAKE_BIN_DIR="$(python -c "import cmake; print(cmake.CMAKE_BIN_DIR)")" | |
| CMAKE_BIN="$CMAKE_BIN_DIR/cmake" | |
| echo "$CMAKE_BIN_DIR" >> "$GITHUB_PATH" | |
| ln -sfn "$CMAKE_BIN" /usr/local/bin/cmake | |
| PATH="$CMAKE_BIN_DIR:$PATH" cmake --version | |
| - name: Prefer system libstdc++ for Mesa | |
| shell: bash | |
| run: | | |
| echo "LD_PRELOAD=$(g++ -print-file-name=libstdc++.so.6)" >> "$GITHUB_ENV" | |
| - name: Build | |
| run: | | |
| rm -rf dist wheelhouse | |
| make PYPI_WHEEL_PLAT=${{ matrix.auditwheel-plat }} pypi-wheel | |
| python -m pip install wheelhouse/*.whl --force-reinstall | |
| - name: Test | |
| run: | | |
| make release-test | |
| - name: Test without Linux Qt runtime | |
| run: | | |
| rpm -qa 'qt5-qtbase*' 'qt5-qtdeclarative*' | sort | |
| dnf remove -y 'qt5-qtbase*' 'qt5-qtdeclarative*' | |
| dnf clean all | |
| make PROCGEN_QT_RUNTIME=absent release-test-procgen-qt | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheel-linux-${{ matrix.arch }}-${{ matrix.python-version }} | |
| path: wheelhouse/ | |
| if-no-files-found: error | |
| release-windows: | |
| name: release-windows (py${{ matrix.python-version }}) | |
| runs-on: windows-2022 | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: >- | |
| ${{ fromJSON( | |
| (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| && '["3.12", "3.13", "3.14"]' | |
| || '["3.12"]' | |
| ) }} | |
| env: | |
| BAZEL_SH: C:/Program Files/Git/usr/bin/bash.exe | |
| MESA_GL_VERSION_OVERRIDE: 4.5COMPAT | |
| MSYS2_ARG_CONV_EXCL: "*" | |
| MSYS_NO_PATHCONV: "1" | |
| USE_BAZEL_VERSION: "9.2.0" | |
| steps: | |
| - name: Cancel previous run | |
| uses: styfle/cancel-workflow-action@0.11.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Shorten temp path | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path C:\tmp -Force | Out-Null | |
| Add-Content -Path $env:GITHUB_ENV -Value "TMP=C:\tmp" | |
| Add-Content -Path $env:GITHUB_ENV -Value "TEMP=C:\tmp" | |
| Add-Content -Path $env:GITHUB_ENV -Value "TMPDIR=C:\tmp" | |
| - name: Install Windows dependencies | |
| shell: pwsh | |
| run: | | |
| choco install -y cmake make ninja strawberryperl swig llvm | |
| if (-not (Test-Path "C:\Program Files\LLVM\bin\llvm-strip.exe")) { | |
| throw "llvm-strip.exe was not installed" | |
| } | |
| Add-Content -Path $env:GITHUB_PATH -Value "C:\Program Files\LLVM\bin" | |
| - name: Create Mesa directory | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path (Join-Path $env:GITHUB_WORKSPACE ".mesa") -Force | Out-Null | |
| - name: Install Mesa software OpenGL | |
| uses: f3d-app/install-mesa-windows-action@v1 | |
| with: | |
| path: ${{ github.workspace }}\.mesa | |
| - name: Export Mesa location | |
| shell: pwsh | |
| run: | | |
| Add-Content -Path $env:GITHUB_ENV -Value "ENVPOOL_DLL_DIR=$env:GITHUB_WORKSPACE\.mesa" | |
| Add-Content -Path $env:GITHUB_PATH -Value "$env:GITHUB_WORKSPACE\.mesa" | |
| - name: Install Qt 5 | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: "5.15.2" | |
| arch: "win64_msvc2019_64" | |
| set-env: "true" | |
| - name: Export Qt location | |
| shell: pwsh | |
| run: | | |
| Add-Content -Path $env:GITHUB_ENV -Value "BAZEL_RULES_QT_DIR=$env:QT_ROOT_DIR" | |
| Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $env:QT_ROOT_DIR "bin") | |
| Add-Content -Path $env:GITHUB_PATH -Value "C:\Program Files\Git\usr\bin" | |
| - name: Install bazelisk | |
| shell: pwsh | |
| run: | | |
| go install github.com/bazelbuild/bazelisk@latest | |
| Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $HOME "go/bin") | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Pin CMake 3 | |
| if: matrix.python-version == '3.14' | |
| shell: pwsh | |
| run: | | |
| python -m pip install "cmake<4" | |
| $cmakeBinDir = python -c "import cmake; print(cmake.CMAKE_BIN_DIR)" | |
| Add-Content -Path $env:GITHUB_PATH -Value $cmakeBinDir | |
| & (Join-Path $cmakeBinDir "cmake.exe") --version | |
| - name: Build | |
| shell: bash | |
| run: | | |
| rm -rf dist wheelhouse | |
| make RELEASE_PYTHON=${{ matrix.python-version }} pypi-wheel | |
| python -m pip install wheelhouse/*.whl --force-reinstall | |
| - name: Test | |
| shell: bash | |
| run: | | |
| make release-test | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheel-windows-${{ matrix.python-version }} | |
| path: wheelhouse/ | |
| if-no-files-found: error | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags') | |
| runs-on: ubuntu-latest | |
| needs: [release-linux, release-macos, release-windows] | |
| permissions: | |
| actions: read | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: wheel-* | |
| path: artifact | |
| merge-multiple: true | |
| - name: Move files so the next action can find them | |
| run: | | |
| mkdir dist && mv artifact/* dist/ | |
| ls dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| skip-existing: true | |
| - name: Create GitHub release and upload wheels | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1 || \ | |
| gh release create "${GITHUB_REF_NAME}" \ | |
| --title "${GITHUB_REF_NAME}" \ | |
| --generate-notes \ | |
| --verify-tag | |
| gh release upload "${GITHUB_REF_NAME}" dist/*.whl --clobber |