Skip to content

Commit e331168

Browse files
committed
CI: Move tasks from Travis to 'github actions' to speed up CI
1 parent 9712c13 commit e331168

6 files changed

Lines changed: 155 additions & 99 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,23 @@ jobs:
3636
with:
3737
modules: 'qtcharts'
3838

39+
- name: Test CMake build
40+
run: |
41+
mkdir cmake.output
42+
cd cmake.output
43+
cmake -G "Unix Makefiles" -DBUILD_TESTS=On ..
44+
make -j$(nproc) check
45+
cd ..
46+
47+
- name: Unsigned char
48+
run: |
49+
make clean
50+
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
51+
./testrunner TestSymbolDatabase
52+
3953
- name: Build cppcheck
4054
run: |
55+
make clean
4156
cp externals/z3_version_old.h externals/z3_version.h
4257
make -j$(nproc) USE_Z3=yes HAVE_RULES=yes
4358
@@ -52,14 +67,49 @@ jobs:
5267
- name: Validate
5368
run: |
5469
make -j$(nproc) validateCFG validatePlatforms
55-
70+
5671
- name: Build GUI on ubuntu
5772
if: matrix.os == 'ubuntu-latest'
5873
run: |
5974
pushd gui
6075
qmake HAVE_QCHART=yes
6176
make -j$(nproc)
6277
78+
- name: Run GUI tests on ubuntu
79+
if: matrix.os == 'ubuntu-latest'
80+
run: |
81+
pushd gui/test/projectfile
82+
qmake
83+
make -j$(nproc)
84+
./test-projectfile
85+
86+
# Run self check after "Build GUI" to include generated headers in analysis
87+
- name: Self check
88+
if: matrix.os == 'ubuntu-latest'
89+
run: |
90+
# compile with verification and ast matchers
91+
make clean
92+
make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1
93+
# self check lib/cli
94+
mkdir b1
95+
./cppcheck -q -j$(nproc) --template=gcc --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling cli lib
96+
# check gui with qt settings
97+
mkdir b2
98+
./cppcheck -q -j$(nproc) --template=gcc --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ --enable=style,performance,portability,warning,internal --exception-handling gui/*.cpp
99+
# self check test and tools
100+
./cppcheck -q -j$(nproc) --template=gcc -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,internal --exception-handling test/*.cpp tools
101+
102+
- name: Build triage on ubuntu
103+
if: matrix.os == 'ubuntu-latest'
104+
run: |
105+
pushd tools/triage
106+
qmake
107+
make -j$(nproc)
108+
109+
- name: Fuzzer
110+
run: |
111+
g++ -fsyntax-only -Ilib oss-fuzz/*.cpp
112+
63113
- uses: actions/upload-artifact@v2
64114
with:
65115
name: cppcheck_cli

.github/workflows/asan.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3+
name: address sanitizer
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
build:
9+
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
fail-fast: false # not worthwhile...
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Install missing software on ubuntu
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install libxml2-utils
24+
sudo apt-get install z3 libz3-dev
25+
cp externals/z3_version_old.h externals/z3_version.h
26+
27+
- name: Build
28+
run: |
29+
cp externals/z3_version_old.h externals/z3_version.h
30+
CXXFLAGS="-fsanitize=address -Og -g3" make cppcheck testrunner -j$(nproc) USE_Z3=yes
31+
32+
- name: Run tests
33+
run: |
34+
./testrunner
35+
36+
- name: checkcfg
37+
run: |
38+
make checkcfg
39+

.github/workflows/irc.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
name: "IRC Push Notification"
2-
on: [push, pull_request, create]
2+
on: [pull_request, create]
33

44
jobs:
55
test:
66
if: github.repository == 'danmar/cppcheck'
77
runs-on: ubuntu-latest
88
steps:
9-
- name: irc push
10-
uses: rectalogic/notify-irc@v1
11-
if: github.event_name == 'push'
12-
with:
13-
channel: "#cppcheck"
14-
nickname: cppcheck-github-notifier
15-
message: |
16-
${{ github.actor }} pushed ${{ github.event.ref }} ${{ github.event.compare }}
17-
${{ join(github.event.commits.*.message) }}
189
- name: irc pull request
1910
uses: rectalogic/notify-irc@v1
2011
if: github.event_name == 'pull_request'

.github/workflows/scriptcheck.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ jobs:
3838
pylint --rcfile=pylintrc_travis htmlreport/*.py
3939
pylint --rcfile=pylintrc_travis tools/*.py
4040
41+
- name: compile addons
42+
run: |
43+
python -m compileall ./addons
44+
python3 -m compileall ./addons
45+
46+
- name: check .json files
47+
run: |
48+
find . -name '*.json' | xargs -n 1 python3 -m json.tool > /dev/null

.github/workflows/ubsan.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2+
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3+
name: undefined behaviour sanitizers
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
build:
9+
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
fail-fast: false # not worthwhile...
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Install missing software on ubuntu
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install libxml2-utils
24+
sudo apt-get install z3 libz3-dev
25+
cp externals/z3_version_old.h externals/z3_version.h
26+
27+
- name: Build
28+
run: |
29+
cp externals/z3_version_old.h externals/z3_version.h
30+
CXXFLAGS="-fsanitize=undefined -Og -g3" make cppcheck testrunner -j$(nproc) USE_Z3=yes
31+
32+
- name: Run tests
33+
run: |
34+
./testrunner
35+
36+
- name: checkcfg
37+
run: |
38+
make checkcfg
39+

.travis.yml

Lines changed: 17 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
before_install:
2121
# install needed deps
2222
- travis_retry sudo apt-get update -qq
23-
- travis_retry sudo apt-get install -qq python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator qttools5-dev qttools5-dev-tools libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev libz3-dev
23+
- travis_retry sudo apt-get install -qq python3-pip libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev libz3-dev
2424
# Python 2 modules
2525
- travis_retry python2 -m pip install --user pytest==4.6.4
2626
- travis_retry python2 -m pip install --user pylint
@@ -44,36 +44,8 @@ matrix:
4444
allow_failures:
4545
- name: "rerun dmake?"
4646
compiler: clang
47-
- name: "make ubuntu 14.04 trusty"
4847
# defined extra jobs that run besides what is configured in the build matrix
4948
include:
50-
# -fsanitize=undefined
51-
- name: "undefined behaviour sanitizers"
52-
compiler: gcc
53-
script:
54-
- CXXFLAGS="-fsanitize=undefined -fno-sanitize-recover=all -Og -g3" make cppcheck check checkcfg -j 2 -s
55-
# -fsanitize=address
56-
- name: "address sanitizers"
57-
compiler: gcc
58-
script:
59-
- CXXFLAGS="-fsanitize=address -Og -g3" make cppcheck check checkcfg -j 2 -s
60-
61-
# bug hunting
62-
- name: "bug hunting"
63-
compiler: gcc
64-
script:
65-
- make clean
66-
- make USE_Z3=yes -j2 all
67-
- ./testrunner TestExprEngine
68-
- python3 test/bug-hunting/cve.py
69-
- git clone https://github.com/regehr/itc-benchmarks.git ~/itc
70-
- python3 test/bug-hunting/itc.py
71-
- mkdir ~/juliet
72-
- curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip
73-
- cd ~/juliet
74-
- unzip -qq ~/juliet/juliet.zip
75-
- cd -
76-
- python3 test/bug-hunting/juliet.py
7749

7850
# check a lot of stuff that only needs to be checked in a single configuration
7951
- name: "misc"
@@ -117,9 +89,6 @@ matrix:
11789
# check --dump
11890
- ${CPPCHECK} test/testpreprocessor.cpp --dump
11991
- xmllint --noout test/testpreprocessor.cpp.dump
120-
# check python syntax by compiling all addon scripts
121-
- python -m compileall ./addons
122-
- python3 -m compileall ./addons
12392
# run pylint -- FIXME these are temporarily commented out because there is a syntax error in pylint
12493
# - pylint --rcfile=pylintrc_travis addons/*.py
12594
# - pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
@@ -171,20 +140,23 @@ matrix:
171140
- ${CPPCHECK} --dump namingng_test.c
172141
- python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
173142
- cd ../..
174-
# try CMake
175-
- mkdir cmake.output
176-
- cd cmake.output
177-
- cmake -G "Unix Makefiles" -DBUILD_TESTS=On ..
178-
- make -s -j2 check
179-
- cd ..
180-
# -funsigned-char
143+
144+
# bug hunting
145+
- name: "bug hunting"
146+
compiler: gcc
147+
script:
181148
- make clean
182-
- make -s -j2 CXXFLAGS=-funsigned-char testrunner
183-
- ./testrunner TestSymbolDatabase
184-
# check .json files
185-
- find . -name '*.json' | xargs -n 1 python3 -m json.tool > /dev/null
186-
# build fuzz client
187-
- make -s -j2 CXXFLAGS="-fsanitize=address" -C oss-fuzz fuzz-client
149+
- make USE_Z3=yes -j2 all
150+
- ./testrunner TestExprEngine
151+
- python3 test/bug-hunting/cve.py
152+
- git clone https://github.com/regehr/itc-benchmarks.git ~/itc
153+
- python3 test/bug-hunting/itc.py
154+
- mkdir ~/juliet
155+
- curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip
156+
- cd ~/juliet
157+
- unzip -qq ~/juliet/juliet.zip
158+
- cd -
159+
- python3 test/bug-hunting/juliet.py
188160

189161
# check if dmake needs to be rerun (this job may fail)
190162
- name: "rerun dmake?"
@@ -208,15 +180,6 @@ matrix:
208180
- CXX=g++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
209181
- make clean
210182
- CXX=clang++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
211-
# check if cppcheck builds on osx
212-
- name: "make osx"
213-
os: osx
214-
before_install:
215-
- true
216-
script:
217-
- CXX=g++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
218-
- make clean
219-
- CXX=clang++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
220183

221184
script:
222185
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
@@ -233,40 +196,6 @@ script:
233196
# compile cppcheck, default build
234197
- echo $CXXFLAGS
235198
- make -s check -j2
236-
# compile gui
237-
- cd gui
238-
- qmake
239-
- echo $CXXFLAGS
240-
- make -s -j2
241-
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
242-
- cd ../
243-
# self check lib/cli
244-
- mkdir b1
245-
- ${CPPCHECK} -q -j2 --template=gcc --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling cli lib
246-
# check gui with qt settings
247-
- mkdir b2
248-
- ${CPPCHECK} -q -j2 --template=gcc --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ --enable=style,performance,portability,warning,internal --exception-handling gui/*.cpp
249-
# self check test and tools
250-
- ${CPPCHECK} -q -j2 --template=gcc -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling test/*.cpp tools
251-
# Build gui
252-
- cd ./gui
253-
# clean rebuild
254-
- git clean -dfx .
255-
# can't set this as env flags, so try again with HAVE_RULES=yes
256-
- qmake HAVE_RULES=yes
257-
- echo $CXXFLAGS
258-
- make -s -j2
259-
- cd ../
260-
# Build gui/test
261-
- cd gui/test/projectfile
262-
- qmake && make -s -j2 && ./test-projectfile
263-
- cd -
264-
# Build triage
265-
- cd ./tools/triage
266-
- git clean -dfx .
267-
- qmake
268-
- make -s -j2
269-
- cd ../../
270199
# Testing cli
271200
- cp -R . ../cppcheck\ 2
272201
- cd ../cppcheck\ 2/test/cli # path with space

0 commit comments

Comments
 (0)