Skip to content

Commit be8b108

Browse files
prestoncarmanianfixes
authored andcommitted
Creating a GitHub Action to run automated tests (squashed)
1 parent 62d29f5 commit be8b108

File tree

5 files changed

+146
-6
lines changed

5 files changed

+146
-6
lines changed

.github/workflows/linux.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This is the name of the workflow, visible on GitHub UI
2+
name: linux
3+
4+
# Run on a Push or a Pull Request
5+
on: [push, pull_request]
6+
7+
jobs:
8+
rubocop:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
16+
# Install and run Arduino CI tests for rubocop
17+
- name: Build and Execute
18+
run: |
19+
g++ -v
20+
bundle install
21+
bundle exec rubocop --version
22+
bundle exec rubocop -D .
23+
bundle exec rspec --backtrace
24+
25+
TestSomething:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 2.6
32+
33+
# Install and run Arduino CI tests for TestSomething
34+
- name: Build and Execute
35+
run: |
36+
g++ -v
37+
bundle install
38+
cd SampleProjects/TestSomething
39+
bundle install
40+
bundle exec arduino_ci.rb
41+
42+
NetworkLib:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: 2.6
49+
50+
# Install and run Arduino CI tests for NetworkLib
51+
- name: Build and Execute
52+
run: |
53+
g++ -v
54+
bundle install
55+
cd SampleProjects/NetworkLib
56+
./scripts/install.sh
57+
bundle install
58+
bundle exec arduino_ci.rb

.github/workflows/windows.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This is the name of the workflow, visible on GitHub UI
2+
name: windows
3+
4+
# Run on a Push or a Pull Request
5+
on: [push, pull_request]
6+
7+
jobs:
8+
rubocop:
9+
runs-on: windows-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
16+
# Install and run Arduino CI tests for rubocop
17+
- name: Build and Execute
18+
run: |
19+
g++ -v
20+
bundle install
21+
bundle exec rubocop --version
22+
bundle exec rubocop -D .
23+
bundle exec rspec --backtrace
24+
25+
TestSomething:
26+
runs-on: windows-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 2.6
32+
33+
# Install and run Arduino CI tests for TestSomething
34+
- name: Build and Execute
35+
run: |
36+
g++ -v
37+
bundle install
38+
cd SampleProjects/TestSomething
39+
bundle install
40+
bundle exec arduino_ci.rb
41+
42+
NetworkLib:
43+
runs-on: windows-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: 2.6
49+
50+
# Install and run Arduino CI tests for Network
51+
- name: Build and Execute
52+
run: |
53+
g++ -v
54+
bundle install
55+
cd SampleProjects/NetworkLib
56+
bash -x ./scripts/install.sh
57+
bundle install
58+
bundle exec arduino_ci.rb

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
- Explicit check and warning for library directory names that do not match our guess of what the library should/would be called
1414
- Symlink tests for `Host`
1515
- GitHub action for MacOS
16+
- Add documentation on how to use Arduino CI with GitHub Actions
17+
- Allow tests to run on GitHub without external set up with GitHub Actions (for Windows and Ubuntu)
1618

1719
### Changed
1820
- Arduino backend is now `arduino-cli` version `0.13.0`

README.md

+27-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ You want your Arduino library to be automatically built and tested every time so
1212

1313
`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`.
1414

15-
Platform | CI Status
16-
---------|:---------
17-
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)
18-
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)
19-
Windows | [![Windows Build status](https://ci.appveyor.com/api/projects/status/abynv8xd75m26qo9/branch/master?svg=true)](https://ci.appveyor.com/project/ianfixes/arduino-ci)
15+
  | Linux | macOS | Windows
16+
-------------------|:------|:------|:--------
17+
**AppVeyor** | | | [![Windows Build status](https://ci.appveyor.com/api/projects/status/abynv8xd75m26qo9/branch/master?svg=true)](https://ci.appveyor.com/project/ianfixes/arduino-ci)
18+
**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)
19+
**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) |
2020

2121

2222
## Comparison to Other Arduino Testing Tools
@@ -158,6 +158,28 @@ test_script:
158158
- bundle exec arduino_ci.rb
159159
```
160160

161+
#### GitHub Actions
162+
163+
GitHub Actions allows you to automate your workflows directly in GitHub.
164+
No additional steps are needed.
165+
Just create a YAML file with the information below in your repo under the `.github/workflows/` directory.
166+
167+
```yaml
168+
on: [push, pull_request]
169+
jobs:
170+
runTest:
171+
runs-on: ubuntu-latest
172+
steps:
173+
- uses: actions/checkout@v2
174+
- uses: ruby/setup-ruby@v1
175+
with:
176+
ruby-version: 2.6
177+
- run: |
178+
bundle install
179+
bundle exec arduino_ci_remote.rb
180+
```
181+
182+
161183
## Known Problems
162184

163185
* The Arduino library is not fully mocked.

SampleProjects/NetworkLib/scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# then get the custom one we want to use for testing
55
cd $(bundle exec arduino_library_location.rb)
66
if [ ! -d ./Ethernet ] ; then
7-
git clone https://github.com/Arduino-CI/Ethernet.git
7+
git clone --depth 1 https://github.com/Arduino-CI/Ethernet.git
88
fi

0 commit comments

Comments
 (0)