Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ jobs:
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@646899086d7aaee8e532540480f3e91e00596234 # 11 Dec 2024
with:
# NB: the root folder is tested with Aspect Workflows on BuildKite, see /.aspect/workflows/config.yaml
folders: '["e2e/smoke", "e2e/repository-rule-deps", "e2e/system-interpreter", "examples/uv_pip_compile"]'
folders: |
[
"e2e/cross-repo-610",
"e2e/repository-rule-deps",
"e2e/smoke",
"e2e/system-interpreter",
"examples/uv_pip_compile"
]
# TODO: Build Windows tools and add to toolchain
# TODO(alex): switch the root folder to bzlmod
# TODO: fix remaining folders on Bazel 8
exclude: |
[
{"os": "windows-latest"},
{"folder": "e2e/cross-repo-610", "bzlmodEnabled": false},
{"folder": "e2e/repository-rule-deps", "bzlmodEnabled": false},
{"folder": "e2e/system-interpreter", "bzlmodEnabled": false},
{"folder": "examples/uv_pip_compile", "bzlmodEnabled": false},
Expand Down
8 changes: 0 additions & 8 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,3 @@ oci.pull(
tag = "latest",
)
use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")

# For tests
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")

local_repository(
name = "rpy610_test",
path = "./py/tests/rpy610/subrepo",
)
24 changes: 24 additions & 0 deletions e2e/cross-repo-610/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_test")
load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements")

py_venv_test(
name = "test",
srcs = [
"test.py",
],
imports = [
".",
],
main = "test.py",
deps = [
"@pip//cowsay",
"@subrepo_a//:foo",
],
)

compile_pip_requirements(
name = "requirements",
extra_args = ["--allow-unsafe"],
requirements_in = "requirements.in",
requirements_txt = "requirements.txt",
)
48 changes: 48 additions & 0 deletions e2e/cross-repo-610/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"Bazel dependencies"

bazel_dep(name = "aspect_rules_py", version = "0.0.0", dev_dependency = True)
local_path_override(
module_name = "aspect_rules_py",
path = "../..",
)

# Because we use a prerelease of rules_py, we must compile the rust tools from source.
bazel_dep(name = "rules_rust", version = "0.53.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
versions = ["1.81.0"],
)
use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

bazel_dep(name = "rules_python", version = "0.29.0", dev_dependency = True)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.11.6",
)

# TODO: Swap in our pip
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11.6",
requirements_lock = "//:requirements.txt",
)
use_repo(pip, "pip")

local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")

local_repository(
name = "subrepo_a",
path = "./subrepo_a",
)

local_repository(
name = "subrepo_b",
path = "./subrepo_b",
)
1 change: 1 addition & 0 deletions e2e/cross-repo-610/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cowsay
9 changes: 9 additions & 0 deletions e2e/cross-repo-610/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# bazel run //:requirements.update
#
cowsay==6.1 \
--hash=sha256:274b1e6fc1b966d53976333eb90ac94cb07a450a700b455af9fbdf882244b30a
# via -r requirements.in
13 changes: 13 additions & 0 deletions e2e/cross-repo-610/subrepo_a/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
load("@aspect_rules_py//py:defs.bzl", "py_library")

py_library(
name = "foo",
srcs = [
"foo.py",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"@subrepo_b//:bar",
],
)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("@aspect_rules_py//py:defs.bzl", "py_library")

py_library(
name = "foo",
name = "bar",
srcs = [
"foo.py",
"bar.py",
],
imports = ["."],
visibility = ["//visibility:public"],
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions e2e/cross-repo-610/subrepo_b/bar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def bar(x):
return x // 5
10 changes: 7 additions & 3 deletions py/tests/rpy610/test.py → e2e/cross-repo-610/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@
# use a different layout.

# The virtualenv changes the sys.prefix, which should be in our runfiles
assert sys.prefix.endswith("/py/tests/rpy610/.test")
assert sys.prefix.endswith("_main/.test")

# That prefix should also be "the" prefix per site.PREFIXES
assert site.PREFIXES[0].endswith("/py/tests/rpy610/.test")
assert site.PREFIXES[0].endswith("_main/.test")

# The virtualenv also changes the sys.executable (if we've done this right)
assert sys.executable.find("/py/tests/rpy610/.test/bin/python") != -1
assert sys.executable.find("_main/.test/bin/python") != -1

# aspect-build/rules_py#610, these imports aren't quite right
import foo
print(foo.__file__)

# Transitive through foo
import bar
print(bar.__file__)
16 changes: 0 additions & 16 deletions py/tests/rpy610/BUILD.bazel

This file was deleted.