Skip to content

Commit

Permalink
Run Bazel CI on Windows
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 655960875
  • Loading branch information
sfreilich authored and copybara-github committed Jul 25, 2024
1 parent 6754cff commit 0bbaec0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 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
9 changes: 7 additions & 2 deletions .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
- name: Test (Linux and Mac config)
if: runner.os != 'Windows'
run: bazel test --test_output=errors //...

- name: Test (Windows config)
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",
],
)

1 comment on commit 0bbaec0

@sebgod
Copy link

@sebgod sebgod commented on 0bbaec0 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it somehow possible to configure this to also suppot building for Windows on ARM64? Preferrably by cross-compiling on a Windows x64 (as thats the only thing GitHub runners support AFAIK)

Please sign in to comment.