Skip to content

Commit

Permalink
fix: correctly advertise minimum supported version (#1065)
Browse files Browse the repository at this point in the history
* feat: bump the latest supported version to 5.4.0
* feat: add gazelle and RBE minimum supported version tests
* feat: pip_parse_vendored example is now 5.4.0 compatible
  • Loading branch information
aignas authored Feb 16, 2023
1 parent 2893d85 commit 64d9d6f
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 3 deletions.
100 changes: 100 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ buildifier:
version: latest
# keep this argument in sync with .pre-commit-config.yaml
warnings: "all"
.minimum_supported_version: &minimum_supported_version
# For testing minimum supported version.
# NOTE: Keep in sync with //:version.bzl
bazel: 5.4.0
.minimum_supported_bzlmod_version: &minimum_supported_bzlmod_version
bazel: 6.0.0 # test minimum supported version of bazel for bzlmod tests
.reusable_config: &reusable_config
build_targets:
- "--"
Expand Down Expand Up @@ -54,12 +60,24 @@ buildifier:
- //tests:version_3_9_test
- //tests:version_default_test
tasks:
gazelle_extension_min:
<<: *minimum_supported_version
name: Test the Gazelle extension using minimum supported Bazel version
platform: ubuntu2004
build_targets: ["//..."]
test_targets: ["//..."]
working_directory: gazelle
gazelle_extension:
name: Test the Gazelle extension
platform: ubuntu2004
build_targets: ["//..."]
test_targets: ["//..."]
working_directory: gazelle
ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_config
name: Default test on Ubuntu using minimum supported Bazel version
platform: ubuntu2004
ubuntu:
<<: *reusable_config
name: Default test on Ubuntu
Expand All @@ -78,13 +96,27 @@ tasks:
platform: windows
test_flags:
- "--test_tag_filters=-integration-test,-fix-windows"

rbe_min:
<<: *minimum_supported_version
<<: *reusable_config
name: Test on RBE using minimum supported Bazel version
platform: rbe_ubuntu1604
test_flags:
- "--test_tag_filters=-integration-test,-acceptance-test"
rbe:
<<: *reusable_config
name: Test on RBE
platform: rbe_ubuntu1604
test_flags:
- "--test_tag_filters=-integration-test,-acceptance-test"

integration_test_build_file_generation_ubuntu_minimum_supported:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: build_file_generation integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/build_file_generation
platform: ubuntu2004
integration_test_build_file_generation_ubuntu:
<<: *reusable_build_test_all
name: build_file_generation integration tests on Ubuntu
Expand All @@ -106,6 +138,13 @@ tasks:
working_directory: examples/build_file_generation
platform: windows

integration_test_bzlmod_ubuntu_min:
<<: *minimum_supported_bzlmod_version
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod
name: bzlmod integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/bzlmod
platform: ubuntu2004
integration_test_bzlmod_ubuntu:
<<: *reusable_build_test_all
<<: *coverage_targets_example_bzlmod
Expand All @@ -131,6 +170,12 @@ tasks:
working_directory: examples/bzlmod
platform: windows

integration_test_multi_python_versions_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: multi_python_versions integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/multi_python_versions
platform: ubuntu2004
integration_test_multi_python_versions_ubuntu:
<<: *reusable_build_test_all
<<: *coverage_targets_example_multi_python
Expand All @@ -156,6 +201,12 @@ tasks:
working_directory: examples/multi_python_versions
platform: windows

integration_test_pip_install_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_install integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/pip_install
platform: ubuntu2004
integration_test_pip_install_ubuntu:
<<: *reusable_build_test_all
name: pip_install integration tests on Ubuntu
Expand All @@ -177,6 +228,12 @@ tasks:
working_directory: examples/pip_install
platform: windows

integration_test_pip_parse_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_parse integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/pip_parse
platform: ubuntu2004
integration_test_pip_parse_ubuntu:
<<: *reusable_build_test_all
name: pip_parse integration tests on Ubuntu
Expand All @@ -198,6 +255,12 @@ tasks:
working_directory: examples/pip_parse
platform: windows

integration_test_pip_parse_vendored_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_parse_vendored integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/pip_parse_vendored
platform: ubuntu2004
integration_test_pip_parse_vendored_ubuntu:
<<: *reusable_build_test_all
name: pip_parse_vendored integration tests on Ubuntu
Expand All @@ -216,6 +279,12 @@ tasks:
# We don't run pip_parse_vendored under Windows as the file checked in is
# generated from a repository rule containing OS-specific rendered paths.

integration_test_py_proto_library_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: py_proto_library integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/py_proto_library
platform: ubuntu2004
integration_test_py_proto_library_ubuntu:
<<: *reusable_build_test_all
name: py_proto_library integration tests on Ubuntu
Expand All @@ -238,6 +307,13 @@ tasks:
platform: windows

# Check the same using bzlmod as well
integration_test_py_proto_library_bzlmod_ubuntu_min:
<<: *minimum_supported_bzlmod_version
<<: *common_bzlmod_flags
<<: *reusable_build_test_all
name: py_proto_library bzlmod integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/py_proto_library
platform: ubuntu2004
integration_test_py_proto_library_bzlmod_ubuntu:
<<: *reusable_build_test_all
<<: *common_bzlmod_flags
Expand All @@ -263,6 +339,12 @@ tasks:
working_directory: examples/py_proto_library
platform: windows

integration_test_pip_repository_annotations_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_repository_annotations integration tests on Ubuntu using minimum supported Bazel version
working_directory: examples/pip_repository_annotations
platform: ubuntu2004
integration_test_pip_repository_annotations_ubuntu:
<<: *reusable_build_test_all
name: pip_repository_annotations integration tests on Ubuntu
Expand All @@ -284,6 +366,12 @@ tasks:
working_directory: examples/pip_repository_annotations
platform: windows

integration_test_compile_pip_requirements_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: compile_pip_requirements integration tests on Ubuntu using minimum supported Bazel version
working_directory: tests/compile_pip_requirements
platform: ubuntu2004
integration_test_compile_pip_requirements_ubuntu:
<<: *reusable_build_test_all
name: compile_pip_requirements integration tests on Ubuntu
Expand Down Expand Up @@ -333,6 +421,12 @@ tasks:
- "bazel run //:requirements.update"
- "git diff --exit-code"

integration_test_pip_repository_entry_points_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: pip_repository_entry_points integration tests on Ubuntu using minimum supported Bazel version
working_directory: tests/pip_repository_entry_points
platform: ubuntu2004
integration_test_pip_repository_entry_points_ubuntu:
<<: *reusable_build_test_all
name: pip_repository_entry_points integration tests on Ubuntu
Expand All @@ -354,6 +448,12 @@ tasks:
working_directory: tests/pip_repository_entry_points
platform: windows

integration_test_ignore_root_user_error_ubuntu_min:
<<: *minimum_supported_version
<<: *reusable_build_test_all
name: ignore_root_user_error integration tests on Ubuntu using minimum supported Bazel version
working_directory: tests/ignore_root_user_error
platform: ubuntu2004
integration_test_ignore_root_user_error_ubuntu:
<<: *reusable_build_test_all
name: ignore_root_user_error integration tests on Ubuntu
Expand Down
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ filegroup(
"WORKSPACE",
"internal_deps.bzl",
"internal_setup.bzl",
"version.bzl",
"//python:distribution",
"//python/pip_install:distribution",
"//tools:distribution",
Expand Down
1 change: 1 addition & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ bzl_library(
],
deps = [
":defs",
"//:version.bzl",
],
)

Expand Down
3 changes: 3 additions & 0 deletions examples/pip_parse_vendored/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ genrule(
"cat $<",
# Insert our load statement after the existing one so we don't produce a file with buildifier warnings
"""sed -e '/^load.*/i\\'$$'\\n''load("@python39//:defs.bzl", "interpreter")'""",
# Replace the bazel 6.0.0 specific comment with something that bazel 5.4.0 would produce.
# This enables this example to be run as a test under bazel 5.4.0.
"""sed -e 's#@//#//#'""",
"""tr "'" '"' """,
"""sed 's#"@python39_.*//:bin/python3"#interpreter#' >$@""",
]),
Expand Down
2 changes: 1 addition & 1 deletion examples/pip_parse_vendored/requirements.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Starlark representation of locked requirements.
@generated by rules_python pip_parse repository rule
from @//:requirements.txt
from //:requirements.txt
"""

load("@python39//:defs.bzl", "interpreter")
Expand Down
3 changes: 2 additions & 1 deletion python/pip_install/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//:version.bzl", "MINIMUM_BAZEL_VERSION")

_RULE_DEPS = [
(
Expand Down Expand Up @@ -133,7 +134,7 @@ def pip_install_dependencies():
# Give the user an obvious error to upgrade rather than some obscure missing symbol later.
# It's not guaranteed that users call this function, but it's used by all the pip fetch
# repository rules so it's likely that most users get the right error.
versions.check("4.0.0")
versions.check(MINIMUM_BAZEL_VERSION)

for (name, url, sha256) in _RULE_DEPS:
maybe(
Expand Down
8 changes: 7 additions & 1 deletion version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@
# in .bazelversion.
BAZEL_VERSION = "6.0.0"

# NOTE: Keep in sync with .bazelci/presubmit.yml
# This is the minimum supported bazel version, that we have some tests for.
MINIMUM_BAZEL_VERSION = "5.4.0"

# Versions of Bazel which users should be able to use.
# Ensures we don't break backwards-compatibility,
# accidentally forcing users to update their LTS-supported bazel.
# These are the versions used when testing nested workspaces with
# bazel_integration_test.
SUPPORTED_BAZEL_VERSIONS = [
# TODO: add LTS versions of bazel like 1.0.0, 2.0.0
BAZEL_VERSION,
# TODO @aignas 2023-02-15: the integration tests currently support
# only a single element in this array.
#MINIMUM_BAZEL_VERSION,
]

def bazel_version_to_binary_label(version):
Expand Down

0 comments on commit 64d9d6f

Please sign in to comment.