|
1 | 1 | # This file is used to test the script with Travis CI
|
2 | 2 |
|
3 |
| -# Although sudo is no longer required by arduino-ci-script since the 1.0.0 release, for some reason setting "sudo: false" causes the Travis CI build time to significantly increase so this setting is left as "sudo: required" |
4 |
| -sudo: required |
5 |
| - |
6 |
| - |
7 |
| -# It's necessary to do this just for codespell |
8 |
| -language: python |
9 |
| -python: 3.6 |
10 |
| - |
11 |
| - |
12 | 3 | env:
|
13 | 4 | global:
|
14 | 5 | # The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
|
15 | 6 | - APPLICATION_FOLDER="${HOME}/arduino-ide"
|
16 | 7 | - SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook"
|
| 8 | +matrix: |
| 9 | + allow_failures: |
| 10 | + # define the key used to determine whether job failures are allowed |
| 11 | + # The expected behavior of this job is failure because 1.6.3 doesn't support boards manager installation. |
| 12 | + - env: INSTALL_IDE_START_VERSION="1.6.3" VERBOSITY_LEVEL=2 VERBOSE_COMPILATION="false" |
| 13 | + include: |
| 14 | + |
17 | 15 |
|
18 |
| - matrix: |
19 | 16 | # Test install_ide with no argument (using full version list). Causes the job to exceed Travis CI's maximum duration and thus can not be run.
|
20 |
| - # - INSTALL_IDE_START_VERSION="" |
| 17 | + #- env: INSTALL_IDE_START_VERSION="" |
| 18 | + #language: generic |
| 19 | + |
21 | 20 |
|
22 | 21 | # Test install_ide using full version list. Causes the job to exceed Travis CI's maximum duration and thus can not be run.
|
23 |
| - #- INSTALL_IDE_START_VERSION="all" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 22 | + #- env: INSTALL_IDE_START_VERSION="all" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 23 | + #language: generic |
| 24 | + |
24 | 25 |
|
25 | 26 | # Test install_ide using custom version list
|
26 | 27 | # Test the use of the special version names "oldest", "newest", and "hourly" in a version list.
|
27 | 28 | # Test duplicates in version list
|
28 |
| - - INSTALL_IDE_START_VERSION='("oldest" "1.8.3" "1.8.4" "1.8.4" "newest" "hourly")' VERBOSITY_LEVEL=1 VERBOSE_COMPILATION="true" |
| 29 | + - env: INSTALL_IDE_START_VERSION='("oldest" "1.8.3" "1.8.4" "1.8.4" "newest" "hourly")' VERBOSITY_LEVEL=1 VERBOSE_COMPILATION="true" |
| 30 | + language: generic |
| 31 | + |
29 | 32 |
|
30 | 33 | # Test install_ide using version range.
|
31 | 34 | # Test the use of the special version name "newest" in a version range.
|
32 | 35 | # Test installing the full sane range of IDE versions
|
33 |
| - - INSTALL_IDE_START_VERSION="1.6.5-r5" INSTALL_IDE_END_VERSION="newest" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 36 | + - env: INSTALL_IDE_START_VERSION="1.6.5-r5" INSTALL_IDE_END_VERSION="newest" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 37 | + language: generic |
| 38 | + |
34 | 39 |
|
35 | 40 | # Test the use of the special version name "hourly" in a version range.
|
36 |
| - - INSTALL_IDE_START_VERSION="1.8.3" INSTALL_IDE_END_VERSION="hourly" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 41 | + - env: INSTALL_IDE_START_VERSION="1.8.3" INSTALL_IDE_END_VERSION="hourly" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false" |
| 42 | + language: generic |
| 43 | + |
37 | 44 |
|
38 | 45 | # Allowed to fail
|
39 | 46 | # Test install_ide using single version
|
40 | 47 | # Test the failure behavior of install_package when a Boards Manager installation is attempted using an IDE version that doesn't support it.
|
41 |
| - - INSTALL_IDE_START_VERSION="1.6.3" VERBOSITY_LEVEL=2 VERBOSE_COMPILATION="false" |
42 |
| - |
43 |
| - |
44 |
| -matrix: |
45 |
| - allow_failures: |
46 |
| - # The expected behavior is failure because 1.6.3 doesn't support boards manager installation. |
47 | 48 | - env: INSTALL_IDE_START_VERSION="1.6.3" VERBOSITY_LEVEL=2 VERBOSE_COMPILATION="false"
|
48 |
| - |
49 |
| - |
50 |
| -before_install: |
51 |
| - # Check for issues in the script |
52 |
| - - shellcheck arduino-ci-script.sh |
53 |
| - |
54 |
| - # Check script's formatting |
55 |
| - - go get -u mvdan.cc/sh/cmd/shfmt |
56 |
| - - shfmt -i 2 -d . |
57 |
| - |
58 |
| - # Run unit tests |
59 |
| - - git clone https://github.com/bats-core/bats-core.git |
60 |
| - - cd bats-core |
61 |
| - # Get new tags from the remote |
62 |
| - - git fetch --tags |
63 |
| - # Checkout the latest tag |
64 |
| - - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) |
65 |
| - - sudo ./install.sh /usr/local |
66 |
| - - cd .. |
67 |
| - - rm --recursive --force bats-core |
68 |
| - - bats --version |
69 |
| - - cd .. |
70 |
| - - git clone https://github.com/per1234/arduino-ci-script-tests |
71 |
| - - cd arduino-ci-script-tests |
72 |
| - - bats check_keywords_txt.bats |
73 |
| - - bats check_library_manager_compliance.bats |
74 |
| - - bats check_library_properties.bats |
75 |
| - - bats check_library_structure.bats |
76 |
| - - bats check_sketch_structure.bats |
77 |
| - - bats miscellaneous.bats |
78 |
| - - cd ../arduino-ci-script |
79 |
| - |
80 |
| - # Formatting checks: |
81 |
| - # Check for files starting with a blank line |
82 |
| - - find . -path ./.git -prune -o -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' |
83 |
| - # Check for tabs |
84 |
| - - find . -path './.git' -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -prune -or -not -path './tests/check_library_properties.bats' -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' + |
85 |
| - # Check for trailing whitespace |
86 |
| - - find . -path './.git' -prune -or -path './tests/check_library_properties' -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' + |
87 |
| - # Check for non-Unix line endings |
88 |
| - - find . -path './.git' -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -prune -or -type f -exec grep --files-with-matches --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' + |
89 |
| - # Check for blank lines at end of files |
90 |
| - - find . -path ./.git -prune -o -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' |
91 |
| - # Check for files that don't end in a newline (https://stackoverflow.com/a/25686825) |
92 |
| - - find . -path ./.git -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -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' |
93 |
| - |
94 |
| - # Check for typos |
95 |
| - - pip install codespell |
96 |
| - - codespell --skip="${TRAVIS_BUILD_DIR}/.git" --ignore-words="${TRAVIS_BUILD_DIR}/etc/codespell-ignore-words-list.txt" "${TRAVIS_BUILD_DIR}" |
97 |
| - |
| 49 | + language: generic |
| 50 | + |
| 51 | + |
| 52 | + # Check for common issues with scripts |
| 53 | + - name: 'ShellCheck' |
| 54 | + language: minimal |
| 55 | + # Must define an empty install phase so that the default one won't be used |
| 56 | + install: true |
| 57 | + script: |
| 58 | + - shellcheck arduino-ci-script.sh |
| 59 | + |
| 60 | + |
| 61 | + # Check for inconsistent script formatting |
| 62 | + - name: 'Script Formatting Check' |
| 63 | + language: go |
| 64 | + install: |
| 65 | + - go get -u mvdan.cc/sh/cmd/shfmt |
| 66 | + script: |
| 67 | + - shfmt -i 2 -d . |
| 68 | + |
| 69 | + |
| 70 | + - name: 'Unit Tests' |
| 71 | + language: minimal |
| 72 | + install: |
| 73 | + - git clone https://github.com/bats-core/bats-core.git |
| 74 | + - cd bats-core |
| 75 | + # Get new tags from the remote |
| 76 | + - git fetch --tags |
| 77 | + # Checkout the latest tag |
| 78 | + - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) |
| 79 | + - sudo ./install.sh /usr/local |
| 80 | + - cd .. |
| 81 | + - rm --recursive --force bats-core |
| 82 | + - cd .. |
| 83 | + - git clone https://github.com/per1234/arduino-ci-script-tests |
| 84 | + - cd arduino-ci-script-tests |
| 85 | + script: |
| 86 | + - bats check_keywords_txt.bats |
| 87 | + - bats check_library_manager_compliance.bats |
| 88 | + - bats check_library_properties.bats |
| 89 | + - bats check_library_structure.bats |
| 90 | + - bats check_sketch_structure.bats |
| 91 | + - bats miscellaneous.bats |
| 92 | + |
| 93 | + |
| 94 | + # Check the files in the repository for consistent formatting |
| 95 | + - name: "File Formatting Checks" |
| 96 | + language: minimal |
| 97 | + # Must define an empty install phase so that the default one won't be used |
| 98 | + install: true |
| 99 | + script: |
| 100 | + # Check for files starting with a blank line |
| 101 | + - find . -path ./.git -prune -o -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' |
| 102 | + # Check for tabs |
| 103 | + - find . -path './.git' -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -prune -or -not -path './tests/check_library_properties.bats' -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp=$'\t' '{}' \; -exec echo 'Tab found.' \; -exec false '{}' + |
| 104 | + # Check for trailing whitespace |
| 105 | + - find . -path './.git' -prune -or -path './tests/check_library_properties' -prune -or -type f -exec grep --with-filename --line-number --binary-files=without-match --regexp='[[:blank:]]$' '{}' \; -exec echo 'Trailing whitespace found.' \; -exec false '{}' + |
| 106 | + # Check for non-Unix line endings |
| 107 | + - find . -path './.git' -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -prune -or -type f -exec grep --files-with-matches --regexp=$'\r$' '{}' \; -exec echo 'Non-Unix EOL detected.' \; -exec false '{}' + |
| 108 | + # Check for blank lines at end of files |
| 109 | + - find . -path ./.git -prune -o -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' |
| 110 | + # Check for files that don't end in a newline (https://stackoverflow.com/a/25686825) |
| 111 | + - find . -path ./.git -prune -or -path './tests/check_keywords_txt' -prune -or -path './tests/check_library_manager_compliance' -prune -or -path './tests/check_library_properties' -prune -or -path './tests/check_library_structure' -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' |
| 112 | + |
| 113 | + |
| 114 | + # Check for commonly misspelled words |
| 115 | + - name: "Spell Check" |
| 116 | + language: python |
| 117 | + python: 3.6 |
| 118 | + install: |
| 119 | + # https://github.com/codespell-project/codespell |
| 120 | + - pip install codespell |
| 121 | + script: |
| 122 | + - codespell --skip="${TRAVIS_BUILD_DIR}/.git" --ignore-words="${TRAVIS_BUILD_DIR}/etc/codespell-ignore-words-list.txt" "${TRAVIS_BUILD_DIR}" |
| 123 | + |
| 124 | + |
| 125 | +# Default phases shared by all jobs that don't define their own |
| 126 | +install: |
98 | 127 | - source "${TRAVIS_BUILD_DIR}/arduino-ci-script.sh"
|
99 | 128 |
|
100 | 129 | - set_script_verbosity "$VERBOSITY_LEVEL"
|
@@ -241,6 +270,7 @@ notifications:
|
241 | 270 | on_failure: always
|
242 | 271 | webhooks:
|
243 | 272 | urls:
|
| 273 | + # Use TravisBuddy to automatically comment on any pull request that results in a failed CI build |
244 | 274 | - https://www.travisbuddy.com/
|
245 | 275 | on_success: never
|
246 | 276 | on_failure: always
|
0 commit comments