Skip to content

Commit

Permalink
Merge pull request #42 from per1234/travis-ci
Browse files Browse the repository at this point in the history
Use Travis CI for automated testing
  • Loading branch information
MCUdude authored May 13, 2017
2 parents 33eb4da + 039be8e commit f569fdb
Show file tree
Hide file tree
Showing 10 changed files with 1,772 additions and 0 deletions.
425 changes: 425 additions & 0 deletions .travis.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,6 @@ Here's some simple schematics for the ATmega64/128/1281/2561 and ATmega640/1280/
<b>Click to enlarge:</b> <br/>
<img src="http://i.imgur.com/h9J6rxg.png" width="400"> <img src="http://i.imgur.com/gQS1ORv.png" width="400">


## Current Travis CI build result:
[![Build Status](https://travis-ci.org/MCUdude/MegaCore.svg?branch=avr-100-pin)](https://travis-ci.org/MCUdude/MegaCore)
149 changes: 149 additions & 0 deletions travis-ci/arduino-ci-script/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# This file is used to test the script with Travis CI

language: bash
sudo: required


env:
global:
# The Arduino IDE will be installed at APPLICATION_FOLDER/arduino
- APPLICATION_FOLDER="/usr/local/share"
- SKETCHBOOK_FOLDER="${HOME}/Arduino"

matrix:
# Test install_ide with no argument (using full version list). This would cause the Travis CI build to take much longer so I have it disabled
# - INSTALL_IDE_START_VERSION=""
# Test install_ide using full version list
- INSTALL_IDE_START_VERSION="all"
# Test install_ide using custom version list. Test the use of the special version names "oldest" and "newest" in a version list. Test use of "hourly" version name.
- INSTALL_IDE_START_VERSION='("oldest" "1.8.1" "newest" "hourly")'
# 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.
- INSTALL_IDE_START_VERSION="1.6.3"
# Test install_ide using version range. Test the use of the special version names "oldest" and "newest" in a version range.
- INSTALL_IDE_START_VERSION="oldest" INSTALL_IDE_END_VERSION="newest"


matrix:
allow_failures:
# The expected behavior is failure because 1.6.3 doesn't support boards manager installation.
- env: INSTALL_IDE_START_VERSION="1.6.3"


before_install:
- source "${TRAVIS_BUILD_DIR}/arduino-ci-script.sh"

- set_script_verbosity 0

- set_application_folder "$APPLICATION_FOLDER"
- set_sketchbook_folder "$SKETCHBOOK_FOLDER"

# Check for board definition errors that don't affect compilation
- set_board_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 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 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 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 whos 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 with rename. If the rename doesn't work then any job verifying with Arduino IDE 1.5.6 or older will hang because GitHub changes the folder name to MPU9250-master, which is not a valid folder name on those IDE versions.
- install_library "https://github.com/brianc118/MPU9250/archive/master.zip" "MPU9250"
# Test library install from git repo
- install_library "https://github.com/sfrwmaker/WirelessOregonV2.git"
# Test library install from git repo with rename
- install_library "https://github.com/mikaelpatel/Arduino-Shell.git" "ArduinoShell"
# Test library install from Library Manager
- install_library "Pushetta:1.0.1"
# Test set_verbose_output_during_compilation. Setting verbose output to false is not actually necessary but it tests the function.
- set_verbose_output_during_compilation "false"


script:
# Verify sketches:
# build_sketch arguments: sketch name, fqbn, IDE version, allow failure
# IDE version: Use "all" for IDE version argument to verify sketch with all versions of the Arduino IDE, use "newest" for IDE version argument to verify sketch with the newest version of the Arduino IDE

# Installed package tests:
# Test board from hardware package installed via Boards Manager without URL
# Test build_sketch with "newest" special version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "arduino:sam:arduino_due_x_dbg" "false" "newest"
# Test board from hardware package installed with Boards Manager URL
# Test build_sketch with specific IDE version
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "MiniCore:avr:328:variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external" "false" "1.8.1"
# Test board from hardware package manually installed from compressed file download
# Test build_sketch with an IDE version list
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "ATTinyCore-master:avr:attinyx5:LTO=disable,TimerClockSource=default,chip=85,clock=8internal,bod=disable" "false" '("1.8.1" "1.8.2")'
# Test board from hardware package manually installed by cloning Git repository
# Test build_sketch with an IDE version range
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "MightyCore:avr:1284:pinout=standard,variant=modelP,BOD=2v7,LTO=Os,clock=16MHz_external" "false" "1.8.1" "1.8.2"

# Installed library tests:
# Test build_sketch without absolute path
# Test library installed from .zip with rename
- cd "${SKETCHBOOK_FOLDER}/libraries/MPU9250/examples/MPU9250/"
- build_sketch "MPU9250.ino" "arduino:avr:uno" "false" "newest"
# Test library installed from .zip
# Test build_sketch with "all" IDE version name
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/NewPing/examples/NewPingExample/NewPingExample.pde" "arduino:avr:uno" "false" "all"
# Test library installed from .git
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/WirelessOregonV2/examples/OregonReceiver/OregonReceiver.ino" "arduino:avr:uno" "false" "newest"
# Test library installed from .git with rename
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/ArduinoShell/examples/ShellBlink/ShellBlink.ino" "arduino:avr:uno" "false" "newest"
# Test library installed from Library Manager
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/Pushetta/examples/simple_notification/simple_notification.ino" "arduino:avr:uno" "false" "newest"

# build_sketch with version argument tests
# 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 "oldest" IDE version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics/BareMinimum/BareMinimum.ino" "arduino:avr:uno" "false" "oldest"
# 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.1"
# Test build_sketch with folder argument with "oldest" IDE version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "oldest"
# Test build_sketch with folder argument with "newest" IDE version name
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "newest"
# 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 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 an IDE version list
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" '("1.8.1" "1.8.2")'
# Test build_sketch with folder argument with an IDE version range
- build_sketch "${APPLICATION_FOLDER}/arduino/examples/01.Basics" "arduino:avr:uno" "false" "1.8.1" "1.8.2"
# Test build_sketch with folder argument allowed to fail (this will fail because WirelessOregonV2 is AVR specific)
- build_sketch "${SKETCHBOOK_FOLDER}/libraries/WirelessOregonV2/examples" "arduino:sam:arduino_due_x_dbg" "true" "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_${TRAVIS_BUILD_NUMBER}" "true"

- display_report

- check_success


notifications:
email:
on_success: always
on_failure: always
24 changes: 24 additions & 0 deletions travis-ci/arduino-ci-script/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contribution Rules
Thanks for your interest in contributing to this free open source project! Please take the time to read and follow these rules before submitting an issue report or pull request.

## Issues
- Do you need help using this project? Support requests should be made to the appropriate section of the [Arduino forum](http://forum.arduino.cc) rather than an issue report. Feel free to [send me a PM](http://forum.arduino.cc/index.php?action=pm;sa=send;u=224903) with a link to your forum thread. **Support will not be provided via PM**, I prefer to help you publicly so that others with the same question may benefit from the information. **Issue reports are to be used to report bugs or make feature requests only.**
- Before submitting a bug report test using the [latest version of the project](https://github.com/per1234/arduino-ci-script/archive/master.zip) to be sure it hasn't already been fixed. **Don't report issues that only occur with old versions of the project.**
- Search [existing pull requests and issues](https://github.com/per1234/arduino-ci-script/issues?q=) to be sure it hasn't already been reported. **Do not submit duplicate issue reports.** If you have additional information to provide about the issue then please comment on that issue.
- Open an issue at https://github.com/per1234/arduino-ci-script/issues/new.
- Describe the issue and what behavior you were expecting. Post complete error messages using [markdown code fencing](https://guides.github.com/features/mastering-markdown/#examples).
- Provide a full set of steps necessary to reproduce the issue. Demonstration code should be complete, correct and simplified to the minimum amount of code necessary to reproduce the issue. Please use [markdown code fencing](https://guides.github.com/features/mastering-markdown/#examples) when posting code.
- Be responsive. I may need you to provide more information, please respond as soon as possible.
- If you find a solution to your problem update your issue report with an explanation of how you were able to fix it and close the issue.

## Pull Requests
- Search [existing pull requests and issues](https://github.com/per1234/arduino-ci-script/pulls?q=) to make sure the change hasn't already been proposed.
- Comment your code. The focus of Arduino is learning so it's best to be a bit more thorough about documenting code.
- Follow the formatting conventions used throughout the rest of the project. Remove all trailing whitespace.
- If appropriate, add or update tests in the [.travis.yml file](https://github.com/per1234/arduino-ci-script/blob/master/.travis.yml).
- Update the [documentation](https://github.com/per1234/arduino-ci-script/blob/master/README.md) if your changes require it. This should be done in the same commit as the change.
- **All commits must be atomic**. This means that the commit completely accomplishes a single task. Each commit should result in fully functional code. Multiple tasks should not be combined in a single commit. For more information please read http://www.freshconsulting.com/atomic-commits.
- Commit messages: Use the [imperative mood](http://chris.beams.io/posts/git-commit/#imperative) in the commit title. Completely explain the purpose of the commit. Please read http://chris.beams.io/posts/git-commit for more tips on writing good commit messages.
- Each pull request should address a single bug fix or enhancement, this may consist of multiple commits. If you have multiple, unrelated fixes or enhancements to contribute, then do each in a separate pull request.
- Open a pull request at https://github.com/per1234/arduino-ci-script/compare.
- If your pull request fixes an issue in the issue tracker, use the [closes/fixes/resolves syntax](https://help.github.com/articles/closing-issues-via-commit-messages) in the body to denote this.
1 change: 1 addition & 0 deletions travis-ci/arduino-ci-script/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Read the Issues section of the Contribution Rules at the "guidelines for contributing" link above before submitting an issue report.
22 changes: 22 additions & 0 deletions travis-ci/arduino-ci-script/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2017

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1 change: 1 addition & 0 deletions travis-ci/arduino-ci-script/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Read the Pull Requests section of the Contribution Rules at the "guidelines for contributing" link above before submitting a pull request.
Loading

0 comments on commit f569fdb

Please sign in to comment.