-
Notifications
You must be signed in to change notification settings - Fork 4
/
BUILD.bazel
130 lines (115 loc) · 3.45 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@cgrindel_bazel_starlib//shlib/rules:execute_binary.bzl", "execute_binary")
load(
"@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
"bazel_integration_tests",
"integration_test_utils",
)
load("//ci:defs.bzl", "ci_integration_test_params")
bzlformat_pkg(name = "bzlformat")
# Do not have Gazelle process the child workspace
# gazelle:exclude simple/**
filegroup(
name = "doc_files",
srcs = glob(["*.md"]) + [
"simple/WORKSPACE",
],
visibility = ["//:markdown_test_visibility"],
)
# MARK: - Integration Tests
# NOTE: We cannot use the default_test_runner macro because we are using select
# to specify the args. The select function can only be used with rules. For
# more information, see
# https://github.com/bazelbuild/bazel/issues/8419
# https://github.com/bazelbuild/bazel/issues/14157
_COMMON_ARGS = [
"--bazel_cmd",
"info",
]
_ARGS_SELECT_DICT = {
"//build:ci": [
"--bazel_cmd",
"test //... --//:execution_env=ci",
],
"//conditions:default": [
"--bazel_cmd",
"test //... --//:execution_env=normal",
],
}
# Define the shell binary
sh_binary(
name = "simple_test_runner_binary",
srcs = [
"@rules_bazel_integration_test//bazel_integration_test/private:default_test_runner.sh",
],
args = _COMMON_ARGS + select(_ARGS_SELECT_DICT),
deps = [
"@bazel_tools//tools/bash/runfiles",
"@cgrindel_bazel_starlib//shlib/lib:messages",
],
)
# Wrap the arguments with the binary.
execute_binary(
name = "simple_test_runner",
arguments = _COMMON_ARGS + select(_ARGS_SELECT_DICT),
binary = ":simple_test_runner_binary",
)
bazel_integration_tests(
name = "simple_test",
bazel_binaries = bazel_binaries,
bazel_versions = bazel_binaries.versions.all,
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS + [
# Avoid file permssion error when using disk and repository cache after
# 7.0.0rc2 upgrade.
# https://github.com/bazelbuild/bazel/issues/19908
"no-sandbox",
],
test_runner = ":simple_test_runner",
workspace_files = integration_test_utils.glob_workspace_files("simple") + [
"//:workspace_integration_test_files",
],
workspace_path = "simple",
)
# MARK: - Test Suites
test_suite(
name = "smoke_integration_tests",
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS,
tests = [
integration_test_utils.bazel_integration_test_name(
"simple_test",
bazel_binaries.versions.current,
),
],
visibility = ["//:__subpackages__"],
)
test_suite(
name = "all_integration_tests",
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS,
tests = integration_test_utils.bazel_integration_test_names(
"simple_test",
bazel_binaries.versions.all,
),
visibility = ["//:__subpackages__"],
)
ci_integration_test_params(
name = "simple_test_params",
bzlmod_modes = [
"enabled",
"disabled",
],
oss = [
"macos",
"linux",
],
test_names = integration_test_utils.bazel_integration_test_names(
"simple_test",
bazel_binaries.versions.all,
),
visibility = ["//:__subpackages__"],
)
alias(
name = "all_test_params",
actual = ":simple_test_params",
visibility = ["//:__subpackages__"],
)