Reduce GitHub Actions macOS worker demand #974
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: Windows | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] | |
| paths-ignore: | |
| - "doc/**" | |
| - "README.md" | |
| - "CODE_OF_CONDUCT.md" | |
| - "LICENSE.txt" | |
| - ".gitignore" | |
| - ".gitattributes" | |
| - ".gitmodules" | |
| - ".lldbinit" | |
| - ".github/**" | |
| - "!.github/workflows/testing-windows.yml" | |
| - "packaging/**" | |
| - "Makefile" | |
| - "Makefile.inc" | |
| - 'run-clang-tidy.sh' | |
| - '**.clang-tidy' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| windows: | |
| if: "!contains(github.event.pull_request.labels.*.name, 'skip_buildbots')" | |
| name: windows-${{ matrix.bits }} / ${{ matrix.uv_group }} | |
| runs-on: windows-2022 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| bits: [ "32" ] # Intentionally not 64, as we haven't configured self-hosted runners for it yet. | |
| uv_group: [ "ci-llvm-main", "ci-llvm-22", "ci-llvm-21" ] | |
| include: | |
| - bits: 32 | |
| arch: x86 | |
| python: cpython-3.10.20-windows-x86-none | |
| # - bits: 64 # Intentionally not 64, as we haven't configured self-hosted runners for it yet. | |
| # arch: x64 | |
| # python: cpython-3.10.20-windows-x86_64-none | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Sync CI environment | |
| run: | | |
| # uv uses the host platform for dependency resolution regardless of the target | |
| # Python, so on Windows it would download x86_64 halide-llvm (~250MB) even for | |
| # a 32-bit build. Instead: read the pinned version from the lockfile (no download), | |
| # sync only ci-base (no LLVM), then fetch the correct win32 wheel directly. | |
| # pypi.halide-lang.org's upstream network path intermittently | |
| # blackholes a source IP for tens of seconds to a few minutes | |
| # (root-caused in halide/build_bot#362, escalated to MIT network | |
| # ops). uv's own retries only span ~47s, which wasn't always | |
| # enough, so this retries harder (5 attempts, backoff doubling | |
| # 60s -> 300s) and logs the runner's egress IP plus a path trace | |
| # to the PyPI host on each failure, so a specific incident's | |
| # 5-tuple/timestamp can be handed to MIT for correlation. | |
| retry() { | |
| local i n=5 delay=60 max_delay=300 | |
| for ((i = 1; i <= n; i++)); do | |
| if "$@"; then return 0; fi | |
| if [ "$i" -lt "$n" ]; then | |
| echo "::warning::CI env sync attempt $i/$n failed at $(date -u +%FT%TZ); retrying in ${delay}s" | |
| echo "::group::Network diagnostics (attempt $i/$n)" | |
| echo "egress IP: $(curl -s --max-time 5 https://api.ipify.org || echo unknown)" | |
| if command -v tracepath >/dev/null 2>&1; then | |
| tracepath -m 15 pypi.halide-lang.org || true | |
| elif command -v traceroute >/dev/null 2>&1; then | |
| traceroute -m 15 -w 2 pypi.halide-lang.org || true | |
| elif command -v tracert >/dev/null 2>&1; then | |
| tracert -h 15 -w 2000 pypi.halide-lang.org || true | |
| else | |
| echo "no traceroute tool available" | |
| fi | |
| echo "::endgroup::" | |
| sleep "$delay" | |
| delay=$((delay * 2 > max_delay ? max_delay : delay * 2)) | |
| fi | |
| done | |
| return 1 | |
| } | |
| LLVM_VER=$(uv export --group '${{ matrix.uv_group }}' --no-emit-project \ | |
| | awk -F'==' '/^halide-llvm==/ { gsub(/ .*/, "", $2); print $2 }') | |
| uv sync --python '${{ matrix.python }}' --group ci-base --no-install-project | |
| retry uv pip install --python-platform i686-pc-windows-msvc --only-binary :all: \ | |
| --extra-index-url https://pypi.halide-lang.org/simple/ \ | |
| "halide-llvm==${LLVM_VER}" | |
| echo "${GITHUB_WORKSPACE}/.venv/Scripts" >> "$GITHUB_PATH" | |
| echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}/.venv" >> "$GITHUB_ENV" | |
| - name: Configure LLVM | |
| run: echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV" | |
| - name: Configure CMake | |
| run: cmake --preset ci-windows-x86-${{ matrix.bits }} | |
| - name: Initial build | |
| run: cmake --build build | |
| - name: Test (host) | |
| run: | | |
| cmake -S . -B build -DHalide_TARGET=host | |
| cmake --build build | |
| ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -LE performance -j "$(nproc)" | |
| ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -L performance --repeat until-pass:5 | |
| - name: Test (no extensions) | |
| run: | | |
| cmake -S . -B build -DHalide_TARGET=cmake | |
| cmake --build build | |
| ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -LE performance -j "$(nproc)" | |
| ctest --test-dir build --build-config RelWithDebInfo --output-on-failure -L performance --repeat until-pass:5 |