diff options
| -rw-r--r-- | .travis-ci.sh | 79 | ||||
| -rw-r--r-- | .travis.yml | 170 | ||||
| -rw-r--r-- | README.md | 2 | 
3 files changed, 250 insertions, 1 deletions
| diff --git a/.travis-ci.sh b/.travis-ci.sh new file mode 100644 index 0000000..b3e0744 --- /dev/null +++ b/.travis-ci.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# This script is triggered from the script section of .travis.yml +# It runs the appropriate commands depending on the task requested. + +set -e + +COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" + +SPELLINGBLACKLIST=$(cat <<-BLACKLIST +      -wholename "./.git/*" +BLACKLIST +) + +if [[ $TASK = 'spellintian' ]]; then +  # run spellintian only if it is the requested task, ignoring duplicate words +  spellingfiles=$(eval "find ./ -type f -and ! \( \ +      $SPELLINGBLACKLIST \ +      \) | xargs") +  # count the number of spellintian errors, ignoring duplicate words +  spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | grep -v "\(duplicate word\)" | wc -l) +  if [[ $spellingerrors -ne 0 ]]; then +    # print the output for info +    zrun spellintian $spellingfiles | grep -v "\(duplicate word\)" +    echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" +    exit 1; +  else +    echo "Found $spellingerrors spelling errors via spellintian, ignoring duplicates" +  fi; +elif [[ $TASK = 'spellintian-duplicates' ]]; then +  # run spellintian only if it is the requested task +  spellingfiles=$(eval "find ./ -type f -and ! \( \ +      $SPELLINGBLACKLIST \ +      \) | xargs") +  # count the number of spellintian errors +  spellingerrors=$(zrun spellintian $spellingfiles 2>&1 | wc -l) +  if [[ $spellingerrors -ne 0 ]]; then +    # print the output for info +    zrun spellintian $spellingfiles +    echo "Found $spellingerrors spelling errors via spellintian" +    exit 1; +  else +    echo "Found $spellingerrors spelling errors via spellintian" +  fi; +elif [[ $TASK = 'codespell' ]]; then +  # run codespell only if it is the requested task +  spellingfiles=$(eval "find ./ -type f -and ! \( \ +      $SPELLINGBLACKLIST \ +      \) | xargs") +  # count the number of codespell errors +  spellingerrors=$(zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l) +  if [[ $spellingerrors -ne 0 ]]; then +    # print the output for info +    zrun codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles +    echo "Found $spellingerrors spelling errors via codespell" +    exit 1; +  else +    echo "Found $spellingerrors spelling errors via codespell" +  fi; +elif [[ $TASK = 'coverity' ]]; then +  # Run Coverity Scan unless token is zero length +  # The Coverity Scan script also relies on a number of other COVERITY_SCAN_ +  # variables set in .travis.yml +  if [[ ${#COVERITY_SCAN_TOKEN} -ne 0 ]]; then +    curl -s $COVERITY_SCAN_BUILD_URL | bash +  else +    echo "Skipping Coverity Scan as no token found, probably a Pull Request" +  fi; +elif [[ $TASK = 'sanitize' ]]; then +  # Run sanitized compile +  travis_fold start "make_sanitize" +  make sanitize; +  travis_fold end "make_sanitize" +else +  # Otherwise compile as normal +  travis_fold start "make" +  make; +  travis_fold end "make" +fi diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1b7c2e2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,170 @@ +language: c +# Use the latest Travis images since they are more up to date than the stable release. +group: edge + +before_script: + - export -f travis_fold + +script: + - "bash -ex .travis-ci.sh" + +addons: +  apt: +    packages: &base_build +     # This is the absolute minimum for configure to pass +     # Non C++ based tasks use it so they can run make builtfiles +     - ccache +    packages: &core_build +     # This is all the bits we need to enable all options +     - *base_build +     - libasound2-dev +     - libevdev-dev +    packages: &core_build_gpp_latest +     - *core_build +     - gcc-8 +    packages: &core_build_clang_latest +     - *core_build +     - clang-6.0 + +matrix: +  fast_finish: true +  include: +    - os: osx +      osx_image: xcode10.2 +      compiler: clang +      env: +      - TASK='compile' +    - os: osx +      osx_image: xcode10.2 +      compiler: gcc +      env: +      - TASK='compile' +    - os: osx +      osx_image: xcode10.2 +      compiler: clang +      env: +      - TASK='sanitize' +    - os: linux +      dist: xenial +      compiler: clang +      env: TASK='compile' +      addons: +        apt: +          packages: +           - *core_build_clang_latest +          sources: +           - ubuntu-toolchain-r-test +           - llvm-toolchain-xenial-6.0 +    - os: linux +      dist: xenial +      compiler: gcc +      env: TASK='compile' +      addons: +        apt: +          packages: +           - *core_build_gpp_latest +          sources: +           - ubuntu-toolchain-r-test +    - os: linux +      dist: xenial +      compiler: clang +      env: TASK='sanitize' +      addons: +        apt: +          packages: +           - *core_build_clang_latest +          sources: +           - ubuntu-toolchain-r-test +           - llvm-toolchain-xenial-6.0 +    - os: linux +      dist: xenial +      compiler: gcc +      env: TASK='coverity' +      addons: +        apt: +          packages: +           # Coverity doesn't work with g++-5 or g++-6 yet +           - *core_build +           - gcc-4.9 +          sources: +           - ubuntu-toolchain-r-test +    - os: linux +      dist: xenial +      env: TASK='spellintian' +      addons: +        apt: +          packages: +           - *core_build +           - moreutils +    - os: linux +      dist: xenial +      env: TASK='spellintian-duplicates' +      addons: +        apt: +          packages: +           - *core_build +           - moreutils +    - os: linux +      dist: xenial +      env: TASK='codespell' +      addons: +        apt: +          packages: +           - *core_build +           - moreutils +  allow_failures: +    - os: linux +      dist: xenial +      compiler: gcc +      env: TASK='coverity' +    - os: linux +      dist: xenial +      env: TASK='spellintian-duplicates' + +env: +  global: +   # No colours in terminal (to reduce log file size) +   - TERM=dumb +   # Parallel make build +   - MAKEFLAGS="-j 2" +   # -- BEGIN Coverity Scan ENV +   - COVERITY_SCAN_BUILD_COMMAND_PREPEND="cov-configure --comptype gcc --compiler gcc-4.9 --template" +   # The build command with all of the arguments that you would apply to a manual `cov-build` +   # Usually this is the same as STANDARD_BUILD_COMMAND, excluding the automated test arguments +   - COVERITY_SCAN_BUILD_COMMAND="make" +   # Name of the project +   - COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG" +   # Email address for notifications related to this build +   # - COVERITY_SCAN_NOTIFICATION_EMAIL="" +   # Regular expression selects on which branches to run analysis +   # Be aware of quotas. Do not run on every branch/commit +   - COVERITY_SCAN_BRANCH_PATTERN=".*" +   # COVERITY_SCAN_TOKEN via "travis encrypt" using the repo's public key +   # - secure: "" +   # -- END Coverity Scan ENV + +cache: +  apt: true +  directories: +    - $HOME/.ccache # ccache cache + +before_cache: +  - ccache -s # see how many hits ccache got + +install: +  - if [ "$TASK" = "codespell" ]; then pip install --user git+https://github.com/codespell-project/codespell.git; fi + +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH=/usr/local/opt/ccache/libexec:$PATH; fi # Use ccache on Mac too +#Coverity doesn't work with g++ 5 or 6, so only upgrade to g++ 4.9 for that + - if [ "$TRAVIS_OS_NAME" == "linux" -a \( "$TASK" = "compile" -o "$TASK" = "sanitize" \) -a "$CC" = "gcc" ]; then export CC="ccache gcc-8"; fi +#Use the latest clang if we're compiling with clang + - if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" = "clang" ]; then export CC="clang-6.0"; fi +#Report the compiler version + - $CC --version + - if [ "$TASK" == "spellintian" -o "$TASK" == "spellintian-duplicates" ]; then wget "http://archive.ubuntu.com/ubuntu/pool/main/l/lintian/lintian_2.5.104_all.deb"; sudo dpkg -i lintian_*.deb; sudo apt-get install -f -y; fi # Install a later lintian + +after_script: +  - if [ "$TASK" = "coverity" ]; then tail -n 10000 ${TRAVIS_BUILD_DIR}/cov-int/build-log.txt; cat ${TRAVIS_BUILD_DIR}/cov-int/scm_log.txt; fi @@ -22,7 +22,7 @@ on any other (or the same) supported protocol, for example to:  * Control lighting fixtures or DAWs using gamepad controllers ([Example configuration](configs/evdev.conf))  * Play games or type using MIDI controllers -[](https://scan.coverity.com/projects/15168) +[](https://travis-ci.com/cbdevnet/midimonster) [](https://scan.coverity.com/projects/15168)  # Table of Contents | 
