Skip to content

Commit 821c7fa

Browse files
authored
Merge pull request #48 from per1234/libraries-input-sources
libraries/compile-examples: add support for all sources to libraries input
2 parents 1d83693 + d88f658 commit 821c7fa

File tree

12 files changed

+790
-113
lines changed

12 files changed

+790
-113
lines changed

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,40 @@ For 3rd party boards, also specify the Boards Manager URL:
1818
1919
### `libraries`
2020

21-
List of library dependencies to install (space separated). Default `""`.
21+
YAML-format list of library dependencies to install.
22+
23+
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: '-'`).
24+
25+
Note: the original space-separated list format is also supported. When this syntax is used, the repository under test will always be installed as a library.
26+
27+
#### Sources:
28+
29+
##### Library Manager
30+
31+
Keys:
32+
- `name` - name of the library.
33+
- `version` - version of the library to install. Default is the latest version.
34+
35+
##### Local path
36+
37+
Keys:
38+
- `source-path` - path to install as a library. Relative paths are assumed to be relative to the root of the repository.
39+
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source repository or subfolder name.
40+
41+
##### Repository
42+
43+
Keys:
44+
- `source-url` - URL to clone the repository from. It must start with `git://` or end with `.git`.
45+
- `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.
46+
- `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.
47+
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source repository or subfolder name.
48+
49+
##### Archive download
50+
51+
Keys:
52+
- `source-url` - download URL for the archive (e.g., `https://github.com/arduino-libraries/Servo/archive/master.zip`).
53+
- `source-path` - path to install as a library. Paths are relative to the root folder of the archive. If the archive doesn't have a root folder, use `..` as `source-path` to install from the archive root. The default is to install from the root folder of the archive.
54+
- `destination-name` - folder name to install the library to. By default, the folder will be named according to the source archive or subfolder name.
2255

2356
### `sketch-paths`
2457

@@ -106,6 +139,10 @@ Only compiling examples:
106139
- uses: arduino/actions/libraries/compile-examples@master
107140
with:
108141
fqbn: 'arduino:avr:uno'
142+
libraries: |
143+
- name: Servo
144+
- name: Stepper
145+
version: 1.1.3
109146
```
110147

111148
Storing the memory usage change report as a [workflow artifact](https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts):

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ inputs:
88
description: 'Full qualified board name, with Boards Manager URL if needed'
99
default: 'arduino:avr:uno'
1010
libraries:
11-
description: 'List of library dependencies to install (space separated)'
12-
default: ''
11+
description: 'YAML-format list of library dependencies to install'
12+
default: '- source-path: ./'
1313
sketch-paths:
1414
description: 'List of paths containing sketches to compile.'
1515
default: 'examples'

compilesketches/compilesketches.py

Lines changed: 337 additions & 39 deletions
Large diffs are not rendered by default.

compilesketches/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ gitpython==3.1.1
22
PyGithub==1.47
33
pytest==5.4.1
44
pytest-mock==3.1.0
5+
pyyaml==5.3.1

compilesketches/tests/test_compilesketches.py

Lines changed: 411 additions & 71 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo

compilesketches/tests/testdata/test_get_archive_root_folder_name/has-file/not-root.foo

Whitespace-only changes.

compilesketches/tests/testdata/test_get_archive_root_folder_name/has-file/not-root/.gitkeep

Whitespace-only changes.

compilesketches/tests/testdata/test_get_archive_root_folder_name/has-folders/also-not-root/.gitkeep

Whitespace-only changes.

compilesketches/tests/testdata/test_get_archive_root_folder_name/has-folders/not-root/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)