From 943bb4f0ff7d5ece1ebe1674a7fd7ea2923d7bed Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 5 Jun 2018 17:51:48 +0100 Subject: [PATCH 1/8] Create .travis.yml --- .travis.yml | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d88a9e9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,69 @@ +language: python +python: + - "2.7" + +os: linux +dist: trusty +# Short duration job, use the container/without sudo image as it boots faster +sudo: false +# Use the latest Travis images since they are more up to date than the stable release. +group: edge + +before_cache: + - rm -f $HOME/.cache/pip/log/debug.log # erase lo + +cache: + directories: + - "~/.platformio" + - $HOME/.cache/pip # pip cache + +env: + global: + # Warnings are errors + - PLATFORMIO_BUILD_FLAGS="-Werror" + +matrix: + fast_finish: true + include: + - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/DimmerWithMaster + + - os: linux + dist: trusty + # Short duration job, would use the container/without sudo image as it boots faster, but we need a backported lintian, so don't + sudo: required + env: TASK='spellintian' + addons: + apt: + packages: + - moreutils + - os: linux + dist: trusty + # Short duration job, would use the container/without sudo image as it boots faster, but we need a backported lintian, so don't + sudo: required + env: TASK='spellintian-duplicates' + addons: + apt: + packages: + - moreutils + - os: linux + dist: trusty + env: TASK='codespell' + addons: + apt: + packages: + - moreutils + + allow_failures: + - os: linux + dist: trusty + env: TASK='spellintian-duplicates' + +before_install: + - if [ "$TASK" == "spellintian" -o "$TASK" == "spellintian-duplicates" ]; then sudo add-apt-repository ppa:waja/trusty-backports -y; sudo apt-get update -qq; sudo apt-get install lintian -y; fi # Install a late enough lintian + +install: + - if [ -z "$TASK" ]; then pip install --upgrade platformio; fi + - if [ "$TASK" = "codespell" ]; then pip install --upgrade git+https://github.com/lucasdemarchi/codespell.git; fi + +script: + - bash -ex .travis-ci.sh From e9492902dce81d26b3b8eb2d82c43a9de25b37d3 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Tue, 5 Jun 2018 17:52:36 +0100 Subject: [PATCH 2/8] Create .travis-ci.sh --- .travis-ci.sh | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .travis-ci.sh diff --git a/.travis-ci.sh b/.travis-ci.sh new file mode 100644 index 0000000..c3fc4d3 --- /dev/null +++ b/.travis-ci.sh @@ -0,0 +1,84 @@ +#!/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 + +CPP_LINT_URL="https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"; + +SPELLINGBLACKLIST=$(cat <<-BLACKLIST + -wholename "./.git/*" +BLACKLIST +) + +if [[ $TASK = 'lint' ]]; then + # run the lint tool only if it is the requested task + # first check we've not got any generic NOLINTs + # count the number of generic NOLINTs + nolints=$(grep -IR NOLINT * | grep -v "NOLINT(" | wc -l) + if [[ $nolints -ne 0 ]]; then + # print the output for info + echo $(grep -IR NOLINT * | grep -v "NOLINT(") + echo "Found $nolints generic NOLINTs" + exit 1; + else + echo "Found $nolints generic NOLINTs" + fi; + # then fetch and run the main cpplint tool + wget -O cpplint.py $CPP_LINT_URL; + chmod u+x cpplint.py; + ./cpplint.py \ + --filter=-legal/copyright,-readability/streams,-runtime/arrays \ + $(find ./ \( -name "*.h" -or -name "*.cpp" \) | xargs) + if [[ $? -ne 0 ]]; then + exit 1; + fi; +elif [[ $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 --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 --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; +else + platformio ci --lib="." --board=$BOARD +fi From 735bf65d4153f8272ee47ea0fe9daece4b6cb0ac Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 13:31:01 +0100 Subject: [PATCH 3/8] Create .codespellignore --- .codespellignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .codespellignore diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 0000000..60f6fcd --- /dev/null +++ b/.codespellignore @@ -0,0 +1,7 @@ + PRE_SOM = 0, + GOT_SOM = 1, + receiving_state recv_mode = PRE_SOM; + case PRE_SOM: + recv_mode = GOT_SOM; + case GOT_SOM: + recv_mode = PRE_SOM; From c3a712caca9c32fed0f7291f084a0fefc85e5769 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 13:32:34 +0100 Subject: [PATCH 4/8] Add a .codespellignore --- .travis-ci.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index c3fc4d3..80cb733 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -8,6 +8,7 @@ set -e CPP_LINT_URL="https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"; SPELLINGBLACKLIST=$(cat <<-BLACKLIST + -wholename "./.codespellignore" -or \ -wholename "./.git/*" BLACKLIST ) @@ -70,10 +71,10 @@ elif [[ $TASK = 'codespell' ]]; then $SPELLINGBLACKLIST \ \) | xargs") # count the number of codespell errors - spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles 2>&1 | wc -l) + spellingerrors=$(zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles 2>&1 | wc -l) if [[ $spellingerrors -ne 0 ]]; then # print the output for info - zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellingfiles + zrun codespell --check-filenames --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignore $spellingfiles echo "Found $spellingerrors spelling errors via codespell" exit 1; else From b528e147497c8f13d6cb41d1c38ebd4707997676 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 13:59:56 +0100 Subject: [PATCH 5/8] Build Arduinos --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d88a9e9..4c5ecba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,9 @@ env: matrix: fast_finish: true include: - - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/DimmerWithMaster + - env: BOARD=uno + - env: BOARD=diecimilaatmega328 + - env: BOARD=pro16MHzatmega328 - os: linux dist: trusty From ebd2287cd773cfc1d2417d68db38056289b411e3 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 14:07:34 +0100 Subject: [PATCH 6/8] Try and add the source files --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c5ecba..5e5c644 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,9 @@ env: matrix: fast_finish: true include: - - env: BOARD=uno - - env: BOARD=diecimilaatmega328 - - env: BOARD=pro16MHzatmega328 + - env: BOARD=uno PLATFORMIO_CI_SRC=. + - env: BOARD=diecimilaatmega328 PLATFORMIO_CI_SRC=. + - env: BOARD=pro16MHzatmega328 PLATFORMIO_CI_SRC=. - os: linux dist: trusty From a8ec5b1257fa6a98acc348d1dc9db523c55b6373 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 14:23:47 +0100 Subject: [PATCH 7/8] Cast to fix a warning --- RDMHandlers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RDMHandlers.cpp b/RDMHandlers.cpp index d0a3617..d0c3ad0 100644 --- a/RDMHandlers.cpp +++ b/RDMHandlers.cpp @@ -716,7 +716,7 @@ void RDMHandler::HandleRDMMessage(const byte *message, int size) { (expected_esta_id == WidgetSettings.EstaId() && (WidgetSettings.MatchesSerialNumber(message + 5) || is_broadcast)) || - (expected_esta_id == 0xffff && is_broadcast)); + (expected_esta_id == (int)0xffff && is_broadcast)); if (!to_us) { if (is_broadcast) { From e3074e6c9f7712a5dfa6299745d6e13b5bc04b68 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Fri, 8 Jun 2018 14:34:30 +0100 Subject: [PATCH 8/8] Switch to deep library dependency finder --- .travis-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis-ci.sh b/.travis-ci.sh index 80cb733..eb35433 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -81,5 +81,5 @@ elif [[ $TASK = 'codespell' ]]; then echo "Found $spellingerrors spelling errors via codespell" fi; else - platformio ci --lib="." --board=$BOARD + platformio ci --lib="." --project-option="lib_ldf_mode=deep" --board=$BOARD fi