Just Call Me Koko 6 лет назад
Родитель
Сommit
6eac839d72
1 измененных файлов с 74 добавлено и 38 удалено
  1. 74 38
      .travis.yml

+ 74 - 38
.travis.yml

@@ -1,55 +1,91 @@
-sudo: false
+sudo: required
 
 language: python
+python: 3.6
 
-os:
-  - linux
-
-git:
-  depth: false
+env:
+  global:
+    # The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
+    - APPLICATION_FOLDER="${HOME}/arduino-ide"
+    - SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook"
 
 before_install:
-  - git submodule update --init --recursive
 
-stages:
-  - build
-  - deploy
+  # TODO: undo
+  # remove submodules, we don't want those to be actually tested for compliance
+  - git submodule status | rm -Rf `cut -d ' ' -f 3`
+
+  # Formatting checks:
+  # Check for files starting with a blank line
+  - find . -path './.git' -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'
+  # Check for tabs
+  - find . -path './.git' -prune -or -type f \( ! -iname ".gitmodules" \) -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' +
+  # Check for trailing whitespace
+  - find . -path './.git' -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' +
+  # Check for non-Unix line endings
+  - find . -path './.git' -prune -or -type f -exec grep --files-with-matches --binary-files=without-match --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' +
+  # Check for blank lines at end of files
+  - find . -path './.git' -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'
+  # Check for files that don't end in a newline (https://stackoverflow.com/a/25686825)
+  - find . -path './.git' -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'
+
+  - git clone https://github.com/per1234/arduino-ci-script.git "${HOME}/scripts/arduino-ci-script"
+  - cd "${HOME}/scripts/arduino-ci-script"
+  # Get new tags from the remote
+  - git fetch --tags
+  # Checkout the latest tag
+  - git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
+  - source "${HOME}/scripts/arduino-ci-script/arduino-ci-script.sh"
+
+  #- set_script_verbosity 1
+  #- set_verbose_output_during_compilation "true"
+
+  # Check for library issues that don't affect compilation
+  - set_library_testing "true"
 
-jobs:
-  include:
+  - set_application_folder "$APPLICATION_FOLDER"
+  - set_sketchbook_folder "$SKETCHBOOK_FOLDER"
 
-    - name: "Build Arduino 0"
-      if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
-      stage: build
-      script: $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 0 10
+  - install_ide '("1.8.0" "1.8.9" "newest")'
 
-    - name: "Build Arduino 1"
-      if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
-      stage: build
-      script: $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 10
+  # Install the library from the repository
+  - install_library
+  - install_library "M5Stack"
+  - install_library 'https://github.com/bblanchon/ArduinoJson.git' # "ArduinoJSON"
 
-    - name: "Build Arduino 2"
-      if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
-      stage: build
-      script: $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 2 10
+  - ls ${TRAVIS_BUILD_DIR} -la
+  - ls ${TRAVIS_BUILD_DIR}/examples/M5Stack-SD-Menu/ -la
+  - ls $SKETCHBOOK_FOLDER -la
+  - ls $SKETCHBOOK_FOLDER/libraries -la
+  - pwd
+  # what the fsck is wrong install_package() ??
+  - install_package "esp32:esp32" "https://dl.espressif.com/dl/package_esp32_index.json" #  # esp32:esp32:m5stack-core-esp32
+  #- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "compiler.warning_level=none" --save-prefs   &>/dev/null
+  #- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "build.warn_data_percentage=75" --save-prefs   &>/dev/null
+  #- /home/travis/arduino-ide/arduino-1.8.10/arduino --pref "boardsmanager.additional.urls=https://dl.espressif.com/dl/package_esp32_index.json" --save-prefs   &>/dev/null
+  #- /home/travis/arduino-ide/arduino-1.8.10/arduino --install-boards esp32:esp32 &>/dev/null
+  - pip install pyserial
 
-    - name: "Build Arduino 3"
-      if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
-      stage: build
-      script: $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 3 10
+script:
+  # Compile all example sketches included with the library
+  # build_sketch arguments: sketch name, fqbn, allow failure, IDE version/list/range
+  - check_library_manager_compliance "$TRAVIS_BUILD_DIR"
+  - build_sketch "${TRAVIS_BUILD_DIR}/examples/M5Stack-SD-Menu/M5Stack-SD-Menu.ino" "esp32:esp32:m5stack-core-esp32:FlashFreq=80,UploadSpeed=921600" "false" "newest"
 
-    - name: "Build PlatformIO"
-      if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
-      stage: build
-      script: $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh 1 1
+after_script:
+  # Commit a report of the job results to the CI-reports repository
+  - USER_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 1)"
+  - REPOSITORY_NAME="$(echo "$TRAVIS_REPO_SLUG" | cut -d'/' -f 2)"
+  - 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"
+  # Print a tab separated report of all sketch verification results to the log
+  - display_report
 
 notifications:
   email:
-    on_success: change
-    on_failure: change
+    on_success: always
+    on_failure: always
   webhooks:
     urls:
-        - https://webhooks.gitter.im/e/cb057279c430d91a47a8
-    on_success: change  # options: [always|never|change] default: always
-    on_failure: always  # options: [always|never|change] default: always
-    on_start: never     # options: [always|never|change] default: always
+      - https://www.travisbuddy.com/
+    on_success: never
+    on_failure: always