-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
105 lines (92 loc) · 3.08 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
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load(
"@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
"bazel_integration_test",
"default_test_runner",
"integration_test_utils",
)
bzlformat_pkg(name = "bzlformat")
# MARK: - Shared Attribute Values
ADDITIONAL_WORKSPACE_FILES = [
# The example workspaces reference the *.bazelrc files in the parent.
"//:shared_bazelrc_files",
# The example workspaces use local_repository to reference this
# workspace.
"//:local_repository_files",
]
# MARK: - Integration Tests
_EXAMPLE_NAMES = [
"simple",
"exclude_files",
"rules_swift_helpers",
"legacy",
]
default_test_runner(
name = "default_test_runner",
)
# Integration tests executed against current version of Bazel
[
bazel_integration_test(
name = example + "_test",
bazel_binaries = bazel_binaries,
bazel_version = bazel_binaries.versions.current,
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 = ":default_test_runner",
workspace_files = integration_test_utils.glob_workspace_files(example) +
ADDITIONAL_WORKSPACE_FILES,
workspace_path = example,
)
for example in _EXAMPLE_NAMES
]
sh_binary(
name = "change_update_all_test_runner",
testonly = True,
srcs = ["change_update_all_test.sh"],
data = [
"@rules_bazel_integration_test//tools:create_scratch_dir",
],
deps = [
"@bazel_tools//tools/bash/runfiles",
"@cgrindel_bazel_starlib//shlib/lib:assertions",
],
)
# Integration tests executed against current version of Bazel with custom test runner
bazel_integration_test(
name = "change_update_all_test",
bazel_binaries = bazel_binaries,
bazel_version = bazel_binaries.versions.current,
test_runner = ":change_update_all_test_runner",
workspace_files = integration_test_utils.glob_workspace_files("simple") +
ADDITIONAL_WORKSPACE_FILES,
workspace_path = "simple",
)
# GH085: Disabled because 7.0.0-pre.20230504.4 fails.
# bazel_integration_tests(
# name = "simple_test",
# bazel_versions = bazel_binaries.versions.other,
# test_runner = ":default_test_runner",
# workspace_files = integration_test_utils.glob_workspace_files("simple") +
# ADDITIONAL_WORKSPACE_FILES,
# workspace_path = "simple",
# )
# MARK: - Test Suites
test_suite(
name = "integration_tests",
tags = integration_test_utils.DEFAULT_INTEGRATION_TEST_TAGS,
tests = [
":change_update_all_test",
] + [
example + "_test"
for example in _EXAMPLE_NAMES
] + integration_test_utils.bazel_integration_test_names(
"simple_test",
bazel_binaries.versions.other,
),
visibility = ["//:__subpackages__"],
)