Skip to content

Commit

Permalink
Prepare next release (#131)
Browse files Browse the repository at this point in the history
* Remove compatibility_level from examples

This is superfluous noise as we don't deploy the examples

* Set module to default compatibility_level

The default value is 0. While the next release will be a breaking change,
imho the compatibility_level is counted starting with the first bzlmod
release, which is still pending.
The compatibility_level is remove completely, as the bazel-central-registry
maintainers don't want modules to explicitly mention the default value.

* Use rolling releases in bcr tests

We should be aware of incompatibilities to upcoming Bazel versions as early
as possible.
We reorder the arguments as increasing version from left to right seems to
be the dominant style in the bcr.

* Extend bcr tests

The tests in the examples directory ensure the bazelized mypy understands
a lot of Python code examples. This is great, but is missing testing for
expected failures. The test script in the root module does perform such
tests.
Ideally, there would be a directory with all relevant integration tests
which uses the root module as external dependency. For now this largish
refactoring is out of scope and thus we test both the root module itself
and the examples.

* Rework release notes template

- Advertise bzlmod as preferred option due to WORKSPACE being legacy
- Do not explain how to use bzlmod. The information is not sufficient to
  understand properly what bzlmod is about for somebody new to bzlmod.
  The information is superfluous for everybody who has read the bzlmod doc.
- Fix WORKSPACE template to work with current HEAD
  • Loading branch information
martis42 authored Jul 2, 2024
1 parent cf46198 commit 9312347
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
15 changes: 12 additions & 3 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
bcr_test_module:
module_path: "examples"
module_path: ""
matrix:
platform: ["debian10", "macos", "ubuntu2004", "windows"]
bazel: ["7.x", "6.x"]
bazel: ["6.x", "7.x", "rolling"]
tasks:
run_tests:
name: "Run test module"
name: "Run module tests"
platform: ${{ platform }}
bazel: ${{ bazel }}
test_targets:
- "//..."
shell_commands:
- ./test.sh
test_examples:
name: "Run example tests"
working_directory: examples
platform: ${{ platform }}
bazel: ${{ bazel }}
test_targets:
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')

cat << EOF
## Using Bzlmod with Bazel 6 or later
## Using Bzlmod (Recommended for Bazel 6 or later)
1. (Bazel 6 only) Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
2. Add to your \`MODULE.bazel\` file:
Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "mypy_integration", version = "${TAG:1}")
\`\`\`
## Using WORKSPACE
## Using WORKSPACE (Legacy)
Paste this snippet into your \`WORKSPACE.bazel\` file:
Add to your \`WORKSPACE.bazel\` file:
\`\`\`starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand All @@ -35,19 +34,8 @@ http_archive(
url = "https://github.com/bazel-contrib/bazel-mypy-integration/releases/download/${TAG}/${ARCHIVE}",
)
load(
"@mypy_integration//repositories:repositories.bzl",
mypy_integration_repositories = "repositories",
)
mypy_integration_repositories()
load("@mypy_integration//repositories:deps.bzl", mypy_integration_deps = "deps")
load("@mypy_integration//repositories:repositories.bzl", mypy_integration_repositories = "repositories")
mypy_integration_deps(
mypy_requirements_file="//tools/typing:mypy_version.txt",
# python_interpreter = "python3.9" # $PATH is searched for exe.
# OR
# python_interpreter_target = "@python3_interpreter//:bin/python3",
)
mypy_integration_repositories()
\`\`\`
EOF
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module(
name = "mypy_integration",
# Replaced with the tag during BCR publishing
version = "0.0.0",
compatibility_level = 1,
)

# Lower-bound dependency versions.
Expand Down
1 change: 0 additions & 1 deletion examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module(
name = "mypy-integration-examples",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "mypy_integration", version = "0.0.0")
Expand Down

0 comments on commit 9312347

Please sign in to comment.