Skip to content

Commit

Permalink
fix MacOS tests and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarbarini committed Sep 4, 2023
1 parent c97a6f9 commit b9b88da
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
1 change: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
test --announce_rc
test --test_output=errors
test --test_verbose_timeout_warnings
test --spawn_strategy=linux-sandbox
build --incompatible_strict_action_env
build --keep_going
test --keep_going
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ permissions: read-all

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
env:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
bazel-version: ["5.x", "6.x", "latest"]
os: ["ubuntu-latest", "macos-latest"]

steps:
- uses: actions/checkout@v3
Expand Down
18 changes: 18 additions & 0 deletions tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ appimage_test(
size = "small",
args = ["--appimage-extract-and-run"], # One way to run if no libfuse2 is available
binary = ":test_sh",
target_compatible_with = [
"@platforms//os:linux",
],
)

sh_binary(
Expand All @@ -26,6 +29,9 @@ appimage_test(
size = "small",
binary = ":test_mount-is-readonly",
tags = ["requires-fakeroot"], # This helps tests failing with `fusermount3: mount failed: Operation not permitted`
target_compatible_with = [
"@platforms//os:linux",
],
)

cc_binary(
Expand All @@ -43,6 +49,9 @@ appimage_test(
binary = ":test_cc",
env = {"MY_APPIMAGE_ENV": "overwritten"}, # environment variables are propagated from the binary target env attr
tags = ["requires-fakeroot"],
target_compatible_with = [
"@platforms//os:linux",
],
)

sh_test(
Expand Down Expand Up @@ -79,6 +88,9 @@ appimage_test(
":appimage_data_filegroup",
],
env = {"APPIMAGE_EXTRACT_AND_RUN": "1"}, # Another way to run if no libfuse2 is available
target_compatible_with = [
"@platforms//os:linux",
],
)

appimage(
Expand All @@ -100,6 +112,9 @@ py_test(
size = "small",
srcs = ["test_appimage.py"],
data = [":appimage_py"],
target_compatible_with = [
"@platforms//os:linux",
],
deps = [requirement("pytest")],
)

Expand Down Expand Up @@ -130,4 +145,7 @@ appimage_test(
binary = ":runfiles_test_sh",
env = {"RUNFILES_LIB_DEBUG": "1"},
tags = ["requires-fakeroot"],
target_compatible_with = [
"@platforms//os:linux",
],
)
9 changes: 7 additions & 2 deletions tests/tool/tests/test_mkappimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
from appimage.private.tool import mkappimage


def test_deps() -> None:
"""Test that the runtime and mksquashfs can be executed."""
# NOTE: mypy warns about `untyped decorator`. Since this is a test, just ignore typing on this line
@pytest.mark.skipif(sys.platform.startswith("linux") is False, reason="AppImage can only run on Linux") # type: ignore
def test_appimage_deps() -> None:
"""Test that the runtime can be executed on Linux."""
runtime_path = mkappimage._get_path_or_raise("rules_appimage/tests/tool/tests/appimage_runtime_native")
cmd = [os.fspath(runtime_path), "--appimage-version"]
output = subprocess.run(cmd, check=True, text=True, stderr=subprocess.PIPE).stderr
assert output.startswith("AppImage runtime version")


def test_mksquashfs_deps() -> None:
"""Test that mksquashfs can be executed."""
cmd = [os.fspath(mkappimage.MKSQUASHFS), "-version"]
output = subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE).stdout
assert output.startswith("mksquashfs version")
Expand Down

0 comments on commit b9b88da

Please sign in to comment.