diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml new file mode 100644 index 0000000..fbb4b4e --- /dev/null +++ b/.github/workflows/check-links.yml @@ -0,0 +1,30 @@ +name: Check Links + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/check-links.yml" + - "**.md" + pull_request: + paths: + - ".github/workflows/check-links.yml" + - "**.md" + schedule: + # Run every Tuesday at 3 AM UTC to catch breakage caused by changes to the linked sites. + - cron: "0 3 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Check links + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: yes diff --git a/.travis.yml b/.travis.yml index baf1d5f..11b7482 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,11 +60,11 @@ matrix: # Check for inconsistent script formatting - name: 'Script Formatting Check' - language: go + language: minimal install: - - go get -u mvdan.cc/sh/cmd/shfmt + - docker run --volume "$TRAVIS_BUILD_DIR":/mnt --workdir /mnt mvdan/shfmt:latest -i 2 -w . script: - - shfmt -i 2 -d . + - git diff --color --exit-code - name: 'Unit Tests' @@ -198,7 +198,7 @@ script: # 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,bod=disable" "false" "1.8.4" + - 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 diff --git a/README.md b/README.md index 09eb6db..38e0d66 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ Echo a tab separated report of all verification results to the log. The report i - Library Issue - Short description of the last library issue detected. ##### `publish_report_to_repository REPORT_GITHUB_TOKEN repositoryURL reportBranch reportFolder doLinkComment` -Add the report to a repository. See the [instructions for publishing job reports](publishing-job-reports) for details. +Add the report to a repository. See the [instructions for publishing job reports](#publishing-job-reports) for details. - Parameter: **REPORT_GITHUB_TOKEN** - The hidden or encrypted environment variable containing the GitHub personal access token. - Parameter: **repositoryURL** - The .git URL of the repository to publish the report to. This URL can be found by clicking the "Clone or download" button on the home page of the repository. The repository must already exist. - Parameter: **reportBranch** - The branch to publish the report to. The branch must already exist. @@ -198,7 +198,7 @@ Add the report to a repository. See the [instructions for publishing job reports - Parameter: **doLinkComment** - `true` or `false` Whether to comment on the GitHub thread of the commit that triggered the build with a link to the report. ##### `publish_report_to_gist REPORT_GITHUB_TOKEN REPORT_GIST_URL doLinkComment` -Add the report to the report gist. See the [instructions for publishing job reports](publishing-job-reports) for details. +Add the report to the report gist. See the [instructions for publishing job reports](#publishing-job-reports) for details. - Parameter: **REPORT_GITHUB_TOKEN** - The hidden or encrypted environment variable containing the GitHub personal access token. - Parameter: **REPORT_GIST_URL** - The URL of the report gist. - Parameter: **doLinkComment** - `true` or `false` Whether to comment on the GitHub thread of the commit that triggered the build with a link to the report. @@ -243,8 +243,8 @@ The Arduino IDE will usually try to start the GUI whenever there is an error in ##### Verbose output Verbose output results in a harder to read log so you should leave it off or minimized when possible but it can be useful for troubleshooting. Note that turning on verbose output for a large build may cause the log to exceed 4 MB, which causes Travis CI to terminate the job. -- Verbose script output - See [`set_script_verbosity` documentation](set_script_verbosity-script_verbosity_level) in the Usage section. -- Verbose output during compilation - See [`set_verbose_output_during_compilation` documentation](set_verbose_output_during_compilation-verboseoutputduringcompilation) in the Usage section. +- Verbose script output - See [`set_script_verbosity` documentation](#set_script_verbosity-script_verbosity_level) in the Usage section. +- Verbose output during compilation - See [`set_verbose_output_during_compilation` documentation](#set_verbose_output_during_compilation-verboseoutputduringcompilation) in the Usage section. - Verbose output for Travis CI - Add one or both of the following lines to your `.travis.yml` file to get more details of the Travis CI build process. - Print shell input lines as they are read: - `- set -o verbose` diff --git a/arduino-ci-script.sh b/arduino-ci-script.sh index 36905cd..d96e545 100644 --- a/arduino-ci-script.sh +++ b/arduino-ci-script.sh @@ -195,7 +195,7 @@ function install_ide() { return_handler "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS" fi - # Generate an array declaration string containing a list all Arduino IDE versions which support CLI (1.5.2+ according to https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc#history) + # Generate an array declaration string containing a list all available Arduino IDE versions which support CLI # Save the current folder local -r previousFolder="$PWD" cd "$ARDUINO_CI_SCRIPT_TEMPORARY_FOLDER" @@ -204,13 +204,27 @@ function install_ide() { cd Arduino git remote add origin https://github.com/arduino/Arduino.git if [[ "$startIDEversion" != "1.6.2" ]] && [[ "$startIDEversion" != "1.6.2" ]]; then - # Arduino IDE 1.6.2 has the nasty behavior of moving the included hardware cores to the .arduino15 folder, causing those versions to be used for all builds after Arduino IDE 1.6.2 is used. For that reason, 1.6.2 will only be installed if explicitly specified in the install_ide version arguments + # See "Arduino IDE version blocklist" documentation below local -r IDEversion162regex=--regex='refs/tags/1\.6\.2' if [[ "$ARDUINO_CI_SCRIPT_VERBOSITY_LEVEL" -gt 0 ]]; then echo "NOTE: Due to not playing nicely with other versions, Arduino IDE 1.6.2 will not be installed unless explicitly specified in the version arguments." fi fi - local -r ARDUINO_CI_SCRIPT_FULL_IDE_VERSION_LIST_ARRAY="${ARDUINO_CI_SCRIPT_IDE_VERSION_LIST_ARRAY_DECLARATION}'(\"$(git ls-remote --quiet --tags --refs | grep --invert-match --regexp='refs/tags/1\.0' --regexp='refs/tags/1\.5$' --regexp='refs/tags/1\.5\.1$' --regexp='refs/tags/1\.5\.4-r2$' --regexp='refs/tags/1\.5\.5-r2$' --regexp='refs/tags/1\.5\.7-macosx-java7$' --regexp='refs/tags/1\.5\.8-macosx-java7$' ${IDEversion162regex} --regexp='refs/tags/1\.6\.5-r2$' --regexp='refs/tags/1\.6\.5-r3$' | grep --regexp='refs/tags/[0-9]\+\.[0-9]\+\.[0-9]\+\(\(-.*$\)\|$\)' | cut --delimiter='/' --fields=3 | sort --version-sort | sed ':a;N;$!ba;s/\n/\" \"/g')\")'" + + # Arduino IDE tag blocklist: + # <1.5.2: no CLI (https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc#history) + # 1.5.4-r2: Not available for download + # 1.5.5-r2: Not available for download + # 1.5.7-macosx-java7: Not available for download + # 1.5.8-macosx-java7: Not available for download + # 1.6.2: has the nasty behavior of moving the included hardware cores to the .arduino15 folder, causing those versions to be used for all builds after Arduino IDE 1.6.2 is used. For that reason, 1.6.2 will only be installed if explicitly specified in the install_ide version arguments + # 1.6.5-r2: Not available for download + # 1.6.5-r3: Not available for download + # 1.6.5-r2: Not available for download + # 1.6.5-r3: Not available for download + # 1.8.11-ms-store-1: Not available for download + # 1.8.13-ms-store-1: Not available for download + local -r ARDUINO_CI_SCRIPT_FULL_IDE_VERSION_LIST_ARRAY="${ARDUINO_CI_SCRIPT_IDE_VERSION_LIST_ARRAY_DECLARATION}'(\"$(git ls-remote --quiet --tags --refs | grep --invert-match --regexp='refs/tags/1\.0' --regexp='refs/tags/1\.5$' --regexp='refs/tags/1\.5\.1$' --regexp='refs/tags/1\.5\.4-r2$' --regexp='refs/tags/1\.5\.5-r2$' --regexp='refs/tags/1\.5\.7-macosx-java7$' --regexp='refs/tags/1\.5\.8-macosx-java7$' ${IDEversion162regex} --regexp='refs/tags/1\.6\.5-r2$' --regexp='refs/tags/1\.6\.5-r3$' --regexp='refs/tags/.*-ms-store.*$' | grep --regexp='refs/tags/[0-9]\+\.[0-9]\+\.[0-9]\+\(\(-.*$\)\|$\)' | cut --delimiter='/' --fields=3 | sort --version-sort | sed ':a;N;$!ba;s/\n/\" \"/g')\")'" cd .. # Remove the temporary repo rm Arduino --recursive --force @@ -1237,43 +1251,51 @@ ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER=$((ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER + readonly ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_INVALID_CHARACTER_EXIT_STATUS=$ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER=$((ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER + 1)) readonly ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_TOO_LONG_EXIT_STATUS=$ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER +readonly ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_LAST_EXIT_STATUS=$ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER # The same folder name restrictions apply to libraries and sketches so this function may be used for both -function check_folder_name() { - local -r path="$1" - # Get the folder name from the path - local -r folderName="${path##*/}" +function check_name() { + local -r name="$1" local exitStatus=$ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS # Starting folder name with a number is only supported by Arduino IDE 1.8.4 and newer local -r startsWithNumberRegex="^[0-9]" - if [[ "$folderName" =~ $startsWithNumberRegex ]]; then - echo "WARNING: Discouraged folder name: ${folderName}. Folder name beginning with a number is only supported by Arduino IDE 1.8.4 and newer." + if [[ "$name" =~ $startsWithNumberRegex ]]; then + echo "WARNING: Discouraged folder name: ${name}. Folder name beginning with a number is only supported by Arduino IDE 1.8.4 and newer." fi # Starting folder name with a - or . is not allowed local -r startsWithInvalidCharacterRegex="^[-.]" - if [[ "$folderName" =~ $startsWithInvalidCharacterRegex ]]; then - echo "Invalid folder name: ${folderName}. Folder name beginning with a - or . is not allowed." + if [[ "$name" =~ $startsWithInvalidCharacterRegex ]]; then + echo "Invalid folder name: ${name}. Folder name beginning with a - or . is not allowed." exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_INVALID_FIRST_CHARACTER_EXIT_STATUS) fi # Allowed characters: a-z, A-Z, 0-1, -._ local -r disallowedCharactersRegex="[^a-zA-Z0-9._-]" - if [[ "$folderName" =~ $disallowedCharactersRegex ]]; then - echo "Invalid folder name: ${folderName}. Only letters, numbers, dots, dashes, and underscores are allowed." + if [[ "$name" =~ $disallowedCharactersRegex ]]; then + echo "Invalid folder name: ${name}. Only letters, numbers, dots, dashes, and underscores are allowed." exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_INVALID_CHARACTER_EXIT_STATUS) fi # <64 characters - if [[ ${#folderName} -gt 63 ]]; then - echo "Folder name $folderName exceeds the maximum of 63 characters." + if [[ ${#name} -gt 63 ]]; then + echo "Folder name $name exceeds the maximum of 63 characters." exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_TOO_LONG_EXIT_STATUS) fi return "$exitStatus" } -ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER=1 +function check_folder_name() { + local -r path="$1" + # Get the folder name from the path + local -r folderName="${path##*/}" + + check_name "$folderName" + return "$?" +} + +ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER=$((ARDUINO_CI_SCRIPT_CHECK_FOLDER_NAME_LAST_EXIT_STATUS + 1)) readonly ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS=$ARDUINO_CI_SCRIPT_EXIT_STATUS_COUNTER function check_library_properties_name() { local -r name="$1" @@ -1288,6 +1310,13 @@ function check_library_properties_name() { if [[ "${name,,}" =~ $ReservedNameRegex ]] && ! [[ "$name" =~ $GrandfatheredNameRegex ]]; then exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS) fi + + # Library Manager installs libraries to a folder that is the name field value with any spaces replaced with _ + local -r libraryManagerFolderName="${name// /_}" + + check_name "$libraryManagerFolderName" + exitStatus=$(set_exit_status "$exitStatus" $?) + return "$exitStatus" } @@ -1750,19 +1779,14 @@ function check_library_properties() { exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_BLANK_NAME_EXIT_STATUS) else # Check for invalid name value - # Library Manager installs libraries to a folder that is the name field value with any spaces replaced with _ - local libraryManagerFolderName="${nameValue// /_}" - check_folder_name "$libraryManagerFolderName" - local checkFolderNameExitStatus=$? - if [[ $checkFolderNameExitStatus -ne $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS ]]; then - echo "WARNING: ${normalizedLibraryPropertiesPath}/library.properties: name value: $nameValue does not meet the requirements of the Arduino Library Manager indexer. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format" - fi - - # Check if the library.properties name value starts with "arduino" (case-insensitive) check_library_properties_name "$nameValue" local checkLibraryPropertiesNameExitStatus=$? - if [[ "$checkLibraryPropertiesNameExitStatus" == "$ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS" ]]; then - echo "WARNING: ${normalizedLibraryPropertiesPath}/library.properties: name value: $nameValue starts with \"arduino\". These names are reserved for official Arduino libraries. Libraries using a reserved name will not be accepted in the Library Manager index." + if [[ $checkLibraryPropertiesNameExitStatus -ne $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS ]]; then + if [[ "$checkLibraryPropertiesNameExitStatus" == "$ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS" ]]; then + echo "WARNING: ${normalizedLibraryPropertiesPath}/library.properties: name value: $nameValue starts with \"arduino\". These names are reserved for official Arduino libraries. Libraries using a reserved name will not be accepted in the Library Manager index." + else + echo "WARNING: ${normalizedLibraryPropertiesPath}/library.properties: name value: $nameValue does not meet the requirements of the Arduino Library Manager indexer. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format" + fi fi fi fi @@ -2368,22 +2392,17 @@ function check_library_manager_compliance() { local nameValue nameValue="$(get_library_properties_field_value "$libraryProperties" 'name')" - # Check for characters in the library.properties name value disallowed by the Library Manager indexer - # Library Manager installs libraries to a folder that is the name field value with any spaces replaced with _ - local -r libraryManagerFolderName="${nameValue// /_}" - check_folder_name "$libraryManagerFolderName" - local -r checkFolderNameExitStatus=$? - if [[ $checkFolderNameExitStatus -ne $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS ]]; then - echo "ERROR: ${normalizedLibraryPath}/library.properties: name value: $nameValue does not meet the requirements of the Arduino Library Manager indexer. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format" - exitStatus=$(set_exit_status "$exitStatus" $((ARDUINO_CI_SCRIPT_CHECK_LIBRARY_MANAGER_COMPLIANCE_CHECK_FOLDER_NAME_OFFSET + checkFolderNameExitStatus))) - fi - - # Check if the library.properties name value starts with "arduino" (case-insensitive) + # Check if the library.properties name value meets the requirements of the Library Manager indexer check_library_properties_name "$nameValue" - local checkLibraryPropertiesNameExitStatus=$? - if [[ "$checkLibraryPropertiesNameExitStatus" == "$ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS" ]]; then - echo "ERROR: ${normalizedLibraryPath}/library.properties: name value: $nameValue starts with \"arduino\". These names are reserved for official Arduino libraries." - exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_MANAGER_COMPLIANCE_NAME_IS_RESERVED_EXIT_STATUS) + local -r checkLibraryPropertiesNameExitStatus=$? + if [[ $checkLibraryPropertiesNameExitStatus -ne $ARDUINO_CI_SCRIPT_SUCCESS_EXIT_STATUS ]]; then + if [[ "$checkLibraryPropertiesNameExitStatus" == "$ARDUINO_CI_SCRIPT_CHECK_LIBRARY_PROPERTIES_NAME_RESERVED_NAME_EXIT_STATUS" ]]; then + echo "ERROR: ${normalizedLibraryPath}/library.properties: name value: $nameValue starts with \"arduino\". These names are reserved for official Arduino libraries." + exitStatus=$(set_exit_status "$exitStatus" $ARDUINO_CI_SCRIPT_CHECK_LIBRARY_MANAGER_COMPLIANCE_NAME_IS_RESERVED_EXIT_STATUS) + else + echo "ERROR: ${normalizedLibraryPath}/library.properties: name value: $nameValue does not meet the requirements of the Arduino Library Manager indexer. See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format" + exitStatus=$(set_exit_status "$exitStatus" $((ARDUINO_CI_SCRIPT_CHECK_LIBRARY_MANAGER_COMPLIANCE_CHECK_FOLDER_NAME_OFFSET + checkLibraryPropertiesNameExitStatus))) + fi fi local urlValue @@ -2439,7 +2458,7 @@ function check_code_formatting() { # Install astyle # Save the current folder local -r previousFolder="$PWD" - mkdir "${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER}/astyle" + mkdir --parents "${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER}/astyle" wget --no-verbose $ARDUINO_CI_SCRIPT_QUIET_OPTION --output-document="${ARDUINO_CI_SCRIPT_TEMPORARY_FOLDER}/astyle.tar.gz" "https://iweb.dl.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz" tar --extract --file="${ARDUINO_CI_SCRIPT_TEMPORARY_FOLDER}/astyle.tar.gz" --directory="${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER}" cd "${ARDUINO_CI_SCRIPT_APPLICATION_FOLDER}/astyle/build/gcc" diff --git a/etc/codespell-ignore-words-list.txt b/etc/codespell-ignore-words-list.txt index 0e2decd..c74fb04 100644 --- a/etc/codespell-ignore-words-list.txt +++ b/etc/codespell-ignore-words-list.txt @@ -1,3 +1,4 @@ ba propert te +exampels