Add windows CI

PiperOrigin-RevId: 520478558
pull/13171/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent c642e43a5a
commit d260ab343e
  1. 1
      .bazelrc
  2. 70
      .github/workflows/bazel_tests.yml
  3. 2
      BUILD
  4. 4
      cmake/BUILD.bazel
  5. 4
      protos_generator/gen_extensions.cc
  6. 2
      python/BUILD
  7. 8
      python/dist/BUILD.bazel
  8. 2
      python/pb_unit_tests/pyproto_test_wrapper.bzl
  9. 6
      upb/conformance/BUILD
  10. 4
      upb/message/accessors.h
  11. 9
      upb/mini_table/decode.h
  12. 2
      upb/util/BUILD
  13. 2
      upbc/BUILD
  14. 2
      upbc/subprocess.cc

@ -3,6 +3,7 @@ build --features=-debug_prefix_map_pwd_is_dot
# Pin to C++17
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build:cpp17_msvc --cxxopt=/std:c++17 --host_cxxopt=/std:c++17
# Use our custom-configured c++ toolchain.

@ -20,18 +20,18 @@ jobs:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
include:
# Temporarily disabled until Copybara fixes its cap of 30 jobs per PR.
# - { NAME: "Fastbuild", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "" }
# - { NAME: "Optmized", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "-c opt" } # Some warnings only fire with -c opt
- { NAME: "Fastbuild", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "" }
- { NAME: "Optmized", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "-c opt" } # Some warnings only fire with -c opt
- { NAME: "GCC Optimized", BAZEL: bazel, CC: gcc-12, os: ubuntu-22.04, flags: "-c opt" }
- { NAME: "FastTable", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "--//:fasttable_enabled=true -- -cmake:test_generated_files" }
- { NAME: "ASAN", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "--config=asan -c dbg -- -benchmarks:benchmark -python/..." }
- { NAME: "UBSAN", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "--config=ubsan -c dbg -- -benchmarks:benchmark -python/... -lua/...", install: "libunwind-dev" }
- { NAME: "32-bit", BAZEL: bazel, CC: clang, os: ubuntu-20-large, flags: "--copt=-m32 --linkopt=-m32 -- -... benchmarks:benchmark ", install: "g++-multilib" }
- { NAME: "macOS", BAZEL: bazel, CC: clang, os: macos-11, flags: "" }
- { NAME: "macOS", BAZEL: bazel, CC: clang, os: macos-11 }
- { NAME: "windows", BAZEL: bazel, os: windows-2019, startup-flags: "--output_user_root=C:/tmp", flags: "--config=cpp17_msvc", targets: "upb/... upbc/... python/... protos/... protos_generator/..." }
# We support two Bazel versions back per https://opensource.google/documentation/policies/cplusplus-support
- { NAME: "Bazel 4.1.0", BAZEL: bazel-4.1.0-linux-x86_64, CC: clang, os: ubuntu-20-large, flags: "" }
- { NAME: "Bazel 5.3.0", BAZEL: bazel-5.3.0-linux-x86_64, CC: clang, os: ubuntu-20-large, flags: "" }
- { NAME: "Bazel 4.1.0", BAZEL: bazel-4.1.0-linux-x86_64, CC: clang, os: ubuntu-20-large }
- { NAME: "Bazel 5.3.0", BAZEL: bazel-5.3.0-linux-x86_64, CC: clang, os: ubuntu-20-large }
name: ${{ matrix.NAME }}
@ -52,44 +52,48 @@ jobs:
wget -O $FILENAME https://github.com/bazelbuild/bazel/releases/download/$VERSION/${{ matrix.BAZEL }}
chmod a+x $FILENAME
if: ${{ matrix.BAZEL != 'bazel' }}
- name: Check tool versions
run: |
${{ matrix.CC }} --version
${{ matrix.BAZEL }} --version
- name: Check compiler versions
if: matrix.CC
run: ${{ matrix.CC }} --version
- name: Check Bazel versions
run: ${{ matrix.BAZEL }} --version
- id: bazel-cache
name: Set up Bazel caching
uses: ./.github/actions/setup-bazel-cache
- name: Setup Python venv
if: ${{ runner.os != 'Windows' }}
run: rm -rf /tmp/venv && python3 -m venv /tmp/venv && source /tmp/venv/bin/activate && python3 --version
- name: Install dependencies
run: sudo apt update && sudo apt install -y ${{ matrix.install }}
if: matrix.install != ''
- name: Install numpy
run: source /tmp/venv/bin/activate && pip3 install numpy
run: pip3 install numpy
- name: Setup environment variables
if: matrix.CC
run: echo "CC=${{ matrix.CC }}" >> $GITHUB_ENV
- name: Run tests
run: cd ${{ github.workspace }} && source /tmp/venv/bin/activate && CC=${{ matrix.CC }} ${{ matrix.BAZEL }} test --test_output=errors ${{ steps.bazel-cache.outputs.cache_args }} ... ${{ matrix.flags }}
run: cd ${{ github.workspace }} && ${{ matrix.BAZEL }} ${{ matrix.startup-flags }} test --test_output=errors ${{ steps.bazel-cache.outputs.cache_args }} ${{ matrix.targets | "..." }} ${{ matrix.flags }}
# Temporarily disabled until Copybara fixes its cap of 30 jobs per PR.
# no-python:
# runs-on: ubuntu-20-large
no-python:
runs-on: ubuntu-20-large
# strategy:
# fail-fast: false # Don't cancel all jobs if one fails.
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
# name: "No System Python"
name: "No System Python"
# steps:
# - uses: actions/checkout@v2
# - name: Set up Cloud SDK
# uses: google-github-actions/auth@v0
# with:
# credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
# export_environment_variables: true
# if: ${{ github.event.pull_request.head.repo.full_name == 'protocolbuffers/upb' }}
# - id: bazel-cache
# name: Set up Bazel caching
# uses: ./.github/actions/setup-bazel-cache
# - name: Uninstall python
# run: which python3 && sudo mv `which python3` /tmp && ! which python3
# - name: Run tests
# run: cd ${{ github.workspace }} && bazel test --test_output=errors ${{ steps.bazel-cache.outputs.cache_args }} //python/... -- -//python/dist:source_wheel
steps:
- uses: actions/checkout@v2
- name: Set up Cloud SDK
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
export_environment_variables: true
if: ${{ github.event.pull_request.head.repo.full_name == 'protocolbuffers/upb' }}
- id: bazel-cache
name: Set up Bazel caching
uses: ./.github/actions/setup-bazel-cache
- name: Uninstall python
run: which python3 && sudo mv `which python3` /tmp && ! which python3
- name: Run tests
run: cd ${{ github.workspace }} && bazel test --test_output=errors ${{ steps.bazel-cache.outputs.cache_args }} //python/... -- -//python/dist:source_wheel

