Skip to content

Commit

Permalink
Run Bazel CI on Windows
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 651462679
  • Loading branch information
sfreilich authored and copybara-github committed Jul 24, 2024
1 parent 6754cff commit c54ef03
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
12 changes: 8 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Set up to use C++20.
build --cxxopt='-std=c++20'
build --cxxopt=-std=c++20'

# Use the builtin crc32 for fast integer hashing.
build --copt=-mcrc32

# Enable Bzlmod for every Bazel command
common --enable_bzlmod

# Use the builtin crc32 for fast integer hashing.
build --copt=-mcrc32

# To create this file, please run:
# bazel run @com_google_fuzztest//bazel:setup_configs > fuzztest.bazelrc
try-import %workspace%/fuzztest.bazelrc

build:win_clang --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
build:win_clang --extra_execution_platforms=//:x64_windows-clang-cl
build:win_clang --compiler=clang-cl
build:win_clang --cxxopt=/std:c++20
7 changes: 6 additions & 1 deletion .github/workflows/bazel-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ jobs:
bazel_test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Test
if: runner.os != 'Windows'
run: bazel test --test_output=errors //...

- name: Test
if: runner.os == 'Windows'
run: bazel test --config=win_clang --test_output=errors //...
11 changes: 11 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ alias(
actual = "@com_google_googletest//:gtest",
visibility = ["//:__subpackages__"],
)

# For building with clang-cl.
# https://bazel.build/configure/windows#clang
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)

0 comments on commit c54ef03

Please sign in to comment.