Skip to content

Commit 8ee9936

Browse files
committed
ci: use new e2e setup
Drive tests entirely through bazel even on CI
1 parent 0732c88 commit 8ee9936

File tree

10 files changed

+106
-181
lines changed

10 files changed

+106
-181
lines changed

.bazelignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ e2e/bzlmod-toolchain-circular-dependencies/bazel-bin
2727
e2e/bzlmod-toolchain-circular-dependencies/bazel-out
2828
e2e/bzlmod-toolchain-circular-dependencies/bazel-bzlmod-toolchain-circular-dependencies
2929
e2e/bzlmod-toolchain-circular-dependencies/bazel-testlogs
30+
e2e/repo-yaml/bazel-bin
31+
e2e/repo-yaml/bazel-out
32+
e2e/repo-yaml/bazel-repo-yaml
33+
e2e/repo-yaml/bazel-testlogs

.bazelrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import %workspace%/.aspect/bazelrc/debug.bazelrc
66
import %workspace%/.aspect/bazelrc/performance.bazelrc
77

88
# Prevent Bazel from treating e2e child workspace BUILD files as packages
9-
common --deleted_packages=e2e/bazel-workspace,e2e/bazel-bzlmod,e2e/bazel-bzlmod-lock-file,e2e/bazel-bzlmod-lock-file-from-args,e2e/bazel-bzlmod-toolchain-from-source,e2e/bazel-bzlmod-toolchain-from-source-lock-file,e2e/bzlmod-toolchain-circular-dependencies
9+
# When adding a new e2e test then `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
10+
# needs to be executed
11+
common --deleted_packages=e2e/bazel-bzlmod,e2e/bazel-bzlmod-lock-file,e2e/bazel-bzlmod-lock-file-from-args,e2e/bazel-bzlmod-toolchain-from-source,e2e/bazel-bzlmod-toolchain-from-source-lock-file,e2e/bazel-workspace,e2e/bzlmod-toolchain-circular-dependencies,e2e/repo-yaml
1012

1113
# Specific project flags go here if we have some
1214

.github/workflows/action.yml

