Skip to content

Commit c86dce1

Browse files
committed
add travis ci
try adding osx into th emix get scan-build involved do not ask only on linux run the script semi-colon in right place add cppcheck use brew for cpp get both compilers working add clang back not exit 1 brew install clang/llvm try just llvm try to exclude analyze in osx fix for osx debug move cppcheck to were it should be
1 parent 4da4bd5 commit c86dce1

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

.travis.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
#
3+
# Build script for travis-ci.org builds to handle compiles and static
4+
# analysis when ANALYZE=true.
5+
#
6+
if [ "$ANALYZE" = "true" ]; then
7+
if [ "$CC" = "clang" ]; then
8+
scan-build make -j 2
9+
else
10+
cppcheck --error-exitcode=1 --quiet .
11+
cppcheck --template "{file}({line}): {severity} ({id}): {message}" \
12+
--enable=style --force --std=c11 -j 2 --inline-suppr \
13+
unsf.c 2> cppcheck.txt
14+
if [ -s cppcheck.txt ]; then
15+
cat cppcheck.txt
16+
exit 0
17+
fi
18+
fi
19+
else
20+
make
21+
fi

.travis.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
language: c
2+
3+
sudo: required
4+
5+
dist: trusty
6+
7+
os:
8+
- linux
9+
- osx
10+
11+
compiler:
12+
- clang
13+
- gcc
14+
15+
env:
16+
- ANALYZE=false
17+
- ANALYZE=true
18+
19+
matrix:
20+
exclude:
21+
- os: osx
22+
env: ANALYZE=true
23+
24+
before_install:
25+
- '[[ "$TRAVIS_OS_NAME" != "linux" ]] || sudo apt-get update -qq'
26+
27+
install:
28+
- '[[ "$TRAVIS_OS_NAME" != linux ]] || sudo apt-get -qy install clang cppcheck'
29+
30+
script:
31+
- ./.travis.sh
32+
33+
notifications:
34+
recipients:
35+
36+
email:
37+
on_success: change
38+
on_failure: always

Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
CC=gcc
2-
31
unsf:
4-
gcc -g -O2 -o unsf unsf.c -lm
2+
cc -g -O2 -o unsf unsf.c -lm
53
install: unsf
64
install unsf $(DESTDIR)/usr/bin/
75
uninstall:

0 commit comments

Comments
 (0)