Skip to content

Commit 983c6d0

Browse files
committed
stop recommending a Gemfile
1 parent dd64829 commit 983c6d0

File tree

4 files changed

+79
-58
lines changed

4 files changed

+79
-58
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
- Better indications of which example sketch is being compiled as part of testing
1212

1313
### 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.
1415

1516
### Deprecated
1617

README.md

+73-54
Original file line numberDiff line numberDiff line change
@@ -29,69 +29,91 @@ Windows | [![Windows Build status](https://github.com/Arduino-CI/arduino_ci/wor
2929

3030
## Quick Start
3131

32-
### You Need Your Arduino Library
32+
This project has the following dependencies:
3333

34-
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).
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:
3541

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
3747

3848
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**.
3949

4050
> 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).
4151
52+
### Changes to Your Repository
4253

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`:
4655

56+
```ignore-list
57+
# arduino_ci unit test binaries and artifacts
58+
*.bin
59+
*.bin.dSYM
60+
```
4761

48-
### You Need A Compiler (`g++`)
62+
### A Quick Example
4963

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).
5165

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.
5566

67+
## Advanced Start
5668

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.
5870

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
6072

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).
6274

75+
You will need to add a file called `Gemfile` (no extension) to your Arduino project.
6376

64-
### Changes to Your Repo
77+
#### Non-root installation
6578

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:
6780

6881
```ruby
6982
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'
7186
```
7287

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+
7496

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'
76103

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>'
77106
```
78-
/.bundle/
79-
/.yardoc
80-
Gemfile.lock
81-
/_yardoc/
82-
/coverage/
83-
/doc/
84-
/pkg/
85-
/spec/reports/
86-
vendor
87-
*.gem
88107

89-
# rspec failure tracking
90-
.rspec_status
91108

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:
112+
113+
```ruby
114+
source 'https://rubygems.org'
115+
116+
gem 'arduino_ci', path: '/path/to/development/dir/for/arduino_ci'
95117
```
96118

97119

@@ -103,17 +125,18 @@ $ bundle install # adds packages to global library (may require admin rights)
103125
$ bundle install --path vendor/bundle # adds packages to local library
104126
```
105127

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.
106129

107-
### Running tests
130+
131+
132+
### Running `arduino_ci.rb` To Test Your Library
108133

109134
With that installed, just the following shell command each time you want the tests to execute:
110135

111-
```
136+
```console
112137
$ bundle exec arduino_ci.rb
113138
```
114139

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-
117140

118141
### Reference
119142

@@ -128,18 +151,14 @@ For more information on the usage of `arduino_ci.rb`, see [REFERENCE.md](REFEREN
128151

129152
## Setting up Pull Request Testing and/or External CI
130153

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.
136155
137-
### Testing with remote CI
156+
### Arduino CI's Own GitHub action
138157

139-
> **Note:** `arduino_ci.rb` expects to be run from the root directory of your Arduino project library.
158+
[![GitHub Marketplace](https://img.shields.io/badge/Get_it-on_Marketplace-informational.svg)](https://github.com/marketplace/actions/arduino_ci)
140159

141160

142-
#### GitHub Actions
161+
### Your Own Scripted GitHub Action
143162

144163
GitHub Actions allows you to automate your workflows directly in GitHub.
145164
No additional steps are needed.
@@ -156,12 +175,12 @@ jobs:
156175
with:
157176
ruby-version: 2.6
158177
- run: |
159-
bundle install
160-
bundle exec arduino_ci_remote.rb
178+
gem install arduino_ci
179+
arduino_ci.rb
161180
```
162181
163182
164-
#### Travis CI
183+
### Travis CI
165184
166185
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.
167186
@@ -171,12 +190,12 @@ Next, you need this in `.travis.yml` in your repo
171190
sudo: false
172191
language: ruby
173192
script:
174-
- bundle install
175-
- bundle exec arduino_ci.rb
193+
- gem install arduino_ci
194+
- arduino_ci.rb
176195
```
177196

178197

179-
#### Appveyor CI
198+
### Appveyor CI
180199

181200
You'll need to go to https://ci.appveyor.com/projects and add your project.
182201

@@ -185,8 +204,8 @@ Next, you'll need this in `appveyor.yml` in your repo.
185204
```yaml
186205
build: off
187206
test_script:
188-
- bundle install
189-
- bundle exec arduino_ci.rb
207+
- gem install arduino_ci
208+
- arduino_ci.rb
190209
```
191210

192211

SampleProjects/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
Arduino Sample Projects
22
=======================
33

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.
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_.
75

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.**
87
98
* "TestSomething" contains a minimial library, but tests for all the C++ compilation feature-mocks of arduino_ci.
109
* "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
1312
* "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/)
1413
* "DependOnSomething" is a non-functional library meant to test file inclusion logic with dependencies
1514
* "ExcludeSomething" is a non-functional library meant to test directory exclusion logic
15+
* "NetworkLib" tests the Ethernet library
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# TestSomething
22

3-
This is a "beater" example that is referenced by tests of the Arduino CI module itself.
43

54
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

Comments
 (0)