Lines changed: 9 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -34,155 +34,12 @@ jobs:
3434
try-import %workspace%/../../.github/workflows/ci.bazelrc
3535
# keep a cache for MODULE.bazel repos
3636
external-cache: true
37-
- run: bazelisk build //... && bazelisk test //...
38-
39-
e2e-workspace-matrix:
40-
strategy:
41-
matrix:
42-
version:
43-
- version: 6.x
44-
bazelrc: |
45-
import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc
46-
- version: 7.x
47-
bazelrc: |
48-
import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc
49-
import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc
50-
runs-on: ubuntu-latest
51-
steps:
52-
- uses: actions/checkout@v4
53-
- uses: bazel-contrib/[email protected]
54-
with:
55-
# Avoid downloading Bazel every time.
56-
bazelisk-cache: true
57-
# Keep a disk-cache
58-
disk-cache: true
59-
# Share repository cache between workflows.
60-
repository-cache: true
61-
# enable some flags for CI
62-
bazelrc: |
63-
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
64-
import %workspace%/../../.github/workflows/ci.bazelrc
65-
${{ matrix.version.bazelrc }}
66-
- run: cd e2e/bazel-workspace && USE_BAZEL_VERSION=${{ matrix.version.version }} bazelisk build //...
67-
68-
e2e-bzlmod-matrix:
69-
strategy:
70-
matrix:
71-
version: [7.x, 8.x]
72-
path:
73-
- bazel-bzlmod
74-
- bazel-bzlmod-lock-file
75-
76-
runs-on: ubuntu-latest
77-
steps:
78-
- uses: actions/checkout@v4
79-
- uses: bazel-contrib/[email protected]
80-
with:
81-
# Avoid downloading Bazel every time.
82-
bazelisk-cache: true
83-
# Keep a disk-cache
84-
disk-cache: true
85-
# Share repository cache between workflows.
86-
repository-cache: true
87-
# enable some flags for CI
88-
bazelrc: |
89-
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
90-
import %workspace%/../../.github/workflows/ci.bazelrc
91-
- run: cd e2e/${{ matrix.path }} && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //...
92-
93-
e2e-bzlmod-build-toolchain-matrix:
94-
strategy:
95-
matrix:
96-
version: [7.x, 8.x]
97-
98-
runs-on: ubuntu-latest
99-
steps:
100-
- uses: actions/checkout@v4
101-
- uses: bazel-contrib/[email protected]
102-
with:
103-
# Avoid downloading Bazel every time.
104-
bazelisk-cache: true
105-
# Keep a disk-cache
106-
disk-cache: true
107-
# Share repository cache between workflows.
108-
repository-cache: true
109-
# enable some flags for CI
110-
bazelrc: |
111-
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
112-
import %workspace%/../../.github/workflows/ci.bazelrc
113-
- run: cd e2e/bazel-bzlmod-toolchain-from-source && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //...
114-
115-
e2e-repo-yaml:
116-
runs-on: ubuntu-latest
117-
steps:
118-
- uses: actions/checkout@v4
119-
- uses: bazel-contrib/[email protected]
120-
with:
121-
# Avoid downloading Bazel every time.
122-
bazelisk-cache: true
123-
# Keep a disk-cache
124-
disk-cache: true
125-
# Share repository cache between workflows.
126-
repository-cache: true
127-
# enable some flags for CI
128-
bazelrc: |
129-
import %workspace%/.aspect/bazelrc/ci.bazelrc
130-
import %workspace%/.github/workflows/ci.bazelrc
131-
- run: |
132-
export USE_BAZEL_VERSION=7.x
133-
bazelisk run //cmd -- init --fc 41 --output $(pwd)/repo.yaml
134-
bazelisk run //cmd -- fetch --repofile $(pwd)/repo.yaml
135-
bazelisk run //cmd -- resolve --repofile $(pwd)/repo.yaml bash
136-
137-
e2e-bzlmod-lock-file-from-args:
138-
runs-on: ubuntu-latest
139-
steps:
140-
- uses: actions/checkout@v4
141-
- uses: bazel-contrib/[email protected]
142-
with:
143-
# Avoid downloading Bazel every time.
144-
bazelisk-cache: true
145-
# Keep a disk-cache
146-
disk-cache: true
147-
# Share repository cache between workflows.
148-
repository-cache: true
149-
# enable some flags for CI
150-
bazelrc: |
151-
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
152-
import %workspace%/../../.github/workflows/ci.bazelrc
153-
- run: |
154-
export USE_BAZEL_VERSION=8.x
155-
cd e2e/bazel-bzlmod-lock-file-from-args && bazelisk run :bazeldnf -- fetch && bazelisk run @bazeldnf_rpms//:update-lock-file && bazelisk build ...
156-
157-
e2e-bzlmod-toolchain-circular-dependencies:
158-
runs-on: ubuntu-latest
159-
steps:
160-
- uses: actions/checkout@v4
161-
- uses: bazel-contrib/[email protected]
162-
with:
163-
# Avoid downloading Bazel every time.
164-
bazelisk-cache: true
165-
# Keep a disk-cache
166-
disk-cache: true
167-
# Share repository cache between workflows.
168-
repository-cache: true
169-
# enable some flags for CI
170-
bazelrc: |
171-
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
172-
import %workspace%/../../.github/workflows/ci.bazelrc
173-
- id: prepare
174-
run: |
175-
export USE_BAZEL_VERSION=8.x
176-
cd e2e/bzlmod-toolchain-circular-dependencies
177-
bazelisk run @bazeldnf_rpms//:fetch-repo
178-
bazelisk run @bazeldnf_rpms//:update-lock-file
179-
- id: test
180-
run: |
181-
export USE_BAZEL_VERSION=8.x
182-
cd e2e/bzlmod-toolchain-circular-dependencies
183-
bazelisk build //... || status=$?
184-
if [ ${status} -ne 0 ]; then
185-
echo "::warning::Optional job failed."
186-
echo "optional_fail=true" >> "${GITHUB_OUTPUT}"
187-
echo "optional_fail_status=${status}" >> "${GITHUB_OUTPUT}"
188-
fi
37+
- id: build
38+
run: bazelisk build //...
39+
- id: unit-tests
40+
run: bazelisk test //...
41+
- id: e2e-that-should-pass
42+
run: bazelisk test e2e --notest_keep_going
43+
- id: e2e-that-are-allowed-to-fail
44+
continue-on-error: true
45+
run: bazel test //e2e:circular-deps --notest_keep_going

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ filegroup(
104104
srcs = [
105105
"MODULE.bazel",
106106
"WORKSPACE",
107+
"//:.github/workflows/ci.bazelrc",
107108
"//.aspect/bazelrc:all_files",
108109
"//bazeldnf:all_files",
109110
"//bazeldnf/private:all_files",

e2e/BUILD.bazel

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
load("@bazel_binaries//:defs.bzl", "bazel_binaries")
2-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
32
load(
43
"@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
54
"bazel_integration_tests",
@@ -23,13 +22,19 @@ default_test_runner(
2322
bazel_cmds = ["build --extra_toolchains=@bazeldnf//tools/e2e/output:toolchain //..."],
2423
)
2524

25+
DEFAULT_TEST_TAGS = [
26+
"manual",
27+
"exclusive", # TODO: remove once we manage CI to work properly
28+
"no-sandbox", # TODO: remove once we manage CI to work properly
29+
]
30+
2631
# bazel-workspace: legacy WORKSPACE mode (Bazel 6.x, 7.x)
2732
bazel_integration_tests(
2833
name = "e2e_workspace",
2934
timeout = "short",
3035
bazel_binaries = bazel_binaries,
3136
bazel_versions = WORKSPACE_BAZEL_VERSIONS,
32-
tags = ["manual"],
37+
tags = DEFAULT_TEST_TAGS,
3338
test_runner = ":test-runner",
3439
workspace_files = glob_workspace_files(
3540
"bazel-workspace",
@@ -46,7 +51,7 @@ bazel_integration_tests(
4651
timeout = "short",
4752
bazel_binaries = bazel_binaries,
4853
bazel_versions = BZLMOD_BAZEL_VERSIONS,
49-
tags = ["manual"],
54+
tags = DEFAULT_TEST_TAGS,
5055
test_runner = ":test-runner",
5156
workspace_files = glob_workspace_files(
5257
"bazel-bzlmod",
@@ -63,7 +68,7 @@ bazel_integration_tests(
6368
timeout = "short",
6469
bazel_binaries = bazel_binaries,
6570
bazel_versions = BZLMOD_BAZEL_VERSIONS,
66-
tags = ["manual"],
71+
tags = DEFAULT_TEST_TAGS,
6772
test_runner = ":test-runner",
6873
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file") + [
6974
"//:local_repository_files",
@@ -77,7 +82,7 @@ bazel_integration_tests(
7782
timeout = "short",
7883
bazel_binaries = bazel_binaries,
7984
bazel_versions = BZLMOD_BAZEL_VERSIONS,
80-
tags = ["manual"],
85+
tags = DEFAULT_TEST_TAGS,
8186
test_runner = ":test-runner",
8287
workspace_files = glob_workspace_files(
8388
"bazel-bzlmod-toolchain-from-source",
@@ -94,7 +99,7 @@ bazel_integration_tests(
9499
timeout = "short",
95100
bazel_binaries = bazel_binaries,
96101
bazel_versions = BZLMOD_BAZEL_VERSIONS,
97-
tags = ["manual"],
102+
tags = DEFAULT_TEST_TAGS,
98103
test_runner = ":test-runner",
99104
workspace_files = glob_workspace_files(
100105
"bazel-bzlmod-toolchain-from-source-lock-file",
@@ -119,7 +124,7 @@ bazel_integration_tests(
119124
timeout = "short",
120125
bazel_binaries = bazel_binaries,
121126
bazel_versions = BZLMOD_BAZEL_VERSIONS,
122-
tags = ["manual"],
127+
tags = DEFAULT_TEST_TAGS,
123128
test_runner = ":lock-file-from-args-runner",
124129
workspace_files = glob_workspace_files("bazel-bzlmod-lock-file-from-args") + [
125130
"//:local_repository_files",
@@ -141,9 +146,8 @@ bazel_integration_tests(
141146
timeout = "short",
142147
bazel_binaries = bazel_binaries,
143148
bazel_versions = BZLMOD_BAZEL_VERSIONS,
144-
tags = [
149+
tags = DEFAULT_TEST_TAGS + [
145150
"allowed-to-fail", # TODO: drop once the circular dependencies passes
146-
"manual",
147151
],
148152
test_runner = ":test-runner_circular_deps",
149153
workspace_files = glob_workspace_files(
@@ -155,9 +159,33 @@ bazel_integration_tests(
155159
workspace_path = "bzlmod-toolchain-circular-dependencies",
156160
)
157161

162+
default_test_runner(
163+
name = "test-runner-repo-yaml",
164+
bazel_cmds = [
165+
"run :bazeldnf -- init --fc 44 --output $(pwd)/repo.yaml",
166+
"run :bazeldnf -- fetch --repofile $(pwd)/repo.yaml",
167+
"run :bazeldnf -- resolve --repofile $(pwd)/repo.yaml bash",
168+
],
169+
)
170+
171+
bazel_integration_tests(
172+
name = "e2e_repo_yaml",
173+
timeout = "short",
174+
bazel_binaries = bazel_binaries,
175+
bazel_versions = BZLMOD_BAZEL_VERSIONS,
176+
tags = DEFAULT_TEST_TAGS,
177+
test_runner = ":test-runner-repo-yaml",
178+
workspace_files = glob_workspace_files("repo-yaml") + [
179+
"//:local_repository_files",
180+
],
181+
workspace_path = "repo-yaml",
182+
)
183+
184+
DEFAULT_TEST_SUITE_TAGS = ["manual"]
185+
158186
test_suite(
159187
name = "workspace",
160-
tags = ["manual"],
188+
tags = DEFAULT_TEST_SUITE_TAGS,
161189
tests = integration_test_utils.bazel_integration_test_names(
162190
"e2e_workspace",
163191
WORKSPACE_BAZEL_VERSIONS,
@@ -166,7 +194,7 @@ test_suite(
166194

167195
test_suite(
168196
name = "bzlmod",
169-
tags = ["manual"],
197+
tags = DEFAULT_TEST_SUITE_TAGS,
170198
tests = integration_test_utils.bazel_integration_test_names(
171199
"e2e_bzlmod",
172200
BZLMOD_BAZEL_VERSIONS,
@@ -175,7 +203,7 @@ test_suite(
175203

176204
test_suite(
177205
name = "bzlmod-lock-file",
178-
tags = ["manual"],
206+
tags = DEFAULT_TEST_SUITE_TAGS,
179207
tests = integration_test_utils.bazel_integration_test_names(
180208
"e2e_bzlmod_lock_file",
181209
BZLMOD_BAZEL_VERSIONS,
@@ -184,7 +212,7 @@ test_suite(
184212

185213
test_suite(
186214
name = "bzlmod-toolchain-from-source",
187-
tags = ["manual"],
215+
tags = DEFAULT_TEST_SUITE_TAGS,
188216
tests = integration_test_utils.bazel_integration_test_names(
189217
"e2e_bzlmod_toolchain_from_source",
190218
BZLMOD_BAZEL_VERSIONS,
@@ -193,9 +221,8 @@ test_suite(
193221

194222
test_suite(
195223
name = "circular-deps",
196-
tags = [
224+
tags = DEFAULT_TEST_SUITE_TAGS + [
197225
"allowed-to-fail", # TODO: drop once the circular dependencies passes
198-
"manual",
199226
],
200227
tests = integration_test_utils.bazel_integration_test_names(
201228
"e2e_circular_deps",
@@ -205,29 +232,34 @@ test_suite(
205232

206233
test_suite(
207234
name = "lock-file-from-args",
208-
tags = ["manual"],
235+
tags = DEFAULT_TEST_SUITE_TAGS,
209236
tests = integration_test_utils.bazel_integration_test_names(
210237
"e2e_lock_file_from_args",
211238
BZLMOD_BAZEL_VERSIONS,
212239
),
213240
)
214241

242+
test_suite(
243+
name = "repo-yaml",
244+
tags = DEFAULT_TEST_SUITE_TAGS,
245+
tests = integration_test_utils.bazel_integration_test_names(
246+
"e2e_repo_yaml",
247+
BZLMOD_BAZEL_VERSIONS,
248+
),
249+
)
250+
215251
test_suite(
216252
name = "e2e",
217-
tags = ["manual"],
253+
tags = DEFAULT_TEST_SUITE_TAGS,
218254
tests = [
219255
":workspace",
220256
":bzlmod",
221257
":bzlmod-lock-file",
222258
":bzlmod-toolchain-from-source",
223259
# ":circular-deps", # TODO: uncomment once circular dependencies are fixed
224260
":lock-file-from-args",
261+
":repo-yaml",
225262
],
226263
)
227264

228-
bzl_library(
229-
name = "helpers",
230-
srcs = ["helpers.bzl"],
231-
visibility = ["//visibility:public"],
232-
deps = ["@bazel_skylib//lib:paths"],
233-
)
265+
# gazelle:exclude helpers.bzl

0 commit comments

Comments
 (0)