Skip to content
Draft
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
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ test --test_output=errors
test --test_verbose_timeout_warnings

common --enable_platform_specific_config
build:macos --deleted_packages=tests/rules_pycross,tests/cc_runfiles/container
build:macos --macos_minimum_os=10.15
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ load("//:deps.bzl", "ARCHS")
"@platforms//os:linux",
"@platforms//cpu:" + arch,
],
visibility = ["//:__subpackages__"],
) for arch in ARCHS.keys()]

compile_pip_requirements(
Expand Down
5 changes: 4 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ bazel_dep(name = "rules_shell", version = "0.7.1")
bazel_dep(name = "squashfs-tools", version = "4.7.5")

bazel_dep(name = "bazel_lib", version = "3.2.2", dev_dependency = True)
bazel_dep(name = "container_structure_test", version = "1.22.1", dev_dependency = True)
bazel_dep(name = "container_structure_test", version = "1.21.1", dev_dependency = True)
bazel_dep(name = "libmagic", version = "5.47", dev_dependency = True)
bazel_dep(name = "llvm", version = "0.7.0", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.3.0", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True)
bazel_dep(name = "rules_pycross", version = "0.8.1", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.9.0", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.8.1", dev_dependency = True)
bazel_dep(name = "with_cfg.bzl", version = "0.14.6", dev_dependency = True)

register_toolchains("@llvm//toolchain:all")

single_version_override(
module_name = "stardoc",
patches = ["//third_party:stardoc.diff"], # https://github.com/bazelbuild/stardoc/pull/303
Expand Down
1 change: 1 addition & 0 deletions tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ py_test(
appimage(
name = "external_bin.appimage",
binary = "@rules_python//tools:wheelmaker",
target_compatible_with = ["@platforms//os:linux"],
)

sh_test(
Expand Down
1 change: 1 addition & 0 deletions tests/build_working_directory/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sh_binary(
appimage(
name = "test.appimage",
binary = ":entrypoint",
target_compatible_with = ["@platforms//os:linux"],
)

sh_test(
Expand Down
16 changes: 12 additions & 4 deletions tests/cc_runfiles/container/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_appimage//appimage:appimage.bzl", "appimage")
load("@rules_cc//cc:defs.bzl", "cc_binary")
Expand All @@ -13,14 +14,13 @@ cc_binary(
"//tests/cc_runfiles:file.txt",
"@appimage_runtime_aarch64//file",
],
linkopts = ["-static"], # avoid issues with glibcxx version mismatch inside the container
target_compatible_with = ["@platforms//os:linux"],
deps = ["@rules_cc//cc/runfiles"],
)

appimage(
name = "bin.appimage",
binary = ":bin",
tags = ["requires-fakeroot"],
target_compatible_with = ["@platforms//os:linux"],
)

Expand Down Expand Up @@ -50,14 +50,22 @@ oci_image(
],
)

platform_transition_filegroup(
name = "container_structure_test_image_linux",
srcs = [":container_structure_test_image"],
target_platform = select({
"@platforms//cpu:aarch64": "@llvm//platforms:linux_aarch64_musl",
"//conditions:default": "@llvm//platforms:linux_amd64_musl",
}),
)

container_structure_test(
name = "container_structure_test",
timeout = "short",
configs = ["test_appimage_isolated.yaml"],
image = "container_structure_test_image",
image = ":container_structure_test_image_linux",
platform = select({
"@platforms//cpu:aarch64": "linux/arm64",
"//conditions:default": "linux/amd64",
}),
target_compatible_with = ["@platforms//os:linux"],
)
40 changes: 27 additions & 13 deletions tests/rules_pycross/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
load("@bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_appimage//appimage:appimage.bzl", "appimage_test")
load("@rules_appimage//appimage:appimage.bzl", "appimage")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_python//python:defs.bzl", "py_test")
load("@rules_python//python:defs.bzl", "py_binary", "py_test")

py_test(
name = "test",
Expand All @@ -11,31 +12,44 @@ py_test(
deps = ["@pdm_deps//:humanize"],
)

appimage_test(
name = "test.appimage",
timeout = "short",
binary = ":test",
tags = ["requires-fakeroot"],
py_binary(
name = "bin",
srcs = ["test.py"],
main = "test.py",
deps = ["@pdm_deps//:humanize"],
)

appimage(
name = "bin.appimage",
binary = ":bin",
target_compatible_with = ["@platforms//os:linux"],
)

pkg_tar(
name = "test.appimage.tar",
testonly = True,
srcs = [":test.appimage"],
name = "bin.appimage.tar",
srcs = [":bin.appimage"],
)

oci_image(
name = "container_structure_test_image",
testonly = True,
base = "@python3-slim",
tars = [":test.appimage.tar"],
tars = [":bin.appimage.tar"],
)

platform_transition_filegroup(
name = "container_structure_test_image_linux",
srcs = [":container_structure_test_image"],
target_platform = select({
"@platforms//cpu:aarch64": "@llvm//platforms:linux_aarch64_musl",
"//conditions:default": "@llvm//platforms:linux_amd64_musl",
}),
)

container_structure_test(
name = "container_structure_test",
timeout = "short",
configs = ["test_appimage_isolated.yaml"],
image = "container_structure_test_image",
image = ":container_structure_test_image_linux",
platform = select({
"@platforms//cpu:aarch64": "linux/arm64",
"//conditions:default": "linux/amd64",
Expand Down
2 changes: 1 addition & 1 deletion tests/rules_pycross/test_appimage_isolated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
schemaVersion: 2.0.0
commandTests:
- name: run test
command: /test.appimage
command: /bin.appimage
args: [--appimage-extract-and-run]
Loading