Reorganize rules_cc buildkite config. Use yaml merging for target lists and flags; we've had issues with those not being consistently set between e.g. test and coverage Replace mentions of bazel 6 with bazel_less_than_9 Add coverage to ubuntu2004_rolling for consistency (can consider not running coverage on as many things as we currently do). Use Bazel 7/8/9.x in rules_based toolchains for consistency instead of specific versions. Tests migrated from builtins_bzl seem to work fine with legacy bazels, eliminating the head/rolling/9 target selection distinction I introduced in that change. Leaving the no_windows and no_macos tags in for now but we'll probably want to delete them in the future. PiperOrigin-RevId: 934941969 Change-Id: I6eea589460fbcfcab698afb0804c4a04a98bd5a0
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 195e5b5..e23672d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml
@@ -1,101 +1,63 @@ --- -build_targets_head: &build_targets_head - - "//:all" - - "//cc/..." - - "//examples/..." - - "//tests/..." - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. -test_targets_head: &test_targets_head - - "//:all" - - "//cc/..." - - "//examples/..." - - "//tests/..." - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. +.all_targets: &common_targets + ? "//:all" + ? "//cc/..." + ? "//examples/..." + ? "//tests/..." + ? "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. -build_targets: &build_targets - - "//:all" - - "//cc/..." - - "//examples/..." - - "//tests/..." - - "-//tests/builtins_bzl/..." # Only intended to work at HEAD - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. -test_targets: &test_targets - - "//:all" - - "//cc/..." - - "//examples/..." - - "//tests/..." - - "-//tests/builtins_bzl/..." # Only intended to work at HEAD - - "-//tests/system_library:system_library_test" # Only intended to work in WORKSPACE files - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. -coverage_targets: &coverage_targets - - "//:all" - - "//cc/..." - - "//examples/..." - - "//tests/..." - - "-//tests/integration/..." - - "-//tests/system_library:system_library_test" # Only intended to work in WORKSPACE files - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. +.build_targets: &build_targets + <<: *common_targets -build_targets_bazel_6: &build_targets_bazel_6 - - "//:all" - - "//cc:all" - - "//examples/..." - - "//tests/..." - - "-//tests/rule_based_toolchain/..." # proto.encode_text doesn't support None - - "-//tests/builtins_bzl/..." # Only intended to work at HEAD - - "-//cc:optional_current_cc_toolchain" # Not supported in Bazel 6 - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. -test_targets_bazel_6: &test_targets_bazel_6 - - "//:all" - - "//cc:all" - - "//examples/..." - - "//tests/..." - - "-//tests/builtins_bzl/..." # Only intended to work at HEAD - - "-//tests/rule_based_toolchain/..." # proto.encode_text doesn't support None - - "-//cc:optional_current_cc_toolchain" # Not supported in Bazel 6 - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. - - "-//tests/system_library:system_library_test" # Should be skipped on Windows and MacOS - - "-//tests/cc/common:test_runtime_dynamic_libraries_copy_behavior" # known bug, see https://github.com/bazelbuild/rules_cc/pull/623 - - "-//tests/strip_include_prefix:test_include_textual" # Not supported in bazel <9. -coverage_targets_bazel_6: &coverage_targets_bazel_6 - - "//:all" - - "//cc:all" - - "//examples/..." - - "//tests/..." - - "-//tests/builtins_bzl/..." # Only intended to work at HEAD - - "-//tests/integration/..." - - "-//tests/rule_based_toolchain/..." # proto.encode_text doesn't support None - - "-//cc:optional_current_cc_toolchain" # Not supported in Bazel 6 - - "-//tests/rule_based_toolchain/tool_map:_duplicate_action_test_subject" # Intentionally broken rule. - - "-//tests/system_library:system_library_test" # Should be skipped on Windows and MacOS - - "-//tests/cc/common:test_runtime_dynamic_libraries_copy_behavior" # known bug, see https://github.com/bazelbuild/rules_cc/pull/623 - - "-//tests/strip_include_prefix:test_include_textual" # Not supported in bazel <9. +.test_targets: &test_targets + <<: *common_targets + ? "-//tests/system_library:system_library_test" +.coverage_targets: &coverage_targets + <<: *common_targets + ? "-//tests/integration/..." +.targets_unsupported_by_bazel_less_than_9: &targets_unsupported_by_bazel_less_than_9 + ? "-//tests/rule_based_toolchain/..." # proto.encode_text doesn't support None + ? "-//cc:optional_current_cc_toolchain" # Not supported in Bazel 6 + ? "-//tests/system_library:system_library_test" # Should be skipped on Windows and MacOS + ? "-//tests/cc/common:test_runtime_dynamic_libraries_copy_behavior" # known bug, see https://github.com/bazelbuild/rules_cc/pull/623 + ? "-//tests/strip_include_prefix:test_include_textual" # Not supported in bazel <9. + ? "-//tests/builtins_bzl/..." # Only intended to work at HEAD -common_coverage_flags: &common_coverage_flags +.build_targets_bazel_less_than_9: &build_targets_bazel_less_than_9 + <<: *build_targets + <<: *targets_unsupported_by_bazel_less_than_9 +.test_targets_bazel_less_than_9: &test_targets_bazel_less_than_9 + <<: *test_targets + <<: *targets_unsupported_by_bazel_less_than_9 +.coverage_targets_bazel_less_than_9: &coverage_targets_bazel_less_than_9 + <<: *coverage_targets + <<: *targets_unsupported_by_bazel_less_than_9 + +.windows_test_flags: &windows_test_flags {} + +.macos_test_flags: &macos_test_flags {} + +.common_coverage_flags: &common_coverage_flags # Test failures are not collected under `coverage` invocations. # https://github.com/bazelbuild/continuous-integration/issues/1838 - - "--test_output=errors" + ? "--test_output=errors" -windows_coverage_flags: &windows_coverage_flags +.windows_coverage_flags: &windows_coverage_flags + <<: *common_coverage_flags + <<: *windows_test_flags # Starting in Bazel 9 coverage collection causes some tests to fail. # https://github.com/bazelbuild/rules_cc/issues/613 - - "--test_env=IGNORE_COVERAGE_COLLECTION_FAILURES=1" - # Test failures are not collected under `coverage` invocations. - # https://github.com/bazelbuild/continuous-integration/issues/1838 - - "--test_output=errors" + ? "--test_env=IGNORE_COVERAGE_COLLECTION_FAILURES=1" +.rule_based_toolchain_config: &rule_based_toolchain_config + working_directory: examples/rule_based_toolchain + build_flags: + - "--enable_bzlmod" + build_targets: + - "//..." -coverage_flags_bazel_less_than_9: &coverage_flags_bazel_less_than_9 - # See above - - "--test_output=errors" - - "--deleted_packages=//tests/local_includes" - -windows_coverage_flags_bazel_less_than_9: &windows_coverage_flags_bazel_less_than_9 - # See above - - "--test_env=IGNORE_COVERAGE_COLLECTION_FAILURES=1" - - "--test_output=errors" buildifier: version: latest @@ -114,26 +76,29 @@ name: Ubuntu 20.04 (Bazel HEAD) bazel: last_green platform: ubuntu2004 - build_targets: *build_targets_head - test_targets: *test_targets_head + build_targets: *build_targets + test_targets: *test_targets macos_intel_head: name: MacOS Intel (Bazel HEAD) bazel: last_green platform: macos - build_targets: *build_targets_head - test_targets: *test_targets_head + build_targets: *build_targets + test_targets: *test_targets + test_flags: *macos_test_flags macos_head: name: MacOS (Bazel HEAD) bazel: last_green platform: macos_arm64 - build_targets: *build_targets_head - test_targets: *test_targets_head + build_targets: *build_targets + test_targets: *test_targets + test_flags: *macos_test_flags windows_head: name: Windows (Bazel HEAD) bazel: last_green platform: windows - build_targets: *build_targets_head - test_targets: *test_targets_head + build_targets: *build_targets + test_targets: *test_targets + test_flags: *windows_test_flags # Bazel@rolling ubuntu2004_rolling: @@ -142,12 +107,15 @@ platform: ubuntu2004 build_targets: *build_targets test_targets: *test_targets + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets macos_intel_rolling: name: MacOS Intel (Bazel rolling) bazel: rolling platform: macos build_targets: *build_targets test_targets: *test_targets + test_flags: *macos_test_flags coverage_flags: *common_coverage_flags coverage_targets: *coverage_targets macos_rolling: @@ -156,6 +124,7 @@ platform: macos_arm64 build_targets: *build_targets test_targets: *test_targets + test_flags: *macos_test_flags coverage_flags: *common_coverage_flags coverage_targets: *coverage_targets windows_rolling: @@ -164,82 +133,87 @@ platform: windows build_targets: *build_targets test_targets: *test_targets + test_flags: *windows_test_flags coverage_flags: *windows_coverage_flags - coverage_targets: *test_targets + coverage_targets: *coverage_targets # Bazel 7 ubuntu2004_bazel_7: name: Ubuntu 20.04 (Bazel 7) bazel: 7.x platform: ubuntu2004 - build_flags: - - "--experimental_cc_static_library" - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 macos_intel_bazel_7: name: MacOS Intel (Bazel 7) bazel: 7.x platform: macos build_flags: - "--experimental_cc_static_library" - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *macos_test_flags + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 macos_bazel_7: name: MacOS (Bazel 7) bazel: 7.x platform: macos_arm64 build_flags: - "--experimental_cc_static_library" - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *macos_test_flags + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 windows_bazel_7: name: Windows (Bazel 7) bazel: 7.x platform: windows build_flags: - "--experimental_cc_static_library" - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *windows_test_flags # Bazel 8 ubuntu2004_bazel_8: name: Ubuntu 20.04 (Bazel 8) bazel: 8.x platform: ubuntu2004 - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 macos_intel_bazel_8: name: MacOS Intel (Bazel 8) bazel: 8.x platform: macos - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *macos_test_flags + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 macos_bazel_8: name: MacOS (Bazel 8) bazel: 8.x platform: macos_arm64 - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *coverage_flags_bazel_less_than_9 - coverage_targets: *coverage_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *macos_test_flags + coverage_flags: *common_coverage_flags + coverage_targets: *coverage_targets_bazel_less_than_9 windows_bazel_8: name: Windows (Bazel 8) bazel: 8.x platform: windows - build_targets: *build_targets_bazel_6 - test_targets: *test_targets_bazel_6 - coverage_flags: *windows_coverage_flags_bazel_less_than_9 - coverage_targets: *test_targets_bazel_6 + build_targets: *build_targets_bazel_less_than_9 + test_targets: *test_targets_bazel_less_than_9 + test_flags: *windows_test_flags + coverage_flags: *windows_coverage_flags + coverage_targets: *test_targets_bazel_less_than_9 # Bazel 9 ubuntu2004: @@ -256,6 +230,7 @@ platform: macos build_targets: *build_targets test_targets: *test_targets + test_flags: *macos_test_flags coverage_flags: *common_coverage_flags coverage_targets: *coverage_targets macos: @@ -264,6 +239,7 @@ platform: macos_arm64 build_targets: *build_targets test_targets: *test_targets + test_flags: *macos_test_flags coverage_flags: *common_coverage_flags coverage_targets: *coverage_targets windows: @@ -271,8 +247,10 @@ bazel: 9.x build_targets: *build_targets test_targets: *test_targets + test_flags: *windows_test_flags coverage_flags: *windows_coverage_flags coverage_targets: *test_targets + ubuntu_bzlmod: name: Ubuntu 20.04 (Bazel 9, bzlmod) bazel: 9.x @@ -281,77 +259,49 @@ - "--enable_bzlmod" - "--ignore_dev_dependency" -# Rules-based toolchains + # Rules-based toolchains ubuntu_rule_based_toolchains_bazel_7: name: Ubuntu rule-based toolchains (Bazel 7) - bazel: 7.2.1 + bazel: 7.x platform: ubuntu1804 - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config test_targets: - "//..." ubuntu_rule_based_toolchains_bazel_8: name: Ubuntu rule-based toolchains (Bazel 8) - bazel: 8.5.0 + bazel: 8.x platform: ubuntu1804 - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config test_targets: - "//..." ubuntu_rule_based_toolchains_bazel_9: name: Ubuntu rule-based toolchains (Bazel 9) - bazel: 9.0.0rc3 + bazel: 9.x platform: ubuntu1804 - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config test_targets: - "//..." macos_rule_based_toolchains_bazel_7: name: macOS rule-based toolchains (Bazel 7) - bazel: 7.2.1 + bazel: 7.x platform: macos - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config macos_rule_based_toolchains_bazel_8: name: macOS rule-based toolchains (Bazel 8) - bazel: 8.5.0 + bazel: 8.x platform: macos - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config macos_rule_based_toolchains_bazel_9: name: macOS rule-based toolchains (Bazel 9) - bazel: 9.0.0rc3 + bazel: 9.x platform: macos - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config macos_rule_based_toolchains: name: macOS rule-based toolchains platform: macos_arm64 - working_directory: examples/rule_based_toolchain - build_flags: - - "--enable_bzlmod" - build_targets: - - "//..." + <<: *rule_based_toolchain_config