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
+1Lines changed: 1 addition & 0 deletions
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
+64-41Lines changed: 64 additions & 41 deletions
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:
41
+
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
35
45
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_.
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
+
# to use the latest available gem, replace the below values for git: and ref: as needed
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
+
> At the time of this writing, `1.2` 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.
74
89
75
-
It would also make sense to add the following to your `.gitignore`, or copy [the `.gitignore` used by this project](.gitignore):
76
90
77
-
```
91
+
It would also make sense to add the following to your `.gitignore`:
92
+
```ignore-list
78
93
/.bundle/
79
-
/.yardoc
80
-
Gemfile.lock
81
-
/_yardoc/
82
-
/coverage/
83
-
/doc/
84
-
/pkg/
85
-
/spec/reports/
86
94
vendor
87
-
*.gem
95
+
```
88
96
89
-
# rspec failure tracking
90
-
.rspec_status
97
+
#### Using the latest-available code
91
98
92
-
# C++ stuff
93
-
*.bin
94
-
*.bin.dSYM
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'
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>'
106
+
```
107
+
108
+
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.
129
+
106
130
107
-
### Running tests
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
@@ -171,8 +194,8 @@ Next, you need this in `.travis.yml` in your repo
171
194
sudo: false
172
195
language: ruby
173
196
script:
174
-
- bundle install
175
-
- bundle exec arduino_ci.rb
197
+
- gem install arduino_ci
198
+
- arduino_ci.rb
176
199
```
177
200
178
201
@@ -185,8 +208,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