Skip to content

Commit

Permalink
CI: Add scan-build
Browse files Browse the repository at this point in the history
Run scan-build (clang-tools based) static analyzer on all build
variants.

Use specific versions of the OSes as the default ones in travis are old
and unsuitable to install packages.
  • Loading branch information
Chaitanya Tata committed Jan 3, 2021
1 parent 66e2668 commit 5247885
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
language: cpp

addons:
apt:
packages:
# Need for scan-build
- clang-tools
homebrew:
taps: mgrebenets/scan-build
packages:
- scan-build
matrix:
include:
- os: linux
dist: bionic
compiler: gcc
- os: linux
dist: bionic
compiler: clang
- os: linux
dist: focal
compiler: gcc
- os: linux
dist: focal
compiler: clang
- os: osx
osx_image: xcode12.2

# See https://stackoverflow.com/a/26185979/2335781 and
# https://discourse.brew.sh/t/solved-scan-build-from-llvm-7-0-seems-broken-on-macos-mojave/3151/11
before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then sudo xcode-select --switch /Library/Developer/CommandLineTools/ ; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ; fi

script:
- make -C tests EXTRA_CFLAGS="-W -Wall -Wextra"
- make -C tests clean ; make -C tests pedantic
- make -C tests clean ; make -C tests pedantic EXTRA_CFLAGS=-DNO_DECLTYPE
- make -C tests clean ; make -C tests cplusplus
- make -C tests clean ; make -C tests cplusplus EXTRA_CFLAGS=-DNO_DECLTYPE
- scan-build make -C tests EXTRA_CFLAGS="-W -Wall -Wextra"
- make -C tests clean ; scan-build make -C tests pedantic
- make -C tests clean ; scan-build make -C tests pedantic EXTRA_CFLAGS=-DNO_DECLTYPE
- make -C tests clean ; scan-build make -C tests cplusplus
- make -C tests clean ; scan-build make -C tests cplusplus EXTRA_CFLAGS=-DNO_DECLTYPE

0 comments on commit 5247885

Please sign in to comment.