Add presubmit integration tests for `rules_java`

Hopefully this will avoid issues like the one that required releasing `v7.6.3`

Fixes https://github.com/bazelbuild/rules_java/issues/192

PiperOrigin-RevId: 642895968
Change-Id: I12fae1bd847586ab35614d0dd2a833ece7ecdb32
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index ebe0eef..41c79ea 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -4,6 +4,7 @@
   - "@remote_java_tools//java_tools/..."
   # TODO: Look into broken targets in //toolchains
   - "-//toolchains/..."
+  - "-//test/repo/..."
 
 build_targets_bzlmod: &build_targets_bzlmod
   - "//..."
@@ -12,6 +13,7 @@
   # TODO(pcloudy): pkg_tar doesn't work with Bzlmod due to https://github.com/bazelbuild/bazel/issues/14259
   # Enable once the issue is fixed.
   - "-//distro/..."
+  - "-//test/repo/..."
 
 test_targets: &test_targets
   - "//test/..."
@@ -22,33 +24,46 @@
   ubuntu2004:
     build_targets: *build_targets
     test_targets: *test_targets
+  ubuntu2004_integration:
+    name: "Integration Tests"
+    platform: ubuntu2004
+    working_directory: "test/repo"
+    build_targets:
+      - "//..."
+      - "//:bin_deploy.jar"
   macos:
     build_targets: *build_targets
   windows:
     build_targets: *build_targets
   ubuntu2004_head:
+    name: "Bazel@HEAD"
     bazel: last_green
     platform: ubuntu2004
     build_targets: *build_targets
   macos_head:
+    name: "Bazel@HEAD"
     bazel: last_green
     platform: macos
     build_targets: *build_targets
   windows_head:
+    name: "Bazel@HEAD"
     bazel: last_green
     platform: windows
     build_targets: *build_targets
   ubuntu2004_bzlmod:
+    name: "bzlmod"
     platform: ubuntu2004
     build_flags:
       - "--config=bzlmod"
     build_targets: *build_targets_bzlmod
   macos_bzlmod:
+    name: "bzlmod"
     platform: macos
     build_flags:
       - "--config=bzlmod"
     build_targets: *build_targets_bzlmod
   windows_bzlmod:
+    name: "bzlmod"
     platform: windows
     build_flags:
       - "--config=bzlmod"
diff --git a/test/repo/BUILD.bazel b/test/repo/BUILD.bazel
new file mode 100644
index 0000000..9355ff7
--- /dev/null
+++ b/test/repo/BUILD.bazel
@@ -0,0 +1,13 @@
+load("@rules_java//java:java_binary.bzl", "java_binary")
+load("@rules_java//java:java_library.bzl", "java_library")
+
+java_library(
+    name = "lib",
+    srcs = glob(["src/*.java"]),
+)
+
+java_binary(
+    name = "bin",
+    main_class = "Main",
+    runtime_deps = [":lib"],
+)
diff --git a/test/repo/MODULE.bazel b/test/repo/MODULE.bazel
new file mode 100644
index 0000000..10460a8
--- /dev/null
+++ b/test/repo/MODULE.bazel
@@ -0,0 +1,7 @@
+module(name = "fake_repo_for_testing")
+
+bazel_dep(name = "rules_java", version = "7.5.0")
+local_path_override(
+    module_name = "rules_java",
+    path = "../../",
+)
diff --git a/test/repo/WORKSPACE.bzlmod b/test/repo/WORKSPACE.bzlmod
new file mode 100644
index 0000000..67a41c3
--- /dev/null
+++ b/test/repo/WORKSPACE.bzlmod
@@ -0,0 +1,5 @@
+load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
+
+rules_java_dependencies()
+
+rules_java_toolchains()
diff --git a/test/repo/src/Main.java b/test/repo/src/Main.java
new file mode 100644
index 0000000..6029b2a
--- /dev/null
+++ b/test/repo/src/Main.java
@@ -0,0 +1 @@
+public class Main {}