diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 0000000..5d1be43 --- /dev/null +++ b/.codespellignore @@ -0,0 +1 @@ + "text" : "Serial Oscuino sends and receives OSC packets over SLIPSerial \nto and from an Arduino or Teensy running the oscuinoSerial Sketch \n\n" diff --git a/.travis-ci.sh b/.travis-ci.sh new file mode 100644 index 0000000..80cb733 --- /dev/null +++ b/.travis-ci.sh @@ -0,0 +1,85 @@ +#!/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 "./.codespellignore" -or \ + -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]" --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]" --exclude-file .codespellignore $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 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..dbd1e49 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,92 @@ +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 log + +cache: + directories: + - "~/.platformio" + - $HOME/.cache/pip # pip cache + +env: + global: + # Warnings are errors + - PLATFORMIO_BUILD_FLAGS="-Werror -Wno-error=deprecated-declarations" + +matrix: + fast_finish: true + include: + - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/UDPReceive + - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/UDPSendBundle + - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/UDPSendBundlewithTimeTag + - env: BOARD=teensylc PLATFORMIO_CI_SRC=examples/UDPSendMessage + + - env: BOARD=teensy30 PLATFORMIO_CI_SRC=examples/UDPReceive + - env: BOARD=teensy30 PLATFORMIO_CI_SRC=examples/UDPSendBundle + - env: BOARD=teensy30 PLATFORMIO_CI_SRC=examples/UDPSendBundlewithTimeTag + - env: BOARD=teensy30 PLATFORMIO_CI_SRC=examples/UDPSendMessage + + - env: BOARD=teensy31 PLATFORMIO_CI_SRC=examples/UDPReceive + - env: BOARD=teensy31 PLATFORMIO_CI_SRC=examples/UDPSendBundle + - env: BOARD=teensy31 PLATFORMIO_CI_SRC=examples/UDPSendBundlewithTimeTag + - env: BOARD=teensy31 PLATFORMIO_CI_SRC=examples/UDPSendMessage + + - env: BOARD=teensy35 PLATFORMIO_CI_SRC=examples/UDPReceive + - env: BOARD=teensy35 PLATFORMIO_CI_SRC=examples/UDPSendBundle + - env: BOARD=teensy35 PLATFORMIO_CI_SRC=examples/UDPSendBundlewithTimeTag + - env: BOARD=teensy35 PLATFORMIO_CI_SRC=examples/UDPSendMessage + + - env: BOARD=teensy36 PLATFORMIO_CI_SRC=examples/UDPReceive + - env: BOARD=teensy36 PLATFORMIO_CI_SRC=examples/UDPSendBundle + - env: BOARD=teensy36 PLATFORMIO_CI_SRC=examples/UDPSendBundlewithTimeTag + - env: BOARD=teensy36 PLATFORMIO_CI_SRC=examples/UDPSendMessage + + - 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/codespell-project/codespell.git; fi + +script: + - bash -ex .travis-ci.sh diff --git a/README.md b/README.md index bd035f0..1a38826 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.com/CNMAT/OSC.svg?branch=master)](https://travis-ci.com/CNMAT/OSC) + # OSC for Arduino This is an Arduino and Teensy library implementation of the [OSC](http://opensoundcontrol.org) (Open Sound Control) encoding.It was developed primarily by Yotam Mann and Adrian Freed at CNMAT where OSC was invented. It benefits from contributions from John MacCallum, Matt Wright, Jeff Lubow and Andy Schmeder and many beta testers. @@ -232,4 +234,4 @@ The serial examples use a 9600 baud rate which is reliable on most of the FTDI b We welcome and appreciate your contributions and feedback. # New in this release -ESPxx, M0, PIC32 \ No newline at end of file +ESPxx, M0, PIC32