Skip to content

Commit 42af1fc

Browse files
committed
CI: Set BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN and BAZEL_USE_CPP_ONLY_TOOLCHAIN
... for the job, according to the matrix.os value. This fixes the build for rules_haskell_tests on Windows with bzlmod, which failed with: ``` The target you are compiling requires Visual C++ build tools. Bazel couldn't find a valid Visual C++ build tools installation on your machine. ```
1 parent 124c6c4 commit 42af1fc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.github/workflows/workflow.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ jobs:
133133
- ghc: 9.4.6
134134
bzlmod: true
135135
env:
136+
# prevent auto-detection of system compilers on Windows
137+
BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN: ${{ matrix.os == 'windows-latest' && 1 || 0 }}
138+
# do not use Xcode on macOS
139+
BAZEL_USE_CPP_ONLY_TOOLCHAIN: ${{ matrix.os == 'macos-11' && 1 || 0 }}
136140
GHC_VERSION: ${{ matrix.ghc }}
137141
runs-on: ${{ matrix.os }}
138142
steps:
@@ -205,10 +209,7 @@ jobs:
205209
if: matrix.module == 'rules_haskell'
206210
shell: bash
207211
run: |
208-
[[ ${{ runner.os }} == macOS ]] && export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
209212
if [[ ${{ runner.os }} == Windows ]]; then
210-
# prevent auto-detection of system compilers
211-
export BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
212213
# On Windows `//...` expands to `/...`.
213214
bazel test ///...
214215
else
@@ -220,11 +221,8 @@ jobs:
220221
shell: bash
221222
run: |
222223
cd rules_haskell_tests
223-
[[ ${{ runner.os }} == macOS ]] && export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1
224224
./tests/run-start-script.sh --use-bindists --with-bzlmod=${{ matrix.bzlmod }}
225225
if [[ ${{ runner.os }} == Windows ]]; then
226-
# prevent auto-detection of system compilers
227-
export BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
228226
# On Windows `//...` expands to `/...`.
229227
bazel test ///...
230228
else

0 commit comments

Comments
 (0)