Skip to content

Commit e16f263

Browse files
[CI] Fix CPP Format Issue
The format test for CPP was done through a bash script which calls make format under the hood. The issue was that if make format fails, it thinks that the formatting is good, which is bad. I have fixed the script so that it actually fails if make format fails. The thing that was causing make format to fail was that the dependencies that VPR needs to build were not installed. Added these dependencies.
1 parent aec8907 commit e16f263

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,27 @@ jobs:
128128
fail-fast: false
129129
matrix:
130130
include:
131-
- { name: 'C/C++', script: 'check-format.sh' , with_python: 'no', pkgs: 'clang-format-18' }
132-
- { name: 'Python', script: 'check-format-py.sh', with_python: 'yes', pkgs: '' }
133-
- { name: 'Python Lint', script: 'pylint_check.py' , with_python: 'yes', pkgs: '' }
131+
- { name: 'C/C++', script: 'check-format.sh' , with_python: 'yes', with_submodules: 'true', all_vtr_pkgs: 'yes', pkgs: 'clang-format-18' }
132+
- { name: 'Python', script: 'check-format-py.sh', with_python: 'yes', with_submodules: 'true', all_vtr_pkgs: 'yes', pkgs: '' }
133+
- { name: 'Python Lint', script: 'pylint_check.py' , with_python: 'yes', with_submodules: 'false', all_vtr_pkgs: 'no', pkgs: '' }
134134
name: 'F: ${{ matrix.name }}'
135135
steps:
136136

137137
- uses: actions/checkout@v4
138-
# NOTE: We do not need sub-modules. We do not check sub-modules for formatting.
138+
with:
139+
submodules: ${{ matrix.with_submodules }}
140+
# NOTE: We usually do not need sub-modules. We do not check sub-modules
141+
# for formatting. However we may need to build make-format which
142+
# requires building VTR which will not build without submodules.
143+
# TODO: We should relax this requirement.
144+
145+
# In order to perform a cpp format of VTR, make format is used which requires
146+
# all of the vpr dependencies to be installed.
147+
# TODO: This should be fixed so this test is not as heavy. We do not need
148+
# these dependencies to perform a simple format.
149+
- name: Install dependencies
150+
if: ${{ matrix.all_vtr_pkgs == 'yes' }}
151+
run: ./install_apt_packages.sh
139152

140153
# TODO: This should be on the same version of Python as would be found on
141154
# Ubuntu 24.04 (3.12.3); however that version has some linting errors.

dev/check-format.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ if [ $clean -ne 0 ]; then
88
else
99
echo "Code Formatting Check"
1010
echo "====================="
11-
make format"$1" > /dev/null 2>&1
11+
make format"$1" > /dev/null
12+
if [ $? -ne 0 ]; then
13+
echo "make format failed!"
14+
exit 1
15+
fi
1216

1317
valid_format=$(git diff | wc -l)
1418

0 commit comments

Comments
 (0)