libfort/.travis.yml

314 lines
8.1 KiB
YAML
Raw Permalink Normal View History

2018-03-09 08:45:23 +01:00
language: C
matrix:
include:
2018-11-26 21:15:29 +01:00
- name: "Basic linux gcc"
os: linux
2018-03-17 19:33:48 +01:00
sudo: false
2018-03-09 08:45:23 +01:00
compiler: gcc
before_script:
- pip install --user cpp-coveralls
2019-04-12 20:03:08 +02:00
- pip install --user cmakelint
2020-05-21 21:20:27 +02:00
env:
2018-11-27 18:40:33 +01:00
- BASIC_LINUX_GCC=yes
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['cppcheck', 'doxygen', 'graphviz', 'python-sphinx']
deploy:
provider: pages
skip_cleanup: true
local_dir: $TRAVIS_BUILD_DIR/docs/html
github_token: $GITHUB_API_KEY
on:
2018-11-27 19:03:12 +01:00
branch: master
2018-03-09 08:45:23 +01:00
after_success:
- coveralls --build-root build --include src --include tests --gcov-options '\-lp'
2018-11-26 21:19:16 +01:00
2018-11-26 21:15:29 +01:00
- name: "Basic linux clang"
os: linux
2018-03-17 19:33:48 +01:00
sudo: required # to prevent fail of executables build with clang and sanitizers
2018-03-09 09:03:03 +01:00
compiler: clang
2020-05-21 21:20:27 +02:00
env:
2019-01-01 19:43:21 +01:00
- CC=clang
- BASIC_LINUX_CLANG=yes
addons:
apt:
sources: ['llvm-toolchain-trusty-4.0']
packages: ['clang-tidy-4.0']
2018-03-31 12:33:37 +02:00
# Linux / GCC
2018-11-26 21:15:29 +01:00
- name: "Linux gcc-4.9"
os: linux
sudo: false
compiler: gcc
2020-05-21 21:20:27 +02:00
env:
- FORT_C_COMPILER=gcc-4.9
- FORT_CXX_COMPILER=g++-4.9
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9']
2018-11-26 21:15:29 +01:00
- name: "Linux gcc-5"
os: linux
sudo: false
compiler: gcc
2020-05-21 21:20:27 +02:00
env:
- FORT_C_COMPILER=gcc-5
- FORT_CXX_COMPILER=g++-5
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5']
2018-11-26 21:15:29 +01:00
- name: "Linux gcc-6"
os: linux
sudo: false
compiler: gcc
2020-05-21 21:20:27 +02:00
env:
- FORT_C_COMPILER=gcc-6
- FORT_CXX_COMPILER=g++-6
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6']
2018-11-26 21:15:29 +01:00
- name: "Linux gcc-7"
os: linux
sudo: required
compiler: gcc
2020-05-21 21:20:27 +02:00
env:
- FORT_C_COMPILER=gcc-7
- FORT_CXX_COMPILER=g++-7
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7']
2018-05-09 12:29:29 +02:00
2018-11-26 21:15:29 +01:00
- name: "Linux gcc-8"
os: linux
2018-09-01 19:22:39 +02:00
sudo: required
compiler: gcc
2020-05-21 21:20:27 +02:00
env:
2018-09-01 19:22:39 +02:00
- FORT_C_COMPILER=gcc-8
- FORT_CXX_COMPILER=g++-8
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-8']
2018-11-27 18:55:25 +01:00
2020-05-21 21:20:27 +02:00
- name: "Linux gcc-9"
os: linux
sudo: required
compiler: gcc
env:
- FORT_C_COMPILER=gcc-9
- FORT_CXX_COMPILER=g++-9
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-9']
2018-05-09 12:29:29 +02:00
# OSX / Clang
2018-11-26 21:15:29 +01:00
- name: "OSX xcode7.3"
os: osx
2018-05-09 12:29:29 +02:00
osx_image: xcode7.3
env: CC=clang
2018-11-26 21:15:29 +01:00
- name: "OSX xcode8.3"
os: osx
2018-05-09 12:29:29 +02:00
osx_image: xcode8.3
env: CC=clang
2018-11-26 21:15:29 +01:00
- name: "OSX xcode9.3"
os: osx
2018-05-09 12:29:29 +02:00
osx_image: xcode9.3
env: CC=clang
2018-03-17 19:33:48 +01:00
2018-03-09 08:45:23 +01:00
script:
- CMAKE_C_FLAGS="-Werror"
- CMAKE_CXX_FLAGS="-Werror"
# Check library file was generated
- python amalgamate.py -o dummy.c
2018-11-18 07:27:14 +01:00
- wc dummy.c
- wc lib/fort.c
- diff dummy.c lib/fort.c
- rm dummy.c
# make sure CC is correctly set
- if [[ "${FORT_C_COMPILER}" != "" ]];
then
export CC=${FORT_C_COMPILER};
export CXX=${FORT_CXX_COMPILER};
fi
2019-04-12 19:58:31 +02:00
# check CMakeLists.txt
- |
if [ "${BASIC_LINUX_GCC}" = "yes" ]; then
cmakelint CMakeLists.txt
fi
2018-12-03 21:25:17 +01:00
# basic build with old c standard (use gnu89 instead of c89 because some functions are not defines in c89)
2018-12-03 21:14:12 +01:00
- cd lib
- ${CC} -Wall -Wextra -Werror --std=gnu89 fort.c -c -o fort.o
2018-12-03 21:14:12 +01:00
- rm fort.o
- cd ..
2019-01-12 12:37:07 +01:00
# basic build c++ compiler
2019-01-12 12:50:03 +01:00
- |
if [ "${BASIC_LINUX_GCC}" = "yes" ]; then
2019-01-12 12:58:28 +01:00
cd lib
2019-01-12 12:50:03 +01:00
g++ -Wall -Wextra -Werror fort.c -c -o fort.o
rm fort.o
cd ..
fi
2018-12-03 21:14:12 +01:00
2018-12-03 21:01:09 +01:00
2019-08-27 08:27:20 +02:00
## cppcheck run
#- |
# if [ "${BASIC_LINUX_GCC}" = "yes" ]; then
# cppcheck --std=posix --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib
# cppcheck --std=c89 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib
# cppcheck --std=c99 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib
# cppcheck --std=c++11 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib
# fi
2018-11-18 08:10:57 +01:00
2019-01-01 19:43:21 +01:00
# clang-tidy run
- |
if [ "${BASIC_LINUX_CLANG}" = "yes" ]; then
# don't know how force warnings of clang-tidy to be errors
cp .clang-tidy lib
2019-01-01 21:06:19 +01:00
clang-tidy lib/fort.c
echo "Clang-tidy exit code is $?"
2019-01-01 19:43:21 +01:00
fi
2018-11-26 21:38:53 +01:00
# doxygen run
2018-11-26 20:49:41 +01:00
- |
2018-11-27 18:40:33 +01:00
if [ "${BASIC_LINUX_GCC}" = "yes" ]; then
2018-11-26 20:49:41 +01:00
cd docs
2018-11-27 17:43:53 +01:00
make doxygen html
2018-11-26 20:49:41 +01:00
cd ..
fi
2018-03-09 08:45:23 +01:00
# Print all environment variables to aid in CI development
- printenv
# Print version and available CMake generators to aid in CI development
- cmake --version
2018-03-09 09:03:03 +01:00
# Perform out-of-source build(CMake backend generation, build, and test)
2018-03-18 17:02:53 +01:00
# Test build without optimizations and with asan
2018-03-09 09:03:03 +01:00
- mkdir -p build
- cd build
- cmake .. -DFORT_BUILD_TYPE=asan -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}"
2018-03-09 09:03:03 +01:00
- cmake --build . --target all
- ls
2019-04-26 22:28:30 +02:00
- ctest -VV
2018-03-09 09:03:03 +01:00
# Test without WCHAR and UTF-8 support
2018-11-16 19:16:05 +01:00
- cd ..
- rm -r build/*
- mkdir -p build
- cd build
- cmake .. -DFORT_ENABLE_WCHAR=OFF -DFORT_ENABLE_UTF8=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}"
2018-11-16 19:16:05 +01:00
- cmake --build . --target all
- ls
2019-04-26 22:28:30 +02:00
- ctest -VV
2018-11-16 19:16:05 +01:00
2018-03-18 17:02:53 +01:00
# Test build without optimizations and with ubsan
2018-03-31 12:33:37 +02:00
- |
if [ "${CC}" = 'gcc-7' ]; then
cd .. ;
rm -r build/* ;
cd build ;
cmake .. -DFORT_BUILD_TYPE=ubsan -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" ;
2018-03-31 12:33:37 +02:00
cmake --build . --target all ;
ls ;
2019-04-26 22:28:30 +02:00
ctest -VV;
fi
2018-03-18 17:02:53 +01:00
2018-03-31 12:33:37 +02:00
# Astyle Format
2019-10-26 09:47:25 +02:00
# - |
# if [ "${CC}" = 'gcc' ]; then
# ls
# cd .. ;
# rm -r build/* ;
# cd build ;
# cmake .. -DFORT_ENABLE_ASTYLE=ON ;
# make ;
# make format ;
# cd .. ;
# if [[ -n $(git diff) ]]; then
# echo "You must run make format before submitting a pull request" ;
# echo "" ;
# git diff ;
# exit -1 ;
# fi
# cd build ;
# rm -rf external
# fi
2018-03-31 12:33:37 +02:00
2019-07-18 21:58:26 +02:00
# Clang static analyzer (doesn't work - can't find scan-build)
# - |
# if [ "${CC}" = 'clang' ]; then
# cd .. ;
# pwd ;
# ls ;
# rm -rf build/* ;
# cd build ;
# cmake .. ;
# scan-build make ;
# fi
2018-03-31 12:33:37 +02:00
2020-02-12 20:41:20 +01:00
# Test package installation
- cd ..
- rm -r build/*
- cmake -H. -Bbuild -DFORT_ENABLE_TESTING=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=`pwd`/install
2020-02-12 20:41:20 +01:00
- cmake --build build --target all
- cmake --build build -- install
- ls `pwd`/install
- cd tests/package_tests
2020-02-20 21:19:40 +01:00
- cmake -H. -B_build -DCMAKE_PREFIX_PATH=../../install -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=./_install_foo
2020-02-12 20:41:20 +01:00
- cmake --build _build -- -j3
2020-02-20 21:19:40 +01:00
- ./_build/foo-app
- cmake --build _build -- install
2020-02-12 20:41:20 +01:00
- rm -rf _build
2020-02-20 21:19:40 +01:00
- rm -rf _install_foo
2020-02-12 20:41:20 +01:00
- cd ../../build
2020-02-23 07:19:51 +01:00
# Test cmake integration via `add_subdirectory`
2020-02-23 07:09:32 +01:00
- cd ..
- rm -r build/*
- ln -s `pwd` tests/add_subdirectory_tests/libfort
- cd tests/add_subdirectory_tests/
- cmake -H. -B_build -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=./_install_foo
- cmake --build _build -- -j3
- ./_build/foo-app
- cmake --build _build -- install
- rm -rf _build
- rm -rf _install_foo
- cd ../../build
2018-03-31 15:40:59 +02:00
# Build for coveralls (should be the last)
2019-10-26 09:52:29 +02:00
- |
if [ "${CC}" = 'gcc' ]; then
cd .. ;
rm -r build/* ;
cd build ;
cmake .. -DFORT_BUILD_TYPE=coveralls -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" ;
cmake --build . --target all ;
ls ;
./tests/libfort_test_dev ;
fi
- cd ..
2018-03-31 15:40:59 +02:00
2018-11-26 20:39:31 +01:00