@ -677,7 +677,7 @@ cc_test(
],
# TODO(b/259158612): fix this test on Windows.
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [

@ -102,5 +102,9 @@ sh_test(
"//:cmake_files",
"@utf8_range//:utf8_range_srcs",
],
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = ["@bazel_tools//tools/bash/runfiles"],
)

@ -84,14 +84,14 @@ void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext,
if (ext->extension_scope()) {
output(
R"cc(
constexpr ::protos::internal::ExtensionIdentifier<$0, $3> $4::$2(&$1);
const ::protos::internal::ExtensionIdentifier<$0, $3> $4::$2(&$1);
)cc",
ContainingTypeName(ext), mini_table_name, ext->name(),
CppTypeParameterName(ext), ClassName(ext->extension_scope()));
} else {
output(
R"cc(
constexpr ::protos::internal::ExtensionIdentifier<$0, $3> $2(&$1);
const ::protos::internal::ExtensionIdentifier<$0, $3> $2(&$1);
)cc",
ContainingTypeName(ext), mini_table_name, ext->name(),
CppTypeParameterName(ext));

@ -192,7 +192,7 @@ pkg_files(
# end:github_only
# begin:google_only
# _message_target_compatible_with = {
# "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
# "@platforms//os:windows": ["@platforms//:incompatible"],
# "//conditions:default": [],
# }
# end:google_only

@ -220,6 +220,10 @@ pkg_tar(
extension = "tar.gz",
package_dir = "protobuf",
package_file_name = "protobuf.tar.gz",
target_compatible_with = select({
"@system_python//:none": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
genrule(
@ -234,6 +238,10 @@ genrule(
cd ..
mv protobuf/dist/*.tar.gz $@
""",
target_compatible_with = select({
"@system_python//:none": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
py_wheel(

@ -36,7 +36,7 @@ def pyproto_test_wrapper(name, deps = []):
# "//net/proto2/python/public:use_upb_protos",
# ],
# target_compatible_with = select({
# "@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
# "@platforms//os:windows": ["@platforms//:incompatible"],
# "//conditions:default": [],
# }),
# )

@ -75,7 +75,7 @@ cc_binary(
copts = UPB_DEFAULT_COPTS,
data = ["conformance_upb_failures.txt"],
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [
@ -109,7 +109,7 @@ sh_test(
"@com_google_protobuf//conformance:conformance_test_runner",
],
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = ["@bazel_tools//tools/bash/runfiles"],
@ -124,7 +124,7 @@ cc_binary(
],
data = ["conformance_upb_failures.txt"],
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [

@ -572,7 +572,7 @@ UPB_API_INLINE upb_Message* upb_Message_GetOrCreateMutableMessage(
UPB_API_INLINE const upb_Array* upb_Message_GetArray(
const upb_Message* msg, const upb_MiniTableField* field) {
_upb_MiniTableField_CheckIsArray(field);
const upb_Array* ret;
upb_Array* ret;
const upb_Array* default_val = NULL;
_upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
return ret;
@ -626,7 +626,7 @@ UPB_API_INLINE bool upb_MiniTableField_IsClosedEnum(
UPB_API_INLINE const upb_Map* upb_Message_GetMap(
const upb_Message* msg, const upb_MiniTableField* field) {
_upb_MiniTableField_CheckIsMap(field);
const upb_Map* ret;
upb_Map* ret;
const upb_Map* default_val = NULL;
_upb_Message_GetNonExtensionField(msg, field, &default_val, &ret);
return ret;

@ -104,7 +104,8 @@ UPB_API upb_MiniTableExtension* _upb_MiniTableExtension_Build(
UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
const char* data, size_t len, const upb_MiniTable* extendee,
upb_Arena* arena, upb_Status* status) {
upb_MiniTableSub sub = {.submsg = NULL};
upb_MiniTableSub sub;
sub.submsg = NULL;
return _upb_MiniTableExtension_Build(
data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
}
@ -112,7 +113,8 @@ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_Build(
UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
const char* data, size_t len, const upb_MiniTable* extendee,
upb_MiniTable* submsg, upb_Arena* arena, upb_Status* status) {
upb_MiniTableSub sub = {.submsg = submsg};
upb_MiniTableSub sub;
sub.submsg = submsg;
return _upb_MiniTableExtension_Build(
data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
}
@ -120,7 +122,8 @@ UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildMessage(
UPB_API_INLINE upb_MiniTableExtension* upb_MiniTableExtension_BuildEnum(
const char* data, size_t len, const upb_MiniTable* extendee,
upb_MiniTableEnum* subenum, upb_Arena* arena, upb_Status* status) {
upb_MiniTableSub sub = {.subenum = subenum};
upb_MiniTableSub sub;
sub.subenum = subenum;
return _upb_MiniTableExtension_Build(
data, len, extendee, sub, kUpb_MiniTablePlatform_Native, arena, status);
}

@ -153,7 +153,7 @@ cc_test(
srcs = ["compare_test.cc"],
# TODO(b/259158757): fix this test on Windows.
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [

@ -290,7 +290,7 @@ cc_binary(
],
copts = UPB_DEFAULT_CPPOPTS,
target_compatible_with = select({
"@platforms//os:windows": ["//third_party/bazel_platforms:incompatible"],
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],

@ -34,7 +34,7 @@
#include <cstring>
#include <iostream>
#ifndef _WIN32
#ifndef _MSVC_LANG
#include <errno.h>
#include <signal.h>
#include <sys/select.h>

Loading…
Cancel
Save