Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a GitHub Action to run automated tests #200

Closed
wants to merge 19 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -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
58 changes: 58 additions & 0 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo: false
language: ruby

os:
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion SampleProjects/NetworkLib/scripts/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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