-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
279 lines (215 loc) · 15.3 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# This file is used to test the script with Travis CI
env:
global:
# The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
- APPLICATION_FOLDER="${HOME}/arduino-ide"
- SKETCHBOOK_FOLDER="${HOME}/arduino-sketchbook"
matrix:
allow_failures:
# define the key used to determine whether job failures are allowed
# The expected behavior of this job is failure because 1.6.3 doesn't support boards manager installation.
- env: INSTALL_IDE_START_VERSION="1.6.3" VERBOSITY_LEVEL=2 VERBOSE_COMPILATION="false"
include:
# 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.
#- env: INSTALL_IDE_START_VERSION=""
#language: generic
# Test install_ide using full version list. Causes the job to exceed Travis CI's maximum duration and thus can not be run.
#- env: INSTALL_IDE_START_VERSION="all" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false"
#language: generic
# Test install_ide using custom version list
# Test the use of the special version names "oldest", "newest", and "hourly" in a version list.
# Test duplicates in version list
- env: INSTALL_IDE_START_VERSION='("oldest" "1.8.3" "1.8.4" "1.8.4" "newest" "hourly")' VERBOSITY_LEVEL=1 VERBOSE_COMPILATION="true"
language: generic
# Test install_ide using version range.
# Test the use of the special version name "newest" in a version range.
# Test installing the full sane range of IDE versions
- env: INSTALL_IDE_START_VERSION="1.6.5-r5" INSTALL_IDE_END_VERSION="newest" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false"
language: generic
# Test the use of the special version name "hourly" in a version range.
- env: INSTALL_IDE_START_VERSION="1.8.3" INSTALL_IDE_END_VERSION="hourly" VERBOSITY_LEVEL=0 VERBOSE_COMPILATION="false"
language: generic
# Allowed to fail
# Test install_ide using single version
# Test the failure behavior of install_package when a Boards Manager installation is attempted using an IDE version that doesn't support it.
- env: INSTALL_IDE_START_VERSION="1.6.3" VERBOSITY_LEVEL=2 VERBOSE_COMPILATION="false"
language: generic
# Check for common issues with scripts
- name: 'ShellCheck'
language: minimal
# Must define an empty install phase so that the default one won't be used
install: true
script:
- shellcheck arduino-ci-script.sh
# Check for inconsistent script formatting
- name: 'Script Formatting Check'
language: minimal
install:
- docker run --volume "$TRAVIS_BUILD_DIR":/mnt --workdir /mnt mvdan/shfmt:latest -i 2 -w .
script:
- git diff --color --exit-code
- name: 'Unit Tests'
language: minimal
install:
- git clone https://github.com/bats-core/bats-core.git
- cd bats-core
# 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`)
- sudo ./install.sh /usr/local
- cd ..
- rm --recursive --force bats-core
- cd ..
- git clone https://github.com/per1234/arduino-ci-script-tests
- cd arduino-ci-script-tests
- git checkout d9c33763ccde4467f43e1a5ddb8632e0575e6c3e
script:
- bats check_keywords_txt.bats
- bats check_library_manager_compliance.bats
- bats check_library_properties.bats
- bats check_library_structure.bats
- bats check_sketch_structure.bats
- bats miscellaneous.bats
# Check the files in the repository for consistent formatting
- name: "File Formatting Checks"
language: minimal
# Must define an empty install phase so that the default one won't be used
install: true
script:
# Check for files starting with a blank line
- 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'
# Check for tabs
- 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 '{}' +
# Check for trailing whitespace
- 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 '{}' +
# Check for non-Unix line endings
- 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 '{}' +
# Check for blank lines at end of files
- 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'
# Check for files that don't end in a newline (https://stackoverflow.com/a/25686825)
- 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'
# Check for commonly misspelled words
- name: "Spell Check"
language: python
python: 3.6
install:
# https://github.com/codespell-project/codespell
- pip install codespell
script:
- codespell --skip="${TRAVIS_BUILD_DIR}/.git" --ignore-words="${TRAVIS_BUILD_DIR}/etc/codespell-ignore-words-list.txt" "${TRAVIS_BUILD_DIR}"
# Default phases shared by all jobs that don't define their own
install:
- source "${TRAVIS_BUILD_DIR}/arduino-ci-script.sh"
- set_script_verbosity "$VERBOSITY_LEVEL"
- set_application_folder "$APPLICATION_FOLDER"
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"
# Check for board definition errors that don't affect compilation
- set_board_testing "true"
# Check for library issues that don't affect compilation
- set_library_testing "true"
- install_ide "$INSTALL_IDE_START_VERSION" "$INSTALL_IDE_END_VERSION"
# Install hardware packages
# Test package install from this repository (can't do this because the repository isn't a hardware package)
# - install_package
# Test manual package install from compressed file download
- install_package "https://github.com/SpenceKonde/ATTinyCore/archive/master.zip"
# Test manual package install from Git repository clone
- install_package "https://github.com/MCUdude/MightyCore.git"
# Test manual package install from Git repository clone
- install_package "https://github.com/JChristensen/mighty-1284p.git" "v1.6.3"
# Test library installation from repository (can't do this because there is no library in this repository)
# - install_library
# Test library install from .zip file. A non-GitHub library download must be used because GitHub appends -{branch name} or -{release version} to the .zip downloads and having a library folder installed whose name contains "-" causes arduino 1.5.6 or older to hang.
- install_library "https://bitbucket.org/teckel12/arduino-new-ping/downloads/NewPing_v1.8.zip"
# Test library install from .zip file/folder that has a dot in the name. It must be renamed so that it won't have a hyphen in the folder name, which causes verification to hang with Arduino IDE 1.5.2 - 1.5.6-r2.
# Test library install from .zip file with rename.
- install_library "https://github.com/arduino-libraries/CapacitiveSensor/archive/0.5.1.zip" "CapacitiveSensor"
# Test library install from git repo
- install_library "https://github.com/sfrwmaker/WirelessOregonV2.git"
# Test library install from git repo with branch
- install_library "https://github.com/sde1000/NanodeUNIO.git" "master"
# Test library install from git repo with rename
- install_library "https://github.com/mikaelpatel/Arduino-Shell.git" "" "ArduinoShell"
# Test library install from git repo with branch and rename
- install_library "https://github.com/Avamander/max7456.git" "master" "max_7456"
# Test set_verbose_output_during_compilation.
- set_verbose_output_during_compilation "$VERBOSE_COMPILATION"
# Boards Manager and Library Manager tests are done as late as possible to allow job 3 to do more thorough testing of script verbosity level 2 before the job fails
# Test Boards Manager package install without URL. Test error handling of attempting to do a Boards Manager installation when the newest installed IDE version doesn't support it (should print a helpful error message and fail instead of hanging).
- install_package "arduino:sam"
# Test Boards Manager package install with URL
- install_package "MiniCore:avr" "https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json"
# Test library install from Library Manager
- install_library "Pushetta:1.0.1"
script:
- check_sketch_structure "${SKETCHBOOK_FOLDER}/libraries/NewPing/examples"
- check_library_structure "${SKETCHBOOK_FOLDER}/libraries/CapacitiveSensor"
- check_library_properties "${SKETCHBOOK_FOLDER}/libraries/NewPing"
- check_keywords_txt "${SKETCHBOOK_FOLDER}/libraries/NewPing"
- check_library_manager_compliance "${SKETCHBOOK_FOLDER}/libraries/NewPing"
- check_code_formatting "1" "" "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum"
# Test library installed from .zip with rename
# Test library installed from .zip with dot in the folder name
# Test board from hardware package manually installed from compressed file download
# Test build_sketch with specific IDE version
# Test build_sketch without absolute path
- cd "${SKETCHBOOK_FOLDER}/libraries/CapacitiveSensor/examples/CapacitiveSensorSketch/"
- build_sketch "CapacitiveSensorSketch.pde" "ATTinyCore-master:avr:attinyx5:LTO=disable,TimerClockSource=default,chip=85,clock=8internal,eesave=aenable,bod=disable,millis=enabled" "false" "1.8.4"
# Test library installed from .zip
# Test board from hardware package installed via Boards Manager without URL
# Test build_sketch with "newest" special version name
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/NewPing/examples/NewPingExample/NewPingExample.pde" "arduino:sam:arduino_due_x_dbg" "false" "newest"
# Test library installed from .git
# Test board from hardware package installed with Boards Manager URL
# Test build_sketch with an IDE version list
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/WirelessOregonV2/examples/OregonReceiver/OregonReceiver.ino" "MiniCore:avr:328:variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external" "false" '("1.8.3" "1.8.4")'
# Test library installed from .git with branch
# Test board from hardware package manually installed by cloning Git repository
# Test build_sketch with an IDE version list using the "newest" special version name
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/NanodeUNIO/examples/NanodeUNIO_test/NanodeUNIO_test.pde" "MightyCore:avr:1284:pinout=standard,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external" "false" '("1.8.4" "newest")'
# Test library installed from .git with rename
# Test board from hardware package manually installed by cloning Git repository with non-default branch
# Test build_sketch with an IDE version range
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/ArduinoShell/examples/ShellBlink/ShellBlink.ino" "mighty-1284p:avr:avr_developers" "false" "1.8.3" "1.8.4"
# Test library installed from .git with branch and rename
# Test build_sketch with an IDE version range using the "newest" special version name
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/max_7456/examples/HelloWorld/HelloWorld.ino" "arduino:avr:uno" "false" "1.8.4" "newest"
# Test build_sketch with no IDE version argument (should use all installed IDE versions)
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "arduino:avr:uno" "false"
# Test build_sketch with "all" IDE version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "arduino:avr:uno" "false" "all"
# Test library installed from Library Manager
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/Pushetta/examples/simple_notification/simple_notification.ino" "arduino:avr:uno" "false" "newest"
# Test build_sketch allowed to fail (this will fail because WirelessOregonV2 is AVR specific)
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/WirelessOregonV2/examples/OregonReceiver/OregonReceiver.ino" "arduino:sam:arduino_due_x_dbg" "true" "newest"
# build_sketch with folder argument tests:
# Test build_sketch with folder argument with specific IDE version
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "1.8.4"
# Test build_sketch with folder argument with an IDE version list
# Test build_sketch with an IDE version list using the "oldest" and "newest" special version names
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" '("oldest" "newest")'
# Test build_sketch with folder argument with an IDE version range
# Test build_sketch with an IDE version range using the "oldest" and "newest" special version names
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "oldest" "newest"
# Test build_sketch with folder argument with no IDE version specified (should use all installed IDE versions)
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false"
# Test build_sketch with folder argument with "all" IDE version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "all"
# Test build_sketch with folder argument required to fail (this will fail because WirelessOregonV2 is AVR specific)
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/WirelessOregonV2/examples" "arduino:sam:arduino_due_x_dbg" "require" "newest"
- publish_report_to_gist "$REPORT_GITHUB_TOKEN" "$REPORT_GIST_URL" "true"
- 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}")" "true"
- display_report
notifications:
email:
on_success: always
on_failure: always
webhooks:
urls:
# Use TravisBuddy to automatically comment on any pull request that results in a failed CI build
- https://www.travisbuddy.com/
on_success: never
on_failure: always