Skip to content

Commit 5f09aa8

Browse files
committed
Remove .bazelversion from FOSS tests
Why: We need to support multiple bazel versions (6, 7, 8) when running FOSS tests locally. As of now we copy just .bazelversion with fixed version. What: - Remove .bazelversion from templates - Copy .bazelversion from root directory only if it exists - Create .bazelversion in CI in root directory - Print out versions in CI for FOSS tests
1 parent edcf7d0 commit 5f09aa8

7 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/foss.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ jobs:
5757
uses: ./.github/platform_environment_setup/ubuntu
5858

5959
- name: Set Bazel version
60-
run: echo ${{ matrix.bazel_version }} >> test/foss/templates/.bazelversion
60+
run: echo ${{ matrix.bazel_version }} > .bazelversion
61+
62+
- name: Print versions
63+
run: |
64+
bazel version
65+
CodeChecker version
66+
echo "[NOTE]: CodeChecker may find different analyzer binaries" \
67+
"when invoking directly, or in bazel's sandbox environment!" \
68+
"Be sure to double check during debugging."
69+
CodeChecker analyzers
6170
6271
- name: Run Test On Opensource Projects
6372
working-directory: test
@@ -83,7 +92,16 @@ jobs:
8392
uses: ./.github/platform_environment_setup/rhel9
8493

8594
- name: Set Bazel version
86-
run: echo ${{ matrix.bazel_version }} >> test/foss/templates/.bazelversion
95+
run: echo ${{ matrix.bazel_version }} > .bazelversion
96+
97+
- name: Print versions
98+
run: |
99+
bazel version
100+
CodeChecker version
101+
echo "[NOTE]: CodeChecker may find different analyzer binaries" \
102+
"when invoking directly, or in bazel's sandbox environment!" \
103+
"Be sure to double check during debugging."
104+
CodeChecker analyzers
87105
88106
- name: Run Test On Opensource Projects
89107
working-directory: test

test/common/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def run_command(
135135
cwd=working_dir,
136136
) as process:
137137
stdout, stderr = process.communicate()
138+
# if process.returncode:
139+
logging.debug("stdout: %s", stdout.decode('utf-8'))
140+
logging.debug("stderr: %s", stderr.decode('utf-8'))
138141
return (
139142
process.returncode,
140143
f"stdout: {stdout.decode('utf-8')}",

test/foss/templates/.bazelversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/foss/yaml-cpp/init.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ cd test-proj
1919
git checkout yaml-cpp-0.7.0
2020

2121
# This file must be in the root of the project to be analyzed for bazelisk to work
22-
cp ../../templates/.bazelversion ./.bazelversion
22+
bazelversion="../../../../.bazelversion"
23+
[[ -f $bazelversion ]] && cp $bazelversion .
2324

2425
# Add codechecker to the project
2526
cat <<EOF >> BUILD.bazel
@@ -52,3 +53,6 @@ EOF
5253

5354
# Add codechecker_bazel repo to WORKSPACE
5455
cat ../../templates/WORKSPACE.template >> WORKSPACE
56+
57+
# Check
58+
bazel version

test/foss/zlib-module/init.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ cd test-proj
1919
git checkout 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71
2020

2121
# This file must be in the root of the project to be analyzed for bazelisk to work
22-
cp ../../templates/.bazelversion ./.bazelversion
22+
bazelversion="../../../../.bazelversion"
23+
[[ -f $bazelversion ]] && cp $bazelversion .
24+
2325
# Add codechecker to the project
2426
cat <<EOF >> BUILD.bazel
2527
#-------------------------------------------------------
@@ -51,3 +53,6 @@ EOF
5153
echo "common --enable_bzlmod" > .bazelrc
5254
# Add codechecker_bazel repo MODULE.bazel
5355
cat ../../templates/MODULE.template >> MODULE.bazel
56+
57+
# Check
58+
bazel version

test/foss/zlib/init.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ cd test-proj
1919
git checkout 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71
2020

2121
# This file must be in the root of the project to be analyzed for bazelisk to work
22-
cp ../../templates/.bazelversion ./.bazelversion
22+
bazelversion="../../../../.bazelversion"
23+
[[ -f $bazelversion ]] && cp $bazelversion .
2324

2425
# Add codechecker to the project
2526
cat <<EOF >> BUILD.bazel
@@ -52,3 +53,6 @@ EOF
5253

5354
# Add codechecker_bazel repo to WORKSPACE
5455
cat ../../templates/WORKSPACE.template >> WORKSPACE
56+
57+
# Check
58+
bazel version

test/unit/external_repository/test_external_repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def setUpClass(cls):
5353
logging.debug("No bazel version set, using system default")
5454
_, stdout, _ = cls.run_command("bazel --version")
5555
cls.BAZEL_VERSION = stdout.split(' ')[2].strip()
56-
logging.debug("Using Bazel", cls.BAZEL_VERSION)
56+
logging.debug("Using Bazel %s", cls.BAZEL_VERSION)
5757

5858
@final
5959
@classmethod

0 commit comments

Comments
 (0)