Skip to content

Commit f8f4676

Browse files
authored
feat: add cppcheck to the pipeline (#203)
* feat: add cppcheck to the pipeline * chore: update cpp check ci * chore: check cpp check pipeline * fix: cpp check * wip * wip * fix: pipeline
1 parent 7572cbf commit f8f4676

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- '**'
74
pull_request:
85
branches: [main]
96

@@ -15,4 +12,4 @@ jobs:
1512
- name: install g++
1613
run: sudo apt install -y g++
1714
- name: check build
18-
run: source ./compile.sh
15+
run: source ./compile.sh

.github/workflows/cpp-check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: cpp-check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
cpp-check:
10+
strategy:
11+
fail-fast: false
12+
runs-on: [ubuntu-22.04]
13+
name: cpp check
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install dependencies
17+
run: |
18+
sudo apt update -y
19+
sudo apt install -y cppcheck
20+
- name: cpp check
21+
run: |
22+
cppcheck --force --inline-suppr --output-file=report.txt exercises/
23+
if [ -s report.txt ]; then # if file is not empty
24+
cat report.txt
25+
exit 1 # let github action fails
26+
fi

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.vscode/
1+
.vscode/
2+
report.txt
3+

0 commit comments

Comments
 (0)