Skip to content

Commit a80705e

Browse files
committed
Move subrepo e2e tests to workflows
Meaningfully faster; more product usage.
1 parent df3d98c commit a80705e

File tree

5 files changed

+72
-10
lines changed

5 files changed

+72
-10
lines changed

.aspect/workflows/config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# See https://docs.aspect.build/workflows/configuration
2+
workspaces:
3+
# SYNC: e2e
4+
# {{{
5+
- .
6+
- e2e/cross-repo-610
7+
- e2e/interpreter-version-541
8+
- e2e/repository-rule-deps
9+
- e2e/smoke
10+
- e2e/system-interpreter
11+
- examples/uv_pip_compile
12+
# }}}
213
tasks:
314
- test:
415
queue: aspect-large
516
- finalization:
617
queue: aspect-small
18+
719
notifications:
820
github: {}

.github/workflows/ci.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,14 @@ jobs:
2828
# NB: the root folder is tested with Aspect Workflows on BuildKite, see /.aspect/workflows/config.yaml
2929
folders: |
3030
[
31-
"e2e/cross-repo-610",
32-
"e2e/interpreter-version-541",
33-
"e2e/repository-rule-deps",
3431
"e2e/smoke",
35-
"e2e/system-interpreter",
36-
"examples/uv_pip_compile"
3732
]
3833
# TODO: Build Windows tools and add to toolchain
3934
# TODO(alex): switch the root folder to bzlmod
4035
# TODO: fix remaining folders on Bazel 8
4136
exclude: |
4237
[
4338
{"os": "windows-latest"},
44-
{"folder": "e2e/cross-repo-610", "bzlmodEnabled": false},
45-
{"folder": "e2e/interpreter-version-541", "bzlmodEnabled": false},
46-
{"folder": "e2e/repository-rule-deps", "bzlmodEnabled": false},
47-
{"folder": "e2e/system-interpreter", "bzlmodEnabled": false},
48-
{"folder": "examples/uv_pip_compile", "bzlmodEnabled": false},
4939
{"folder": "e2e/smoke", "bazelversion": "8.0.0"}
5040
]
5141

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,10 @@ repos:
6161
entry: /bin/sh -c '/usr/bin/env bazel run //py/tests/py_venv_image_layer:my_app_arm64_layers'
6262
language: script
6363
require_serial: true
64+
65+
- id: sync-workflows-subrepos
66+
name: Update workflows file for subrepos
67+
# Note that we use a nested shell to discard $@, which is the file list
68+
entry: /usr/bin/env python3 tools/e2e/sync.py
69+
language: script
70+
require_serial: true

tools/e2e/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ py_binary(
1111
srcs = ["devintegrity.py"],
1212
main = "devintegrity.py",
1313
)
14+
15+
py_binary(
16+
name = "sync",
17+
srcs = ["sync.py"],
18+
main = "sync.py"
19+
)

tools/e2e/sync.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python3
2+
3+
import re
4+
from os import getenv
5+
from pathlib import Path
6+
7+
WORKSPACES_BLOCK_RE = re.compile(r"""\
8+
# SYNC: e2e
9+
# {{{
10+
(.*?
11+
)# }}}
12+
""", re.MULTILINE | re.DOTALL)
13+
14+
if __name__ == "__main__" or 1:
15+
root = Path(__file__).parent.parent.parent.absolute()
16+
workflows_file = root / ".aspect/workflows/config.yaml"
17+
modules = root.rglob("**/MODULE.bazel")
18+
module_roots = [it.parent.relative_to(root) for it in modules]
19+
20+
# Module roots that we know we can't run in workflows
21+
ignored_roots = [
22+
Path("e2e/use_release"),
23+
Path("e2e/cross-repo-610/subrepo_a"),
24+
Path("e2e/cross-repo-610/subrepo_b"),
25+
]
26+
27+
module_roots = [
28+
r for r in module_roots if r not in ignored_roots
29+
]
30+
module_roots = sorted(module_roots)
31+
32+
33+
with open(workflows_file, "r") as fp:
34+
config = fp.read()
35+
36+
def _handler(m):
37+
return m.group(0).replace(m.group(1), "".join([" - {}\n".format(it) for it in module_roots]))
38+
39+
new_config = re.sub(WORKSPACES_BLOCK_RE, _handler, config)
40+
41+
if config != new_config:
42+
print(new_config)
43+
44+
with open(workflows_file, "w") as fp:
45+
fp.write(new_config)
46+
47+
exit(1)

0 commit comments

Comments
 (0)