Skip to content

Commit 8775512

Browse files
authored
ci: add lint and cppcheck
1 parent 2efe05c commit 8775512

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/example2.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ jobs:
1313
- uses: actions/checkout@v4
1414

1515
- name: install g++
16-
run: sudo apt install -y g++
16+
run: sudo apt install -y g++ cppcheck
17+
18+
- name: run cppcheck
19+
run: |
20+
cppcheck hello_world.cpp --output-file=report.txt
21+
if [ -s report.txt ]; then # if file is not empty
22+
cat report.txt
23+
exit 1 # let github action fails
24+
fi
1725
1826
- name: check build
1927
run: |
20-
g++ hello_world.cpp -Wall -Werror -o hello_world
21-
# ./hello_world
28+
g++ hello_world.cpp -o hello_world
29+
./hello_world

0 commit comments

Comments
 (0)