Skip to content

Commit 61f803d

Browse files
authored
Merge pull request #17 from tekktrik/doc/update-readme
Doc/update readme
2 parents d43ac38 + 674529d commit 61f803d

File tree

2 files changed

+22
-139
lines changed

2 files changed

+22
-139
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
repos:
66
- repo: https://github.com/fsfe/reuse-tool
7-
rev: latest
7+
rev: v0.14.0
88
hooks:
99
- id: reuse
1010
- repo: https://github.com/pre-commit/pre-commit-hooks

README.md

Lines changed: 21 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -4,157 +4,40 @@ SPDX-FileCopyrightText: 2019 Adafruit Industries
44
SPDX-License-Identifier: MIT
55
-->
66

7-
# Actions CI CircuitPython Init Script
7+
# Actions CI CircuitPython Install Script
88

99
The purpose of this repo is to create a centrally managed dependency
10-
install script for all Adafruit CircuitPython Library Github Actions and Travis CI configs.
10+
install script for all Adafruit CircuitPython Library Github Actions.
1111
This will allow us to easily update the install steps without
12-
having to manually or programatically update 100+ `.travis.yml` files or github workflows.
12+
having to manually or programatically update 200+ GitHub workflows.
1313

14-
We have a guide that you can use to follow along to install both TravisCI and Doxygen generation here https://learn.adafruit.com/the-well-automated-arduino-library/
14+
We have [a Learn guide](https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/testing-with-github-actions)
15+
that you can use to follow along to using GitHub Actions.
1516

16-
## Adding to Github Actions Workflows
17+
# Using in Workflow Files
1718

18-
This section should be added.
19+
To use the install script in workflow files, you'll need to check out this
20+
repository, followed by running the `install.sh` bash script.
1921

20-
## Adding to Travis CI Configs
22+
You can clone and checkout this repo in a GitHub Actions workflow file using
23+
`actions/checkout`:
2124

22-
You will need to source the script in the `before_install` step of your
23-
`.travis.yml` file.
24-
25-
```sh
26-
source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
27-
```
28-
29-
If you only want to install and build on certain platforms, you can set the
30-
`INSTALL_PLATFORMS` envionrment variable to a comma-seperated list of platforms.
31-
32-
**Example `.travis.yml`:**
3325
```yaml
34-
language: c
35-
sudo: false
36-
cache:
37-
directories:
38-
- ~/arduino_ide
39-
- ~/.arduino15/packages/
40-
git:
41-
depth: false
42-
quiet: true
43-
env:
44-
global:
45-
# You can uncomment this to explicitly choose an (old) version of the Arduino IDE
46-
#- ARDUINO_IDE_VERSION="1.8.10"
47-
before_install:
48-
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
49-
install:
50-
# Note that every library should be installed in a seperate command
51-
- arduino --install-library "Adafruit SleepyDog Library"
52-
- arduino --install-library "Adafruit FONA Library"
53-
script:
54-
- build_main_platforms
55-
notifications:
56-
email:
57-
on_success: change
58-
on_failure: change
26+
- name: Checkout tools repo
27+
uses: actions/checkout@v2
28+
with:
29+
repository: adafruit/actions-ci-circuitpython-libs
30+
path: actions-ci
5931
```
6032
61-
**Choosing Arduino IDE version**
62-
63-
You could use any version of IDE by setting `ARDUINO_IDE_VERSION` variable but we recommend keeping this variable unused because script gets updated and you then will not have to modify `.travis.yml` manually.
33+
In the example above, the repo is now cloned as `actions-ci`.
6434

65-
## Automated Example Verification Bash Functions
35+
The dependencies can then be downloaded using `install.sh`:
6636

67-
`build_platform` will build all `.ino` examples in the repo using the passed platform. The platforms
68-
are defined in the `MAIN_PLATFORMS` and `AUX_PLATFORMS` associative arrays at the top of the script.
69-
70-
All of the examples will be built with the platforms in `MAIN_PLATFORMS` if you call `build_main_platforms`,
71-
and `AUX_PLATFORMS` can be used to define other platforms that don't need to be verified for every repo.
72-
73-
Build the examples using the platforms in the MAIN_PLATFORMS array:
7437
```yaml
75-
script:
76-
- build_main_platforms
77-
```
78-
79-
Build the examples only using the trinket:
80-
```yaml
81-
script:
82-
- build_platform trinket
83-
```
84-
85-
### Skipping Platforms
86-
87-
If you would like to skip one of the main platforms when running `build_main_platforms`,
88-
you can commit a `.YOUR_PLATFORM_HERE.test.skip` file to the example sketch directory you
89-
wish to skip. You will need to use the array key defined in `MAIN_PLATFORMS` for the platform
90-
you wish to skip.
91-
92-
For example, if you would like to skip the `esp8266` platform for an example
93-
in your lib called `blink.ino`, you would need to do something like this in your library repo:
94-
95-
```sh
96-
$ touch examples/blink/.esp8266.test.skip
97-
$ git add -A
98-
$ git commit -a
99-
$ git push
100-
```
101-
102-
If you need an easy way to skip a platform, you can also add something like this to your `~/.bash_profile`:
103-
104-
```sh
105-
function travis_skip()
106-
{
107-
108-
local platform_key=$1
109-
110-
# grab all pde and ino example sketches
111-
local examples=$(find $PWD -name "*.pde" -o -name "*.ino")
112-
113-
# loop through example sketches
114-
for example in $examples; do
115-
116-
# store the full path to the example's sketch directory
117-
local example_dir=$(dirname $example)
118-
119-
touch ${example_dir}/.${platform_key}.test.skip
120-
121-
done
122-
123-
}
38+
- name: Install dependencies
39+
run: |
40+
source action-ci/install.sh
12441
```
12542

126-
You will then be able to skip a platform for all examples by running the `travis_skip` function from your library repo.
127-
It will automatically add the `.YOUR_PLATFORM_HERE.test.skip` files to the examples.
128-
129-
```sh
130-
$ travis_skip esp8266
131-
```
132-
133-
## Using external libraries
134-
External libraries (which are not hosted by the Arduino library manager) can be installed using the following command:
135-
```sh
136-
- if [ ! -d "$HOME/arduino_ide/libraries/<Name>" ]; then git clone <URL> $HOME/arduino_ide/libraries/<Name>; fi
137-
```
138-
139-
## Deploying compiled artifacts
140-
If you need to get hold of the compiled sketches of your project, in order to release them or forward them to an
141-
deployment pipeline, you can find them in the `$ARDUINO_HEX_DIR` directory. Specifically, if `Foo` is the name
142-
of your project, you are compiling for an `Arduino Mega` and the primary sketch is called `Foo.ino`, the flashable
143-
`.hex` files will be found inside `$ARDUINO_HEX_DIR/mega2560/Foo` as `Foo.ino.hex` and `Foo.ino.with_bootloader.hex`.
144-
Similarly for the rest of the platforms.
145-
146-
For example, assuming you have a `Foo` project as outlined above, to create a release which includes the `.hex`
147-
files on GitHub, you could add this to your `.travis.yml` configuration:
148-
149-
```yaml
150-
deploy:
151-
provider: releases
152-
api_key:
153-
secure: YOUR_API_KEY_ENCRYPTED
154-
file:
155-
- $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.hex
156-
- $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.with_bootloader.hex
157-
skip_cleanup: true
158-
on:
159-
tags: true
160-
```
43+
This will handle installing all the needed dependencies for the given library.

0 commit comments

Comments
 (0)