Skip to content

Commit a5e740c

Browse files
author
Paul
committed
Updated readme with:
* additional details for beginners, * links to useful references, * clarified how *.test.* files work now.
1 parent 6d1885f commit a5e740c

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

README.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,72 @@
11
# Arduino CI Scripts
22

3-
This repos contains various scripts and tools related to running
4-
continuous integration (CI) checks on Arduino Library Repos.
3+
This repos contains various scripts and tools related to running continuous integration (CI) checks on Arduino Library Repos. The operations include:
4+
5+
* checking formatting using using [clang-format](https://clang.llvm.org/docs/ClangFormat.html),
6+
* generating documentation from source comments using using [Doxygen](https://www.doxygen.nl/), and
7+
* building each example in the library for selected targets.
58

69
There is an associated guide available here:
710
https://learn.adafruit.com/the-well-automated-arduino-library/
811

912
## Adding GitHub Actions to Repo
1013

14+
To run these continuous integration checks on each push, pull-request or [repository dispatch](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event) using [GitHub actions](https://github.com/features/actions):
15+
1116
* Create a folder named `.github/worflows` in the root of the repo.
1217
* Copy `example_actions.yml` into the above directory and rename it `githubci.yml`.
13-
* Edit `githubci.yml` and change `PRETTYNAME` to the library repo name.
18+
* Edit `githubci.yml` and change `PRETTYNAME` to the library repo name. Optionally, delete or comment out steps (using the `#` character), you don't want to include.
1419
* Here's an example: [Adafruit_BME280_Library](https://github.com/adafruit/Adafruit_BME280_Library/blob/master/.github/workflows/githubci.yml)
15-
* These actions will now run automatically on any pull, push, or dispatch.
1620

1721
## Controlling Test Behavior
1822

19-
The `build_platform.py` script is used to test each `.ino` example in the repo for the
20-
selected build platforms. The `ALL_PLATFORMS` dictionary contains a listing of all
21-
available platforms. By default, `main_platforms` is used. Additionally, UF2 files
22-
of the compiled sketches can be generated for supported platforms. The behavior
23-
can be controlled using special hidden filenames. These are just empty files
24-
placed in the root folder:
23+
The `build_platform.py` script is used to test each `.ino` example in the repo for selected build platforms. The [`ALL_PLATFORMS`](ci-arduino/blob/master/build_platform.py#L54) dictionary contains a listing of all available platforms and selected platform groups. By default, `main_platforms` is used. To select a specific platform or group, replace `main_platforms` in [`githubci.yml`](`example_actions.yml`) with the group or platform name.
24+
25+
Additionally, [UF2 files](https://github.com/microsoft/uf2) of the compiled sketches can be generated for supported platforms.
26+
27+
### Fine tuning test selection
28+
29+
The script behavior can be controlled using special filenames:
2530

2631
* `.YOUR_PLATFORM_HERE.test.skip` - Skip the specified platform. All others are tested.
27-
* `.YOUR_PLATFORM_HERE.test.only` - Test only the specfied platform. All others are skipped.
32+
* `.YOUR_PLATFORM_HERE.test.only` - Test the specified platform. All others are skipped.
2833
* `.YOUR_PLATFORM_HERE.generate` - Generate UF2 of sketch for specified platform (if supported).
2934

30-
Replace `YOUR_PLATFORM_HERE` in the name with exact text from `ALL_PLATFORMS`.
31-
32-
### Examples
35+
These are just empty files placed in an example folder. Replace `YOUR_PLATFORM_HERE` in the name with exact text from `ALL_PLATFORMS`. You can use several `.PLATFORM.test.skip` or `.PLATFORM.test.only` to exclude or include multiple platforms. For example:
3336

3437
* To **skip** testing on ESP8266, add a file named `.esp8266.test.skip`
3538
* To test **only** the Arduino UNO, add a file named `.uno.test.only`
3639
* To skip all and test **nothing**, add a file named `.none.test.only`
3740
* To generate UF2s for PyPortal, add a file named `.pyportal.generate`
3841

42+
### Dependencies
43+
44+
Any library dependencies included in the [`library.properties`](https://arduino.github.io/arduino-cli/0.19/library-specification/#libraryproperties-file-format) are automatically installed before the tests are started. To install additional dependencies (e.g., those required for some examples but not the library itself) using [`arduino-cli`](https://arduino.github.io/arduino-cli/0.19/commands/arduino-cli_lib_install/), you could add additional steps to the `githubci.yml` file. For example:
45+
46+
```yaml
47+
- name: Set configuration
48+
run: arduino-cli config set library.enable_unsafe_install true
49+
50+
- name: Install test dependencies
51+
run: arduino-cli lib install --git-url https://github.com/arduino-libraries/Servo --git-url https://github.com/arduino-libraries/Ethernet
52+
```
53+
54+
Note: you'll only need to enable the [`enable_unsafe_install`](https://arduino.github.io/arduino-cli/0.32/configuration/#configuration-keys) option if you want to identify libraries using urls. This isn't necessary when using the library name.
55+
3956
## Formatting Check with Clang
4057

41-
The `run-clang-format.py` script is used to run ClangFormat and check file formatting.
58+
The `run-clang-format.py` script is used to run [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and check file formatting.
4259
See [the guide](https://learn.adafruit.com/the-well-automated-arduino-library/formatting-with-clang-format) for details on installing `clang-format` to run formatting locally.
4360
Even a single extra white space can cause the CI to fail on formatting.
4461
You can typically just let clang do its thing and edit files in place using:
62+
4563
```
4664
clang-format -i File_To_Format.cpp
4765
```
4866

4967
## Documentation with Doxygen
5068

51-
The `doxy_gen_and_deploy.sh` script uses Doxygen to generate and deploy documentation
69+
The `doxy_gen_and_deploy.sh` script uses [Doxygen](https://www.doxygen.nl/) to generate and deploy documentation
5270
for the library. Any issues, like missing documentation, will cause the CI to fail.
53-
See the [the guide](https://learn.adafruit.com/the-well-automated-arduino-library/doxygen)
54-
for details on installing and running doxygen locally. The guide also has some
55-
[tips](https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips)
56-
on basic usage of doxygen markup within your code.
71+
See the [the guide](https://learn.adafruit.com/the-well-automated-arduino-library/doxygen) for details on installing and running doxygen locally. The guide also has some
72+
[tips](https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips) on basic usage of doxygen markup within your code.

0 commit comments

Comments
 (0)