From 4086ec990f532db569485632d23f7bf8b74c7155 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 26 Mar 2026 21:51:22 -0700 Subject: [PATCH] ci: enable windows bazel workflow --- .github/workflows/bazel.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 79d963a537..2d8ec1a23f 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -39,18 +39,24 @@ jobs: # - os: ubuntu-24.04-arm # target: aarch64-unknown-linux-gnu - # TODO: Enable Windows once we fix the toolchain issues there. - #- os: windows-latest - # target: x86_64-pc-windows-gnullvm + # Windows + - os: windows-latest + target: x86_64-pc-windows-gnullvm runs-on: ${{ matrix.os }} # Configure a human readable name for each job name: Local Bazel build on ${{ matrix.os }} for ${{ matrix.target }} steps: + - name: Skip non-Windows Bazel PR jobs + if: github.event_name == 'pull_request' && runner.os != 'Windows' + run: echo "Skipping non-Windows Bazel job while iterating on Windows support." + - uses: actions/checkout@v6 + if: github.event_name != 'pull_request' || runner.os == 'Windows' - name: Set up Node.js for js_repl tests + if: github.event_name != 'pull_request' || runner.os == 'Windows' uses: actions/setup-node@v6 with: node-version-file: codex-rs/node-version.txt @@ -58,10 +64,11 @@ jobs: # Some integration tests rely on DotSlash being installed. # See https://github.com/openai/codex/pull/7617. - name: Install DotSlash + if: github.event_name != 'pull_request' || runner.os == 'Windows' uses: facebook/install-dotslash@v2 - name: Make DotSlash available in PATH (Unix) - if: runner.os != 'Windows' + if: github.event_name != 'pull_request' && runner.os != 'Windows' run: cp "$(which dotslash)" /usr/local/bin - name: Make DotSlash available in PATH (Windows) @@ -71,16 +78,18 @@ jobs: # Install Bazel via Bazelisk - name: Set up Bazel + if: github.event_name != 'pull_request' || runner.os == 'Windows' uses: bazelbuild/setup-bazelisk@v3 - name: Check MODULE.bazel.lock is up to date - if: matrix.os == 'ubuntu-24.04' && matrix.target == 'x86_64-unknown-linux-gnu' + if: github.event_name != 'pull_request' && matrix.os == 'ubuntu-24.04' && matrix.target == 'x86_64-unknown-linux-gnu' shell: bash run: ./scripts/check-module-bazel-lock.sh # Restore bazel repository cache so we don't have to redownload all the external dependencies # on every CI run. - name: Restore bazel repository cache + if: github.event_name != 'pull_request' || runner.os == 'Windows' id: cache_bazel_repository_restore uses: actions/cache/restore@v5 with: @@ -95,9 +104,15 @@ jobs: shell: pwsh run: | # Use a very short path to reduce argv/path length issues. - "BAZEL_STARTUP_ARGS=--output_user_root=C:\" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "BAZEL_STARTUP_ARGS=--output_user_root=D:\" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Enable Git long paths (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: git config --global core.longpaths true - name: bazel test //... + if: github.event_name != 'pull_request' || runner.os == 'Windows' env: BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} shell: bash @@ -224,7 +239,7 @@ jobs: # Save bazel repository cache explicitly; make non-fatal so cache uploading # never fails the overall job. Only save when key wasn't hit. - name: Save bazel repository cache - if: always() && !cancelled() && steps.cache_bazel_repository_restore.outputs.cache-hit != 'true' + if: (github.event_name != 'pull_request' || runner.os == 'Windows') && always() && !cancelled() && steps.cache_bazel_repository_restore.outputs.cache-hit != 'true' continue-on-error: true uses: actions/cache/save@v5 with: