Skip to content

Commit

Permalink
Drop Bazel 6 (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten authored Jan 25, 2025
1 parent f8fd614 commit dcb11cf
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 38 deletions.
3 changes: 1 addition & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test --announce_rc
test --keep_going
test --spawn_strategy=sandboxed
test --test_env=NO_CLEANUP=1
test --test_env=PYTEST_ADDOPTS="--color=yes --capture=tee-sys --tb=short --showlocals -ra --verbose --verbose"
test --test_env=USE_BAZEL_VERSION # Pass this on to tests to enable adapting to bazel-version specific behavior
test --test_env="PYTEST_ADDOPTS=--color=yes --capture=tee-sys --tb=short --showlocals -ra --verbose --verbose"
test --test_output=errors
test --test_verbose_timeout_warnings
2 changes: 1 addition & 1 deletion .bcr/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bcr_test_module:
module_path: ''
matrix:
bazel: [6.x, 7.x]
bazel: [7.x, 8.x]
tasks:
run_tests_ubuntu2204:
platform: ubuntu2204
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ jobs:
fail-fast: false
matrix:
include:
- bazel-version: 6.x
os: ubuntu
external_dependency_system: bzlmod
flags: --enable_bzlmod
- bazel-version: 6.x
os: ubuntu
external_dependency_system: workspace
flags:
- bazel-version: 7.x
os: ubuntu
external_dependency_system: bzlmod
Expand Down Expand Up @@ -60,11 +52,8 @@ jobs:
- run: echo "common ${{ matrix.flags }}" >> .bazelrc

# Don't want to bother with hundreds of lines of Workspace setup for the rules_pycross compat test
- if: matrix.external_dependency_system == 'workspace' || matrix.os == 'macos' || matrix.bazel-version == '6.x'
- if: matrix.external_dependency_system == 'workspace' || matrix.os == 'macos'
run: echo "tests/rules_pycross" >> .bazelignore
# Work around https://github.com/jvolkman/rules_pycross/issues/147
- if: matrix.bazel-version == '6.x'
run: sed -i.bak 's/"rules_pycross", version = "0.7.1"/"rules_pycross", version = "0.6.1"/' MODULE.bazel
- run: bazel test //...
examples:
runs-on: ubuntu-latest
Expand All @@ -73,7 +62,7 @@ jobs:
strategy:
fail-fast: false
matrix:
bazel-version: [6.x, 7.x, 8.x]
bazel-version: [7.x, 8.x]
steps:
- uses: actions/checkout@v4
- run: examples/integration_test.sh
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module(

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "rules_python", version = "0.37.2")
bazel_dep(name = "rules_python", version = "1.1.0")
bazel_dep(name = "squashfs-tools", version = "4.6.1")
bazel_dep(name = "zstd", version = "1.5.6")

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ See also [Alternatives](#alternatives) below.

See the [latest release notes](https://github.com/lalten/rules_appimage/releases/latest) for a snippet to add to your `MODULE.bazel` or `WORKSPACE`.

rules_appimage aims to be compatible and test with the last two [Bazel LTS releases](https://bazel.build/release) but is likely to work with older versions as well.

### Usage

There is an example workspace in [`examples/`](https://github.com/lalten/rules_appimage/blob/main/examples/README.md).
Expand Down
5 changes: 2 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ py_repositories()

python_register_toolchains(
name = "rules_appimage_python",
python_version = "3.13",
python_version = "3.12",
)

load("@rules_appimage_python//:defs.bzl", rules_appimage_py_interpreter = "interpreter")
load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
name = "rules_appimage_py_deps",
python_interpreter_target = rules_appimage_py_interpreter,
python_interpreter_target = "@python_3_12_host//:python",
requirements_lock = "@rules_appimage//:requirements.txt",
)

Expand Down
6 changes: 3 additions & 3 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def _rules_appimage_workspace_deps():
maybe(
http_archive,
name = "rules_python",
sha256 = "c6fb25d0ba0246f6d5bd820dd0b2e66b339ccc510242fd4956b9a639b548d113",
strip_prefix = "rules_python-0.37.2",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.37.2/rules_python-0.37.2.tar.gz",
sha256 = "9c6e26911a79fbf510a8f06d8eedb40f412023cf7fa6d1461def27116bff022c",
strip_prefix = "rules_python-1.1.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/1.1.0/rules_python-1.1.0.tar.gz",
)

def rules_appimage_development_deps():
Expand Down
4 changes: 1 addition & 3 deletions tests/appimage_test_cc_with_sh_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

set -eux

exec env --ignore-environment \
USE_BAZEL_VERSION="${USE_BAZEL_VERSION:-latest}" \
"tests/appimage_test_cc" --appimage-extract-and-run
exec env --ignore-environment "tests/appimage_test_cc" --appimage-extract-and-run
3 changes: 0 additions & 3 deletions tests/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ int main(int argc, char **argv, char **envp) {
// When running inside the appimage, we want the env to not be lost.
bool have_binary_env = false;
bool have_appimage_env = false;
std::string bazel_version{"unknown"};
for (char **env = envp; *env != 0; env++) {
std::string thisEnv{*env};
std::cout << thisEnv << std::endl;
if (thisEnv == "MY_BINARY_ENV=not lost") {
have_binary_env = true;
} else if (thisEnv == "MY_APPIMAGE_ENV=overwritten") {
have_appimage_env = true;
} else if (thisEnv.starts_with("USE_BAZEL_VERSION=")) {
bazel_version = thisEnv.substr(18);
}
}
if (!have_binary_env) {
Expand Down
10 changes: 1 addition & 9 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,7 @@ def test_runfiles_symlinks() -> None:

def test_binary_env() -> None:
"""Test that env attr on the binary target is handled."""
bazel_version = os.getenv("USE_BAZEL_VERSION", "latest")
if bazel_version.startswith(("latest", "7.", "8.")):
# Bazel >= 7.0.0 does set the RunEnvironmentInfo provider 🎉.
assert os.getenv("MY_BINARY_ENV") == "propagated only in Bazel 7+"
else:
# Otherwise it seems rules_python does not set the RunEnvironmentInfo provider.
# See https://github.com/bazelbuild/rules_python/issues/901
val = os.getenv("MY_BINARY_ENV")
assert val is None, f"Expected env to be missing, but got {val}"
assert os.getenv("MY_BINARY_ENV") == "propagated only in Bazel 7+"


def greeter() -> None:
Expand Down

0 comments on commit dcb11cf

Please sign in to comment.