Skip to content

Commit 85811f9

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 85811f9

7 files changed

Lines changed: 51 additions & 7 deletions

File tree

.github/workflows/foss.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ 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+
which bazel
66+
CodeChecker version
67+
echo "[NOTE]: CodeChecker may find different analyzer binaries" \
68+
"when invoking directly, or in bazel's sandbox environment!" \
69+
"Be sure to double check during debugging."
70+
CodeChecker analyzers
6171
6272
- name: Run Test On Opensource Projects
6373
working-directory: test
@@ -83,7 +93,17 @@ jobs:
8393
uses: ./.github/platform_environment_setup/rhel9
8494

8595
- name: Set Bazel version
86-
run: echo ${{ matrix.bazel_version }} >> test/foss/templates/.bazelversion
96+
run: echo ${{ matrix.bazel_version }} > .bazelversion
97+
98+
- name: Print versions
99+
run: |
100+
bazel version
101+
which bazel
102+
CodeChecker version
103+
echo "[NOTE]: CodeChecker may find different analyzer binaries" \
104+
"when invoking directly, or in bazel's sandbox environment!" \
105+
"Be sure to double check during debugging."
106+
CodeChecker analyzers
87107
88108
- name: Run Test On Opensource Projects
89109
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
set -x
18+
1719
git clone --recurse https://github.com/jbeder/yaml-cpp.git test-proj
1820
cd test-proj
1921
git checkout yaml-cpp-0.7.0
2022

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

2427
# Add codechecker to the project
2528
cat <<EOF >> BUILD.bazel
@@ -52,3 +55,7 @@ EOF
5255

5356
# Add codechecker_bazel repo to WORKSPACE
5457
cat ../../templates/WORKSPACE.template >> WORKSPACE
58+
59+
# Check
60+
bazel version
61+
which bazel

test/foss/zlib-module/init.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
set -x
18+
1719
git clone --recurse https://github.com/madler/zlib.git test-proj
1820
cd test-proj
1921
git checkout 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71
2022

2123
# This file must be in the root of the project to be analyzed for bazelisk to work
22-
cp ../../templates/.bazelversion ./.bazelversion
24+
bazelversion="../../../../.bazelversion"
25+
[[ -f $bazelversion ]] && cp $bazelversion .
26+
2327
# Add codechecker to the project
2428
cat <<EOF >> BUILD.bazel
2529
#-------------------------------------------------------
@@ -51,3 +55,7 @@ EOF
5155
echo "common --enable_bzlmod" > .bazelrc
5256
# Add codechecker_bazel repo MODULE.bazel
5357
cat ../../templates/MODULE.template >> MODULE.bazel
58+
59+
# Check
60+
bazel version
61+
which bazel

test/foss/zlib/init.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
set -x
18+
1719
git clone --recurse https://github.com/madler/zlib.git test-proj
1820
cd test-proj
1921
git checkout 5a82f71ed1dfc0bec044d9702463dbdf84ea3b71
2022

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

2427
# Add codechecker to the project
2528
cat <<EOF >> BUILD.bazel
@@ -52,3 +55,7 @@ EOF
5255

5356
# Add codechecker_bazel repo to WORKSPACE
5457
cat ../../templates/WORKSPACE.template >> WORKSPACE
58+
59+
# Check
60+
bazel version
61+
which bazel

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)