|
| 1 | +language: python |
| 2 | +python: 3.6 |
| 3 | + |
| 4 | + |
| 5 | +sudo: required |
| 6 | + |
| 7 | +env: |
| 8 | + global: |
| 9 | + # The Arduino IDE will be installed at APPLICATION_FOLDER/arduino |
| 10 | + - APPLICATION_FOLDER="${HOME}/arduino-ide" |
| 11 | + - SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook" |
| 12 | + |
| 13 | +before_install: |
| 14 | + |
| 15 | + # TODO: undo |
| 16 | + # remove submodules, we don't want those to be actually tested for compliance |
| 17 | + - git submodule status | rm -Rf `cut -d ' ' -f 3` |
| 18 | + |
| 19 | + # Formatting checks: |
| 20 | + # Check for files starting with a blank line |
| 21 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'head -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at start of $0."; false; fi' |
| 22 | + # don't check for tabs |
| 23 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' + |
| 24 | + # Check for trailing whitespace |
| 25 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' + |
| 26 | + # Check for non-Unix line endings |
| 27 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' + |
| 28 | + # Check for blank lines at end of files |
| 29 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'tail -1 "$0" | grep --binary-files=without-match --regexp="^$"; if [[ "$?" == "0" ]]; then echo "Blank line found at end of $0."; false; fi' |
| 30 | + # Check for files that don't end in a newline (https://stackoverflow.com/a/25686825) |
| 31 | + - find . -type d \( -path './.git' -o -path './examples' -o -path './src/Fonts' \) -prune -or -type f -print0 | xargs -0 -L1 bash -c 'if test "$(grep --files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' "$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; false; fi' |
| 32 | + |
| 33 | + - git clone https://github.com/per1234/arduino-ci-script.git "${HOME}/scripts/arduino-ci-script" |
| 34 | + - cd "${HOME}/scripts/arduino-ci-script" |
| 35 | + # Get new tags from the remote |
| 36 | + - git fetch --tags |
| 37 | + # Checkout the latest tag |
| 38 | + - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) |
| 39 | + - source "${HOME}/scripts/arduino-ci-script/arduino-ci-script.sh" |
| 40 | + |
| 41 | + #- set_script_verbosity 1 |
| 42 | + #- set_verbose_output_during_compilation "true" |
| 43 | + |
| 44 | + # Check for library issues that don't affect compilation |
| 45 | + - set_library_testing "true" |
| 46 | + |
| 47 | + - set_application_folder "$APPLICATION_FOLDER" |
| 48 | + - set_sketchbook_folder "$SKETCHBOOK_FOLDER" |
| 49 | + |
| 50 | + #- install_ide '("1.8.0" "1.8.10" "1.8.11")' |
| 51 | + - install_ide '("newest")' |
| 52 | + |
| 53 | + # Install the library from the repository |
| 54 | + #- install_library ESP32-Chimera-Core |
| 55 | + - install_library https://github.com/tobozo/ESP32-Chimera-Core/archive/master.zip |
| 56 | + - install_library https://github.com/PaulStoffregen/Time/archive/master.zip |
| 57 | + - install_library M5Stack-SD-Updater |
| 58 | + - install_library Sqlite3Esp32 |
| 59 | + - install_library https://github.com/tobozo/ESP32-BLECollector/releases/download/1.3/BLE.zip |
| 60 | + - install_package "esp32:esp32" "https://dl.espressif.com/dl/package_esp32_index.json" # # esp32:esp32:m5stack-core-esp32 |
| 61 | + - pip install pyserial |
| 62 | + |
| 63 | +script: |
| 64 | + # Compile all example sketches included with the library |
| 65 | + # build_sketch arguments: sketch name, fqbn, allow failure, IDE version/list/range |
| 66 | + - check_library_manager_compliance "$TRAVIS_BUILD_DIR" |
| 67 | + # compile at least one basic example |
| 68 | + - set_ide_preference "compiler.warning_level=auto" |
| 69 | + |
| 70 | + - mkdir "/tmp/BLECollector-binaries" |
| 71 | + - mkdir "/tmp/m5stack" |
| 72 | + - mkdir "/tmp/odroidgo" |
| 73 | + - mkdir "/tmp/m5fire" |
| 74 | + |
| 75 | + #- set_ide_preference "custom_PartitionScheme=min_spiffs" |
| 76 | + - set_ide_preference "build.path=/tmp/m5stack" |
| 77 | + - build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:m5stack-core-esp32:PartitionScheme=min_spiffs" "false" "newest" |
| 78 | + - cp "/tmp/m5stack/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/M5stack-BLECollector.bin" |
| 79 | + - set_ide_preference "build.path=/tmp/odroidgo" |
| 80 | + - build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:odroid_esp32:PartitionScheme=min_spiffs" "false" "newest" |
| 81 | + - cp "/tmp/odroidgo/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/OdroidGo-BLECollector.bin" |
| 82 | + - set_ide_preference "build.path=/tmp/m5fire" |
| 83 | + - build_sketch "${TRAVIS_BUILD_DIR}/ESP32-BLECollector.ino" "esp32:esp32:m5stack-fire:PartitionScheme=default" "false" "newest" |
| 84 | + - cp "/tmp/m5fire/ESP32-BLECollector.ino.bin" "/tmp/BLECollector-binaries/M5Fire-BLECollector.bin" |
| 85 | + - ls /tmp/BLECollector-binaries -la |
| 86 | + |
| 87 | + #- if [ "$TRAVIS_BRANCH" != "master" ]; then echo "This commit was made against the $TRAVIS_BRANCH, skipping examples compilation"; exit 0; fi |
| 88 | + #- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "This is a pull request, skipping examples compilation"; exit 0; fi |
| 89 | + |
| 90 | +after_script: |
| 91 | + # Commit a report of the job results to the CI-reports repository |
| 92 | + #- USER_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 1)" |
| 93 | + #- REPOSITORY_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 2)" |
| 94 | + #- publish_report_to_repository "$REPORT_GITHUB_TOKEN" "https://github.com/${USER_NAME}/CI-reports.git" "$REPOSITORY_NAME" "build_$(printf "%05d\n" "${TRAVIS_BUILD_NUMBER}")" "false" |
| 95 | + # Print a tab separated report of all sketch verification results to the log |
| 96 | + - display_report |
| 97 | + |
| 98 | +notifications: |
| 99 | + email: |
| 100 | + on_success: always |
| 101 | + on_failure: always |
| 102 | + webhooks: |
| 103 | + urls: |
| 104 | + - https://www.travisbuddy.com/ |
| 105 | + on_success: never |
| 106 | + on_failure: always |
| 107 | + |
| 108 | +deploy: |
| 109 | + - provider: releases |
| 110 | + api_key: "${GH_TOKEN}" |
| 111 | + file: |
| 112 | + - "/tmp/BLECollector-binaries/M5stack-BLECollector.bin" |
| 113 | + - "/tmp/BLECollector-binaries/OdroidGo-BLECollector.bin" |
| 114 | + - "/tmp/BLECollector-binaries/M5Fire-BLECollector.bin" |
| 115 | + #skip_cleanup: true |
| 116 | + # draft: true |
| 117 | + on: |
| 118 | + branch: master |
0 commit comments