You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
11
11
- Better indications of which example sketch is being compiled as part of testing
12
12
13
13
### Changed
14
+
- Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README.
Copy file name to clipboardExpand all lines: README.md
+73-54
Original file line number
Diff line number
Diff line change
@@ -29,69 +29,91 @@ Windows | [.
34
+
*`ruby` 2.5 or higher
35
+
* A compiler like `g++` (on OSX, `clang` works; on Cygwin, use the `mingw-gcc-c++` package)
36
+
*`python` (if using a board architecutre that requires it, e.g. ESP32, ESP8266; see [this issue](https://github.com/Arduino-CI/arduino_ci/issues/235#issuecomment-739629243)). Consider `pyserial` as well.
37
+
38
+
In that environment, you can install by running `gem install arduino_ci`. To update to a latest version, use `gem update arduino_ci`.
39
+
40
+
You can now test your library by simply running the command `arduino_ci.rb` from your library directory. This will perform the following:
35
41
36
-
> Note: The `SampleProjects` directory you see within _this_ repo contains tests for validing the `arduino_ci` framework itself, and due to that coupling will not be helpful to duplicate. That said, the [SampleProjects/TestSomething](SampleProjects/TestSomething) project contains [test files](SampleProjects/TestSomething/test/) (each named after the type of feature being tested) that may be illustrative of testing strategy and capabilities _on an individual basis_.
42
+
* validation of some fields in `library.properties`, if it exists
43
+
* running unit tests from files found in `test/`, if they exist
44
+
* testing compilation of example sketches found in `examples/`, if they exist
45
+
46
+
### Assumptions About Your Repository
37
47
38
48
Arduino expects all libraries to be in a specific `Arduino/libraries` directory on your system. If your library is elsewhere, `arduino_ci` will _automatically_ create a symbolic link in the `libraries` directory that points to the directory of the project being tested. This simplifieds working with project dependencies, but **it can have unintended consequences on Windows systems**.
39
49
40
50
> If you use a Windows system **it is recommended that you only run `arduino_ci` from project directories that are already inside the `libraries` directory** because [in some cases deleting a folder that contains a symbolic link to another folder can cause the _entire linked folder_ to be removed instead of just the link itself](https://superuser.com/a/306618).
41
51
52
+
### Changes to Your Repository
42
53
43
-
### You Need Ruby and Bundler
44
-
45
-
You'll need Ruby version 2.5 or higher, and to `gem install bundler` if it's not already there.
54
+
Unit testing binaries created by `arduino_ci` should not be commited to the codebase. To avoid that, add the following to your `.gitignore`:
46
55
56
+
```ignore-list
57
+
# arduino_ci unit test binaries and artifacts
58
+
*.bin
59
+
*.bin.dSYM
60
+
```
47
61
48
-
### You Need A Compiler (`g++`)
62
+
### A Quick Example
49
63
50
-
For unit testing, you will need a compiler; [g++](https://gcc.gnu.org/) is preferred.
64
+
For a fairly minimal practical example of a unit-testable library repo that you can copy from, see [the `Arduino-CI/Blink` repository](https://github.com/Arduino-CI/Blink).
51
65
52
-
***Linux**: `gcc`/`g++` is likely pre-installed.
53
-
***OSX**: `g++` is an alias for `clang`, which is provided by Xcode and the developer tools. You are free to `brew install gcc` as well; this is also tested and working.
54
-
***Windows**: you will need Cygwin, and the `mingw-gcc-g++` package.
55
66
67
+
## Advanced Start
56
68
57
-
### You _May_ Need `python`
69
+
New features and bugfixes reach GitHub before they reach a released ruby gem. Alternately, it may be that (for your own reasons) you do not wish to install `arduino_ci` globally on your system. A few additional setup steps are required if you wish to do this.
58
70
59
-
ESP32 and ESP8266 boards have [a dependency on `python` that they don't install themselves](https://github.com/Arduino-CI/arduino_ci/issues/235#issuecomment-739629243). If you intend to test on these platforms (which are included in the default list of platforms to test against), you will need to make `python` (and possibly `pyserial`) available in the test environment.
71
+
### You Need Ruby _and_ Bundler
60
72
61
-
Alternately, you might configure `arduino_ci` to simply not test against these. Consult the reference for those details.
73
+
In addition to version 2.5 or higher, you'll also need to `gem install bundler` to a minimum of version 2.0 if it's not already there. You may find it easiest to do this by using [`rbenv`](https://github.com/rbenv/rbenv).
62
74
75
+
You will need to add a file called `Gemfile` (no extension) to your Arduino project.
63
76
64
-
###Changes to Your Repo
77
+
#### Non-root installation
65
78
66
-
Add a file called `Gemfile` (no extension) to your Arduino project:
79
+
If you are simply trying to avoid the need to install `arduino_ci` system-wide (which may require administrator permissions), your `Gemfile` would look like this:
67
80
68
81
```ruby
69
82
source 'https://rubygems.org'
70
-
gem 'arduino_ci', '~> 1.1'
83
+
84
+
# Replace 1.2 with the desired version of arduino_ci. See https://guides.rubygems.org/patterns/#pessimistic-version-constraint
85
+
gem 'arduino_ci', '~> 1.2'
71
86
```
72
87
73
-
At the time of this writing, `1.1` is the latest version available, and the `~>` syntax will allow your system to update it to the latest `1.x.x` version. The list of all available versions can be found on [rubygems.org](https://rubygems.org/gems/arduino_ci) if you prefer to explicitly pin a higher version.
88
+
It would also make sense to add the following to your `.gitignore`:
89
+
```ignore-list
90
+
/.bundle/
91
+
vendor
92
+
```
93
+
94
+
> Note: this used to be the recommended installation method, but with the library's maturation it's better to avoid the use of `Gemfile` and `bundle install` by just installing as per the "Quick Start" instructions above.
95
+
74
96
75
-
It would also make sense to add the following to your `.gitignore`, or copy [the `.gitignore` used by this project](.gitignore):
97
+
#### Using the latest-available code
98
+
99
+
If you want to use the latest code on GitHub, your `Gemfile` would look like this:
100
+
101
+
```ruby
102
+
source 'https://rubygems.org'
76
103
104
+
# to use the latest github code in a given repo and branch, replace the below values for git: and ref: as needed
105
+
gem 'arduino_ci', git:'https://github.com/ArduinoCI/arduino_ci.git', ref:'<your desired ref, branch, or tag>'
77
106
```
78
-
/.bundle/
79
-
/.yardoc
80
-
Gemfile.lock
81
-
/_yardoc/
82
-
/coverage/
83
-
/doc/
84
-
/pkg/
85
-
/spec/reports/
86
-
vendor
87
-
*.gem
88
107
89
-
# rspec failure tracking
90
-
.rspec_status
91
108
92
-
# C++ stuff
93
-
*.bin
94
-
*.bin.dSYM
109
+
#### Using a version of `arduino_ci` source code on your local machine
110
+
111
+
First, Thanks! See [CONTRIBUTING.md](CONTRIBUTING.md). Your `Gemfile` would look like this:
@@ -103,17 +125,18 @@ $ bundle install # adds packages to global library (may require admin rights)
103
125
$ bundle install --path vendor/bundle # adds packages to local library
104
126
```
105
127
128
+
This will create a `Gemfile.lock` in your project directory, which you may optionally check into source control. A broader introduction to ruby dependencies is outside the scope of this document.
106
129
107
-
### Running tests
130
+
131
+
132
+
### Running `arduino_ci.rb` To Test Your Library
108
133
109
134
With that installed, just the following shell command each time you want the tests to execute:
110
135
111
-
```
136
+
```console
112
137
$ bundle exec arduino_ci.rb
113
138
```
114
139
115
-
`arduino_ci.rb` is the main entry point for this library. This command will iterate over all the library's `examples/` and attempt to compile them. If you set up unit tests, it will run those as well.
116
-
117
140
118
141
### Reference
119
142
@@ -128,18 +151,14 @@ For more information on the usage of `arduino_ci.rb`, see [REFERENCE.md](REFEREN
128
151
129
152
## Setting up Pull Request Testing and/or External CI
130
153
131
-
The following prerequisites must be fulfilled:
132
-
133
-
* A GitHub (or other repository-hosting) project for your library
134
-
* A CI system like [Travis CI](https://travis-ci.org/) or [Appveyor](https://www.appveyor.com/) that is linked to your project
135
-
154
+
> **Note:**`arduino_ci.rb` expects to be run from the root directory of your Arduino project library.
136
155
137
-
### Testing with remote CI
156
+
### Arduino CI's Own GitHub action
138
157
139
-
> **Note:**`arduino_ci.rb` expects to be run from the root directory of your Arduino project library.
GitHub Actions allows you to automate your workflows directly in GitHub.
145
164
No additional steps are needed.
@@ -156,12 +175,12 @@ jobs:
156
175
with:
157
176
ruby-version: 2.6
158
177
- run: |
159
-
bundle install
160
-
bundle exec arduino_ci_remote.rb
178
+
gem install arduino_ci
179
+
arduino_ci.rb
161
180
```
162
181
163
182
164
-
#### Travis CI
183
+
### Travis CI
165
184
166
185
You'll need to go to https://travis-ci.org/profile/ and enable testing for your Arduino project. Once that happens, you should be all set. The script will test all example projects of the library and all unit tests.
167
186
@@ -171,12 +190,12 @@ Next, you need this in `.travis.yml` in your repo
171
190
sudo: false
172
191
language: ruby
173
192
script:
174
-
- bundle install
175
-
- bundle exec arduino_ci.rb
193
+
- gem install arduino_ci
194
+
- arduino_ci.rb
176
195
```
177
196
178
197
179
-
#### Appveyor CI
198
+
### Appveyor CI
180
199
181
200
You'll need to go to https://ci.appveyor.com/projects and add your project.
182
201
@@ -185,8 +204,8 @@ Next, you'll need this in `appveyor.yml` in your repo.
This directory contains projects that are intended solely for testing the various features of this gem -- to test the testing framework itself. The RSpec tests refer specifically to these projects.
5
-
6
-
Because of this, these projects include some intentional quirks that differ from what a well-formed an Arduino project for testing with `arduino_ci` might contain. See other projects in the "Arduino-CI" GitHub organization for practical examples.
4
+
This directory contains projects that are intended solely for testing the various features of this gem -- to test the testing framework itself. The RSpec tests refer specifically to these projects, and as a result _some are explicity designed to fail_.
7
5
6
+
> **If you are a first-time `arduino_ci` user an are looking for an example to copy from, see [the `Arduino-CI/Blink` repository](https://github.com/Arduino-CI/Blink) instead.**
8
7
9
8
* "TestSomething" contains a minimial library, but tests for all the C++ compilation feature-mocks of arduino_ci.
10
9
* "DoSomething" is a simple test of the testing framework (arduino_ci) itself to verfy that passes and failures are properly identified and reported. Because of this, it includes test files that are expected to fail -- they are prefixed with "bad-".
@@ -13,3 +12,4 @@ Because of this, these projects include some intentional quirks that differ from
13
12
* "OnePointFiveDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the ["1.5" specfication](https://arduino.github.io/arduino-cli/latest/library-specification/)
14
13
* "DependOnSomething" is a non-functional library meant to test file inclusion logic with dependencies
15
14
* "ExcludeSomething" is a non-functional library meant to test directory exclusion logic
This is a "beater" example that is referenced by tests of the Arduino CI module itself.
4
3
5
4
All the tests of our mocked `Arduino.h` implementation live here.
5
+
6
+
This example project is tightly coupled to the tests of the Arduino CI module itself. In that sense, each of the individual test files will be illustrative of the testing strategy and capabilities of the core library itself.
0 commit comments