diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml new file mode 100644 index 00000000..15d7bf83 --- /dev/null +++ b/.github/workflows/linux.yaml @@ -0,0 +1,58 @@ +# This is the name of the workflow, visible on GitHub UI +name: linux + +# Run on a Push or a Pull Request +on: [push, pull_request] + +jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for rubocop + - name: Build and Execute + run: | + g++ -v + bundle install + bundle exec rubocop --version + bundle exec rubocop -D . + bundle exec rspec --backtrace + + TestSomething: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for TestSomething + - name: Build and Execute + run: | + g++ -v + bundle install + cd SampleProjects/TestSomething + bundle install + bundle exec arduino_ci.rb + + NetworkLib: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for NetworkLib + - name: Build and Execute + run: | + g++ -v + bundle install + cd SampleProjects/NetworkLib + ./scripts/install.sh + bundle install + bundle exec arduino_ci.rb diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 00000000..5eb4410a --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,58 @@ +# This is the name of the workflow, visible on GitHub UI +name: windows + +# Run on a Push or a Pull Request +on: [push, pull_request] + +jobs: + rubocop: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for rubocop + - name: Build and Execute + run: | + g++ -v + bundle install + bundle exec rubocop --version + bundle exec rubocop -D . + bundle exec rspec --backtrace + + TestSomething: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for TestSomething + - name: Build and Execute + run: | + g++ -v + bundle install + cd SampleProjects/TestSomething + bundle install + bundle exec arduino_ci.rb + + NetworkLib: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + + # Install and run Arduino CI tests for Network + - name: Build and Execute + run: | + g++ -v + bundle install + cd SampleProjects/NetworkLib + bash -x ./scripts/install.sh + bundle install + bundle exec arduino_ci.rb diff --git a/.travis.yml b/.travis.yml index 36067457..3fd5c346 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false language: ruby os: diff --git a/CHANGELOG.md b/CHANGELOG.md index 563fc6fa..58a94808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Definitions for Arduino zero - Support for mock EEPROM (but only if board supports it) - Add stubs for `Client.h`, `IPAddress.h`, `Printable.h`, `Server.h`, and `Udp.h` +- Add documentation on how to use Arduino CI with GitHub Actions +- Allow tests to run on GitHub without external set up with GitHub Actions (for Windows and Ubuntu) ### Changed - Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci diff --git a/README.md b/README.md index 34bba2a4..9a53dc22 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ You want your Arduino library to be automatically built and tested every time so `arduino_ci` is a cross-platform build/test system, consisting of a Ruby gem and a series of C++ mocks. It enables tests to be run both locally and as part of a CI service like Travis or Appveyor. Any OS that can run the Arduino IDE can run `arduino_ci`. -Platform | CI Status ----------|:--------- -OSX | [![OSX Build Status](http://badges.herokuapp.com/travis/Arduino-CI/arduino_ci?env=BADGE=osx&label=build&branch=master)](https://travis-ci.org/Arduino-CI/arduino_ci) -Linux | [![Linux Build Status](http://badges.herokuapp.com/travis/Arduino-CI/arduino_ci?env=BADGE=linux&label=build&branch=master)](https://travis-ci.org/Arduino-CI/arduino_ci) -Windows | [![Windows Build status](https://ci.appveyor.com/api/projects/status/abynv8xd75m26qo9/branch/master?svg=true)](https://ci.appveyor.com/project/ianfixes/arduino-ci) +   | Linux | macOS | Windows +-------------------|:------|:------|:-------- +**AppVeyor** | | | [![Windows Build status](https://ci.appveyor.com/api/projects/status/abynv8xd75m26qo9/branch/master?svg=true)](https://ci.appveyor.com/project/ianfixes/arduino-ci) +**GitHub Actions** | [![Arduino CI](https://github.com/Arduino-CI/arduino_ci/workflows/linux/badge.svg)](https://github.com/Arduino-CI/arduino_ci/actions?workflow=linux) | | [![Arduino CI](https://github.com/Arduino-CI/arduino_ci/workflows/windows/badge.svg)](https://github.com/Arduino-CI/arduino_ci/actions?workflow=windows) +**Travis CI** | [![Linux Build Status](http://badges.herokuapp.com/travis/Arduino-CI/arduino_ci?env=BADGE=linux&label=build&branch=master)](https://travis-ci.org/Arduino-CI/arduino_ci) | [![OSX Build Status](http://badges.herokuapp.com/travis/Arduino-CI/arduino_ci?env=BADGE=osx&label=build&branch=master)](https://travis-ci.org/Arduino-CI/arduino_ci) | ## Comparison to Other Arduino Testing Tools @@ -155,6 +155,28 @@ test_script: - bundle exec arduino_ci.rb ``` +#### GitHub Actions + +GitHub Actions allows you to automate your workflows directly in GitHub. +No additional steps are needed. +Just create a YAML file with the information below in your repo under the `.github/workflows/` directory. + +```yaml +on: [push, pull_request] +jobs: + runTest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - run: | + bundle install + bundle exec arduino_ci_remote.rb +``` + + ## Known Problems * The Arduino library is not fully mocked. diff --git a/SampleProjects/NetworkLib/scripts/install.sh b/SampleProjects/NetworkLib/scripts/install.sh old mode 100644 new mode 100755 index b4e2dd40..54b8d4e0 --- a/SampleProjects/NetworkLib/scripts/install.sh +++ b/SampleProjects/NetworkLib/scripts/install.sh @@ -4,5 +4,5 @@ # then get the custom one we want to use for testing cd $(bundle exec arduino_library_location.rb) if [ ! -d ./Ethernet ] ; then - git clone https://github.com/Arduino-CI/Ethernet.git + git clone --depth 1 https://github.com/Arduino-CI/Ethernet.git fi