Skip to content

Creating a GitHub Action to run automated tests #200

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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 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
47 changes: 47 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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:
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
bundle exec rubocop --version
bundle exec rubocop -D .
bundle exec rspec --backtrace
cd SampleProjects/TestSomething
bundle install
bundle exec arduino_ci.rb

Network:
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 Network
- name: Build and Execute
run: |
g++ -v
bundle install
bundle exec rubocop --version
bundle exec rubocop -D .
bundle exec rspec --backtrace
cd SampleProjects/NetworkLib
./scripts/install.sh
bundle install
bundle exec arduino_ci.rb
47 changes: 47 additions & 0 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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:
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
bundle exec rubocop --version
bundle exec rubocop -D .
bundle exec rspec --backtrace
cd SampleProjects/TestSomething
bundle install
bundle exec arduino_ci.rb

Network:
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
bundle exec rubocop --version
bundle exec rubocop -D .
bundle exec rspec --backtrace
cd SampleProjects/NetworkLib
./scripts/install.sh
bundle install
bundle exec arduino_ci.rb
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Add `__AVR__` to defines when compiling
- `arduino_ci_remote.rb` CLI switch `--skip-examples-compilation`
- Add support for `diditalPinToPort()`, `digitalPinToBitMask()`, and `portOutputRegister()`
- `CppLibrary.header_files` to find header files
Expand All @@ -17,6 +18,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, Ubuntu, and MacOS)

### Changed
- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci
Expand Down
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=winows)
**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
Expand Down Expand Up @@ -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.
Expand Down
Empty file modified SampleProjects/NetworkLib/scripts/install.sh
100644 → 100755
Empty file.