Skip to content

Commit b563173

Browse files
authored
Merge pull request #6 from per1234/fix-docs
Improve documentation
2 parents df7b94f + 98519b3 commit b563173

File tree

1 file changed

+126
-55
lines changed

1 file changed

+126
-55
lines changed

README.md

+126-55
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,63 @@
1-
# arduino/compile-sketches action
2-
3-
This action checks whether Arduino sketches compile and produces a report of data from the compilations.
1+
# `arduino/compile-sketches` action
2+
3+
[![Tests](https://github.com/arduino/compile-sketches/workflows/Test%20Python%20code/badge.svg)](https://github.com/arduino/compile-sketches/actions?workflow=Test+Python+code)
4+
[![Lint](https://github.com/arduino/compile-sketches/workflows/Lint%20Python%20code/badge.svg)](https://github.com/arduino/compile-sketches/actions?workflow=Lint+Python+code)
5+
[![Spell Check](https://github.com/arduino/compile-sketches/workflows/Spell%20Check/badge.svg)](https://github.com/arduino/compile-sketches/actions?workflow=Spell+Check)
6+
[![codecov](https://codecov.io/gh/arduino/compile-sketches/branch/master/graph/badge.svg)](https://codecov.io/gh/arduino/compile-sketches)
7+
8+
This action checks whether [Arduino](https://www.arduino.cc/) sketches compile and produces a report of data from the compilations.
9+
10+
## Table of contents
11+
12+
<!-- toc -->
13+
14+
- [Inputs](#inputs)
15+
- [`cli-version`](#cli-version)
16+
- [`fqbn`](#fqbn)
17+
- [`platforms`](#platforms)
18+
- [Supported platform sources:](#supported-platform-sources)
19+
- [Boards Manager](#boards-manager)
20+
- [Local path](#local-path)
21+
- [Repository](#repository)
22+
- [Archive download](#archive-download)
23+
- [`libraries`](#libraries)
24+
- [Supported library sources:](#supported-library-sources)
25+
- [Library Manager](#library-manager)
26+
- [Local path](#local-path-1)
27+
- [Repository](#repository-1)
28+
- [Archive download](#archive-download-1)
29+
- [`sketch-paths`](#sketch-paths)
30+
- [`verbose`](#verbose)
31+
- [`sketches-report-path`](#sketches-report-path)
32+
- [`github-token`](#github-token)
33+
- [`enable-deltas-report`](#enable-deltas-report)
34+
- [How it works](#how-it-works)
35+
- [`enable-warnings-report`](#enable-warnings-report)
36+
- [Example usage](#example-usage)
37+
38+
<!-- tocstop -->
439

540
## Inputs
641

742
### `cli-version`
843

9-
The version of [Arduino CLI](https://github.com/arduino/arduino-cli) to use. Default `"latest"`.
44+
The version of [Arduino CLI](https://github.com/arduino/arduino-cli) to use.
45+
46+
**Default**: `"latest"`
1047

1148
### `fqbn`
1249

13-
The fully qualified board name to use when compiling. Default `"arduino:avr:uno"`.
50+
The fully qualified board name to use when compiling.
51+
52+
**Default**: `"arduino:avr:uno"`
1453

1554
If the board is from one of the platforms provided by Arduino's [default package index](https://downloads.arduino.cc/packages/package_index.json), the board's platform dependency will be automatically detected and the latest version installed. For boards of platforms not in the default package index, previous versions, or other platform sources, the platform dependency must be defined via the [`platforms` input](#platforms).
1655

1756
### `platforms`
1857

19-
YAML-format list of platform dependencies to install.
58+
[YAML](https://en.wikipedia.org/wiki/YAML)-format list of platform dependencies to install.
2059

21-
Default `""`. If no `platforms` input is provided, the board's dependency will be automatically determined from the `fqbn` input and the latest version of that platform will be installed via Boards Manager.
60+
**Default**: The board's dependency will be automatically determined from the `fqbn` input and the latest version of that platform will be installed via Boards Manager.
2261

2362
If a platform dependency from a non-Boards Manager source of the same name as another Boards Manager source platform dependency is defined, they will both be installed, with the non-Boards Manager dependency overwriting the Boards Manager platform installation. This permits testing against a non-release version of a platform while using Boards Manager to install the platform's tools dependencies.
2463
Example:
@@ -31,120 +70,152 @@ platforms: |
3170
name: "arduino:samd"
3271
```
3372
34-
#### Sources:
73+
#### Supported platform sources:
3574
3675
##### Boards Manager
3776
3877
Keys:
39-
- `name` - platform name in the form of `VENDOR:ARCHITECTURE`.
40-
- `version` - version of the platform to install. Default is the latest version.
41-
- `source-url` - Boards Manager URL of the platform. Default is Arduino's package index, which allows installation of all official platforms.
78+
- **`name`** - (**required**) platform name in the form of `VENDOR:ARCHITECTURE` (e.g., `arduino:avr`).
79+
- **`version`** - version of the platform to install.
80+
- **Default**: the latest version.
81+
- **`source-url`** - Boards Manager URL of the platform.
82+
- **Default**: Arduino's package index, which allows installation of all official platforms.
4283

4384
##### Local path
4485

4586
Keys:
46-
- `source-path` - path to install as a platform. Relative paths are assumed to be relative to the root of the repository.
47-
- `name` - platform name in the form of `VENDOR:ARCHITECTURE`.
87+
- **`source-path`** - (**required**) path to install as a platform. Relative paths are assumed to be relative to the root of the repository.
88+
- **`name`** - (**required**) platform name in the form of `VENDOR:ARCHITECTURE` (e.g., `arduino:avr`).
4889

4990
##### Repository
5091

5192
Keys:
52-
- `source-url` - URL to clone the repository from. It must start with `git://` or end with `.git`.
53-
- `version` - [Git ref](https://git-scm.com/book/en/v2/Git-Internals-Git-References) of the repository to checkout. The special version name `latest` will cause the latest tag to be used. By default, the repository will be checked out to the tip of the default branch.
54-
- `source-path` - path to install as a platform. Paths are relative to the root of the repository. The default is to install from the root of the repository.
55-
- `name` - platform name in the form of `VENDOR:ARCHITECTURE`.
93+
- **`source-url`** - (**required**) URL to clone the repository from. It must start with `git://` or end with `.git`.
94+
- **`name`** - (**required**) platform name in the form of `VENDOR:ARCHITECTURE` (e.g., `arduino:avr`).
95+
- **`version`** - [Git ref](https://git-scm.com/book/en/v2/Git-Internals-Git-References) of the repository to checkout. The special version name `latest` will cause the latest tag to be used.
96+
- **Default**: the repository is checked out to the tip of the default branch.
97+
- **`source-path`** - path to install as a platform. Paths are relative to the root of the repository.
98+
- **Default**: root of the repository.
5699

57100
##### Archive download
58101

59102
Keys:
60-
- `source-url` - download URL for the archive (e.g., `https://github.com/arduino/ArduinoCore-avr/archive/master.zip`).
61-
- `source-path` - path to install as a platform. Paths are relative to the root folder of the archive, or the root of the archive if it has no root folder. The default is to install from the root folder of the archive.
62-
- `name` - platform name in the form of `VENDOR:ARCHITECTURE`.
103+
- **`source-url`** - (**required**) download URL for the archive (e.g., `https://github.com/arduino/ArduinoCore-avr/archive/master.zip`).
104+
- **`name`** - (**required**) platform name in the form of `VENDOR:ARCHITECTURE` (e.g., `arduino:avr`).
105+
- **`source-path`** - path to install as a platform. Paths are relative to the root folder of the archive, or the root of the archive if it has no root folder.
106+
- **Default**: root folder of the archive.
63107

64108
### `libraries`
65109

66-
YAML-format list of library dependencies to install.
110+
[YAML](https://en.wikipedia.org/wiki/YAML)-format list of library dependencies to install.
67111

68-
Default `"- source-path: ./"`. This causes the repository to be installed as a library. If there are no library dependencies and you want to override the default, set the `libraries` input to an empty list (`- libraries: '-'`).
112+
**Default**: `"- source-path: ./"`
113+
This causes the repository to be installed as a library. If there are no library dependencies and you want to override the default, set the `libraries` input to an empty list (`- libraries: '-'`).
69114
70115
Libraries are installed under the Arduino user folder at `~/Arduino/libraries`.
71116

72-
Note: when the deprecated space-separated list format of this input is used, the repository under test will always be installed as a library.
117+
**Note**: when the deprecated space-separated list format of this input is used, the repository under test will always be installed as a library.
73118

74-
#### Sources:
119+
#### Supported library sources:
75120

76121
##### Library Manager
77122

78123
Keys:
79-
- `name` - name of the library, as defined in the `name` field of its [library.properties](https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format) metadata file. The library will be installed to a folder matching the name, but with any spaces replaced by `_`.
80-
- `version` - version of the library to install. Default is the latest version.
124+
- **`name`** - (**required**) name of the library, as defined in the `name` field of its [library.properties](https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format) metadata file.
125+
- **`version`** - version of the library to install.
126+
- **Default**: the latest version.
127+
128+
**Notes**:
129+
- The library will be installed to a folder matching its name, but with any spaces replaced by `_`.
130+
- If the library's author defined dependencies, those libraries will be installed automatically.
81131

82132
##### Local path
83133

84134
Keys:
85-
- `source-path` - path to install as a library. Relative paths are assumed to be relative to the root of the repository.
86-
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source repository or subfolder name.
135+
- **`source-path`** - (**required**) path to install as a library. Relative paths are assumed to be relative to the root of the repository.
136+
- **`destination-name`** - folder name to install the library to.
137+
- **Default**: the folder will be named according to the source repository or subfolder name.
87138

88139
##### Repository
89140

90141
Keys:
91-
- `source-url` - URL to clone the repository from. It must start with `git://` or end with `.git`.
92-
- `version` - [Git ref](https://git-scm.com/book/en/v2/Git-Internals-Git-References) of the repository to checkout. The special version name `latest` will cause the latest tag to be used. By default, the repository will be checked out to the tip of the default branch.
93-
- `source-path` - path to install as a library. Paths are relative to the root of the repository. The default is to install from the root of the repository.
94-
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source repository or subfolder name.
142+
- **`source-url`** - (**required**) URL to clone the repository from. It must start with `git://` or end with `.git`.
143+
- **`version`** - [Git ref](https://git-scm.com/book/en/v2/Git-Internals-Git-References) of the repository to checkout. The special version name `latest` will cause the latest tag to be used.
144+
- **Default**: the tip of the default branch.
145+
- **`source-path`** - path to install as a library. Paths are relative to the root of the repository.
146+
- **Default**: root of the repository.
147+
- **`destination-name`** - folder name to install the library to.
148+
- **Default**: named according to the source repository or subfolder name.
95149

96150
##### Archive download
97151

98152
Keys:
99-
- `source-url` - download URL for the archive (e.g., `https://github.com/arduino-libraries/Servo/archive/master.zip`).
100-
- `source-path` - path to install as a library. Paths are relative to the root folder of the archive, or the root of the archive if it has no root folder. The default is to install from the root folder of the archive.
101-
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source archive or subfolder name.
153+
- **`source-url`** - (**required**) download URL for the archive (e.g., `https://github.com/arduino-libraries/Servo/archive/master.zip`).
154+
- **`source-path`** - path to install as a library. Paths are relative to the root folder of the archive, or the root of the archive if it has no root folder.
155+
- **Default**: root folder of the archive.
156+
- **`destination-name`** - folder name to install the library to.
157+
- **Default**: named according to the source archive or subfolder name.
102158

103159
### `sketch-paths`
104160

105-
YAML-format list of paths containing sketches to compile. These paths will be searched recursively. Default `- examples`.
161+
[YAML](https://en.wikipedia.org/wiki/YAML)-format list of paths containing sketches to compile. These paths will be searched recursively.
162+
163+
**Default**: `"- examples"`
106164

107165
### `verbose`
108166

109-
Set to true to show verbose output in the log. Default `false`
167+
Set to true to show verbose output in the log.
168+
169+
**Default**: `false`
110170

111171
### `sketches-report-path`
112172

113-
Path in which to save a JSON formatted file containing data from the sketch compilations. Should be used only to store reports. Relative paths are relative to [`GITHUB_WORKSPACE`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables). The folder will be created if it doesn't already exist. This report is used by the `arduino/report-size-deltas` and `arduino/report-size-trends` actions. Default `"size-deltas-reports"`.
173+
Path in which to save a JSON formatted file containing data from the sketch compilations. Should be used only to store reports. Relative paths are relative to [`GITHUB_WORKSPACE`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables). The folder will be created if it doesn't already exist.
174+
175+
This report is used by the [`arduino/report-size-deltas`](https://github.com/arduino/report-size-deltas) and [`arduino/report-size-trends`](https://github.com/arduino/report-size-trends) actions.
176+
177+
**Default**: `"size-deltas-reports"`
114178

115179
### `github-token`
116180

117-
GitHub access token used to get information from the GitHub API. Only needed for private repositories with `enable-deltas-report` set to `true`. It will be convenient to use [`${{ secrets.GITHUB_TOKEN }}`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token). Default `""`.
181+
GitHub access token used to get information from the GitHub API. Only needed for private repositories with [`enable-deltas-report`](#enable-deltas-report) set to `true`. It will be convenient to use [`${{ secrets.GITHUB_TOKEN }}`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token).
182+
183+
**Default**: `""`
118184

119185
### `enable-deltas-report`
120186

121-
Set to `true` to cause the action to determine the change in memory usage and compiler warnings of the compiled sketches. If the workflow is triggered by a `pull_request` event, the comparison is between the pull request branch and the tip of the pull request's base branch. If the workflow is triggered by a `push` event, the comparison is between the pushed commit and its immediate parent. The deltas will be displayed in the GitHub Actions build log. This may be used with the [`arduino/report-size-deltas` action](https://github.com/arduino/report-size-deltas). Default `false`.
187+
Set to `true` to cause the action to determine the change in memory usage and compiler warnings of the compiled sketches.
188+
189+
If the workflow is triggered by a [`pull_request` event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request), the comparison is between the pull request branch and the tip of the pull request's base branch.
190+
191+
If the workflow is triggered by a [`push` event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push), the comparison is between the pushed commit and its immediate parent.
192+
193+
The deltas will be displayed in the GitHub Actions build log.
194+
195+
This report may be used with the [`arduino/report-size-deltas` action](https://github.com/arduino/report-size-deltas).
196+
197+
**Default**: `false`
198+
199+
#### How it works
200+
201+
The sketch is first compiled with the repository in [`$GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables) at the state it was at before the action's step. Data from the compilation is recorded in the sketches report. Next, a [`git checkout`] to the [Git ref](https://git-scm.com/book/en/v2/Git-Internals-Git-References) used as the base of the comparison is done and the compilation + data recording process repeated. The delta is the change in the data between the two compilations.
202+
203+
Dependencies defined via the [`libraries`](#libraries) or [`platforms`](#platforms) inputs are installed via [symlinks](https://en.wikipedia.org/wiki/Symbolic_link), meaning dependencies from local paths under `$GITHUB_WORKSPACE` reflect the deltas checkouts even though they are installed outside `$GITHUB_WORKSPACE`.
122204

123205
### `enable-warnings-report`
124206

125-
Set to `true` to cause the action to record the compiler warning count for each sketch compilation in the sketches report. Default `false`.
207+
Set to `true` to cause the action to record the compiler warning count for each sketch compilation in the sketches report.
208+
209+
**Default**: `false`
126210

127211
## Example usage
128212

129-
Only compiling examples:
130213
```yaml
131-
- uses: arduino/compile-sketches@master
214+
- uses: arduino/compile-sketches@main
132215
with:
133216
fqbn: 'arduino:avr:uno'
134217
libraries: |
135218
- name: Servo
136219
- name: Stepper
137220
version: 1.1.3
138221
```
139-
140-
Storing the sketches compilation report report as a [workflow artifact](https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts):
141-
```yaml
142-
- uses: arduino/compile-sketches@master
143-
with:
144-
enable-deltas-report: true
145-
- if: github.event_name == 'pull_request'
146-
uses: actions/upload-artifact@v1
147-
with:
148-
name: size-deltas-reports
149-
path: size-deltas-reports
150-
```

0 commit comments

Comments
 (0)