Skip to content

Commit 566f76d

Browse files
committed
tests: better simulate BCR environment
1 parent c33ba23 commit 566f76d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.bazelci/isolate.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
MODULE_DIR="${1:-}"
5+
6+
if [[ -z "${MODULE_DIR}" ]]; then
7+
echo "Usage: $0 <module_directory>"
8+
exit 1
9+
fi
10+
11+
# Find the repository root assuming this script is in .bazelci/
12+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
14+
15+
cd "${REPO_ROOT}"
16+
17+
echo "Removing files outside of ${MODULE_DIR} to simulate BCR environment..."
18+
find . -maxdepth 1 -mindepth 1 \
19+
! -name "${MODULE_DIR}" \
20+
! -name ".git" \
21+
! -name ".bazelci" \
22+
-exec rm -rf '{}' +

.bazelci/presubmit.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ buildifier:
100100
bazel: ${{ bazel }}
101101
working_directory: gazelle/examples/bzlmod_build_file_generation
102102
shell_commands:
103+
- "../../../.bazelci/isolate.sh gazelle"
103104
- "echo 'common --override_module=rules_python=' >> .bazelrc"
104105
- "bazel run //:gazelle_python_manifest.update"
105106
- "bazel run //:gazelle -- update"
@@ -159,19 +160,25 @@ tasks:
159160
<<: *minimum_supported_version
160161
name: "Gazelle: workspace, minimum supported Bazel version"
161162
platform: ubuntu2204
163+
shell_commands:
164+
- "../.bazelci/isolate.sh gazelle"
162165
build_targets: ["//..."]
163166
test_targets: ["//..."]
164167
working_directory: gazelle
165168
gazelle_extension_workspace:
166169
<<: *common_workspace_flags
167170
name: "Gazelle: workspace"
168171
platform: ubuntu2204
172+
shell_commands:
173+
- "../.bazelci/isolate.sh gazelle"
169174
build_targets: ["//..."]
170175
test_targets: ["//..."]
171176
working_directory: gazelle
172177
gazelle_extension:
173178
name: "Gazelle: default settings"
174179
platform: ubuntu2204
180+
shell_commands:
181+
- "../.bazelci/isolate.sh gazelle"
175182
build_targets: ["//..."]
176183
test_targets: ["//..."]
177184
working_directory: gazelle
@@ -180,6 +187,8 @@ tasks:
180187
name: "Sphinxdocs: Ubuntu"
181188
working_directory: "sphinxdocs"
182189
platform: ubuntu2204
190+
shell_commands:
191+
- "../.bazelci/isolate.sh sphinxdocs"
183192
build_targets:
184193
- "//..."
185194
test_targets:
@@ -188,6 +197,8 @@ tasks:
188197
name: "Sphinxdocs: Mac"
189198
working_directory: "sphinxdocs"
190199
platform: macos_arm64
200+
shell_commands:
201+
- "../.bazelci/isolate.sh sphinxdocs"
191202
build_targets:
192203
- "//..."
193204
test_targets:

0 commit comments

Comments
 (0)