Compare commits
291 commits
revert-58-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ca170f09a | ||
|
|
078f453be3 | ||
|
|
32f60f499e | ||
|
|
04727ed0d4 | ||
|
|
d827a91a24 | ||
|
|
c9945ba55e | ||
|
|
324b4f8f3a | ||
|
|
eb96289980 | ||
|
|
e659722956 | ||
|
|
a1cd2c9e46 | ||
|
|
092a5ecfbd | ||
|
|
373f0c0c22 | ||
|
|
3fc602ef7a | ||
|
|
4e812d285c | ||
|
|
7283e8e87e | ||
|
|
28dc122a5c | ||
|
|
23118ee09d | ||
|
|
dd58a69a9e | ||
|
|
a05792c0d7 | ||
|
|
1e54f73313 | ||
|
|
24542df558 | ||
|
|
f08b762a34 | ||
|
|
319b6613e4 | ||
|
|
4d09c4abe4 | ||
|
|
fa2c172a12 | ||
|
|
3907bae549 | ||
|
|
c173d84c6d | ||
|
|
6ba1af1dfe | ||
|
|
6c55535367 | ||
|
|
8dda6941f5 | ||
|
|
42f4803327 | ||
|
|
8639df4c99 | ||
|
|
bf8812dd55 | ||
|
|
6b10fd6eb6 | ||
|
|
febfc922c4 | ||
|
|
ca4de93cc4 | ||
|
|
2c53c9bda1 | ||
|
|
6a67a1dec1 | ||
|
|
b64a59cec8 | ||
|
|
1b72ada926 | ||
|
|
b6e95ad50d | ||
|
|
696be13876 | ||
|
|
2602c52184 | ||
|
|
d0893ffd9f | ||
|
|
b8d1a1315b | ||
|
|
764f427a25 | ||
|
|
efd44cee4d | ||
|
|
4eff8b6c4b | ||
|
|
22bd6d6cc4 | ||
|
|
aa7b9800a1 | ||
|
|
eb515470b7 | ||
|
|
49a97f0acc | ||
|
|
76b0b0fbfe | ||
|
|
777e49e47f | ||
|
|
7840ec8a9f | ||
|
|
5172372545 | ||
|
|
e4760ab70e | ||
|
|
5bd604c966 | ||
|
|
fa90162410 | ||
|
|
888253b2de | ||
|
|
af388556f0 | ||
|
|
cd2c49a796 | ||
|
|
1f3a9aea38 | ||
|
|
ba452bb270 | ||
|
|
22307baa0e | ||
|
|
3640064284 | ||
|
|
efc9ca81ec | ||
|
|
1841e5b121 | ||
|
|
d16676c9c7 | ||
|
|
b863a6b594 | ||
|
|
adaa941584 | ||
|
|
dee8376c41 | ||
|
|
3127711e16 | ||
|
|
90fac687a1 | ||
|
|
fc374d68bb | ||
|
|
a47bd2ea9a | ||
|
|
18d7089513 | ||
|
|
5851559e4d | ||
|
|
1d634ea903 | ||
|
|
4c593787b4 | ||
|
|
0c7fa0126f | ||
|
|
4b002375e7 | ||
|
|
363a50de81 | ||
|
|
c31ee4dea9 | ||
|
|
f452154470 | ||
|
|
2c389af214 | ||
|
|
67feedfeee | ||
|
|
88b746ff77 | ||
|
|
9a8728c380 | ||
|
|
1fcc2329ee | ||
|
|
a6a0e86502 | ||
|
|
9c244d68ed | ||
|
|
7351a8957b | ||
|
|
f1a8355781 | ||
|
|
63b7c7e7e1 | ||
|
|
6b3d2e3b2b | ||
|
|
00bc76f9c9 | ||
|
|
26112fa943 | ||
|
|
4f21970e59 | ||
|
|
144a80dd3a | ||
|
|
22b835bfb2 | ||
|
|
74610a110d | ||
|
|
9b8cd9511d | ||
|
|
9ad307d36f | ||
|
|
8617e71e7d | ||
|
|
acaa4b761c | ||
|
|
4434e2cc44 | ||
|
|
ddcbcde7a1 | ||
|
|
31fe9f5f64 | ||
|
|
3a7e6065aa | ||
|
|
71bef419dc | ||
|
|
27df6130e3 | ||
|
|
23f3180f36 | ||
|
|
81aa9cb758 | ||
|
|
6ff9f7096a | ||
|
|
e8902ddae1 | ||
|
|
4e069bd16b | ||
|
|
f49b8e3e6e | ||
|
|
40a78a0aba | ||
|
|
97fc171114 | ||
|
|
a688e13e7c | ||
|
|
7d0c6a18eb | ||
|
|
bf2d23f5ff | ||
|
|
771ad04e80 | ||
|
|
200a3c0bf4 | ||
|
|
291765dca0 | ||
|
|
65a4580800 | ||
|
|
20cfc49f70 | ||
|
|
b6466e2092 | ||
|
|
37f36870c4 | ||
|
|
a3f77586be | ||
|
|
e60cb85683 | ||
|
|
b731f8a295 | ||
|
|
58d99c4da1 | ||
|
|
de6ad7a3f6 | ||
|
|
31575a9335 | ||
|
|
2deeba4613 | ||
|
|
9b0a17ddea | ||
|
|
9c83e4de86 | ||
|
|
de76725537 | ||
|
|
441382d135 | ||
|
|
83b8102c73 | ||
|
|
f21ee38196 | ||
|
|
893fcd5730 | ||
|
|
ecf8ecea5d | ||
|
|
4fbe599cac | ||
|
|
4fb9820b2d | ||
|
|
39087b3b5b | ||
|
|
0362af3856 | ||
|
|
26d7b20482 | ||
|
|
939d3f0f18 | ||
|
|
2ef0a08c8b | ||
|
|
a99332cdf0 | ||
|
|
9c928bd99b | ||
|
|
801625e311 | ||
|
|
d3327dcd96 | ||
|
|
2ec63b8c97 | ||
|
|
718b33bf51 | ||
|
|
6f36123a95 | ||
|
|
8a8685e5d4 | ||
|
|
4b9c824f8b | ||
|
|
3160146029 | ||
|
|
9b23b4ed54 | ||
|
|
fb6c7bcd30 | ||
|
|
e27ab26c34 | ||
|
|
378d1f6688 | ||
|
|
d2a70ce596 | ||
|
|
d60c54a3d5 | ||
|
|
cfb70dfd09 | ||
|
|
5151de05ef | ||
|
|
fcc3ed0d08 | ||
|
|
3db4cc852d | ||
|
|
3d8c53d6b5 | ||
|
|
116b7211b8 | ||
|
|
a71fa4ae57 | ||
|
|
61328c7e4a | ||
|
|
44550ac828 | ||
|
|
121a199460 | ||
|
|
32a36d690c | ||
|
|
877503d4c8 | ||
|
|
13809eba12 | ||
|
|
41e1245872 | ||
|
|
c185d7f69e | ||
|
|
54f696f68f | ||
|
|
06dd52f251 | ||
|
|
79ef30ea63 | ||
|
|
36b7448087 | ||
|
|
5aac028d65 | ||
|
|
1acf77adc2 | ||
|
|
964c55dda9 | ||
|
|
f39b6dd49d | ||
|
|
37dc6a1146 | ||
|
|
60ed1e1417 | ||
|
|
52cf6c5109 | ||
|
|
8a824e66dc | ||
|
|
4951bc3c00 | ||
|
|
f2b1c97381 | ||
|
|
49d6719456 | ||
|
|
6eabe3a119 | ||
|
|
78d622bb6f | ||
|
|
948602c863 | ||
|
|
71973a2beb | ||
|
|
b4e414b593 | ||
|
|
2aee9fca88 | ||
|
|
3e6b877477 | ||
|
|
8bbb960f22 | ||
|
|
b3cd0e4bd2 | ||
|
|
0b1516adb7 | ||
|
|
3878f9ca1e | ||
|
|
ecf38d7965 | ||
|
|
df5a4187d1 | ||
|
|
990c7bd882 | ||
|
|
46c4442951 | ||
|
|
1e7527758d | ||
|
|
c38310b90a | ||
|
|
d134ae2322 | ||
|
|
ff70119f3d | ||
|
|
580d01bf17 | ||
|
|
c73a88f91c | ||
|
|
154c52cda1 | ||
|
|
991de58fe0 | ||
|
|
f1df107adf | ||
|
|
4fe206d3b0 | ||
|
|
83a347b22f | ||
|
|
1eabd339f5 | ||
|
|
0f4444341f | ||
|
|
ace797d03b | ||
|
|
43e681d7c8 | ||
|
|
e7beb63633 | ||
|
|
eeb0097451 | ||
|
|
7c96931b3d | ||
|
|
b3034f1cec | ||
|
|
1ef3bbd8eb | ||
|
|
3135549440 | ||
|
|
ed2d0da596 | ||
|
|
e9d769022e | ||
|
|
ddbc929ec4 | ||
|
|
b37793d67b | ||
|
|
0b6e0a1dfc | ||
|
|
e1c77451c3 | ||
|
|
38d0ee8832 | ||
|
|
1484ae176d | ||
|
|
6cecf5b864 | ||
|
|
e259e716d5 | ||
|
|
89d2729504 | ||
|
|
85b5b7ec4e | ||
|
|
76ef9e5356 | ||
|
|
0f60ffbab9 | ||
|
|
d345562264 | ||
|
|
5b8bc05149 | ||
|
|
916a3859e0 | ||
|
|
f1599a75d5 | ||
|
|
2246f91be8 | ||
|
|
c1479ad96e | ||
|
|
215665c142 | ||
|
|
c5c85e40ac | ||
|
|
30c5eacd8e | ||
|
|
877218032a | ||
|
|
22449f8dff | ||
|
|
e8b9c17e8c | ||
|
|
d52d214753 | ||
|
|
afe4379a35 | ||
|
|
50242a2a78 | ||
|
|
338302c9da | ||
|
|
86a998bdd4 | ||
|
|
ebe9f6fcc7 | ||
|
|
842bf91740 | ||
|
|
8f87204e04 | ||
|
|
a2db5dc356 | ||
|
|
7c2cb85215 | ||
|
|
cd2b33b349 | ||
|
|
5834089b2b | ||
|
|
14974ef3ee | ||
|
|
78553afdf0 | ||
|
|
664c5af0f9 | ||
|
|
556a874e9a | ||
|
|
4f82eef86f | ||
|
|
c2248ad7b1 | ||
|
|
7d7876e26a | ||
|
|
ab6c9461f8 | ||
|
|
024c685c42 | ||
|
|
90c915992a | ||
|
|
a656bd1bfe | ||
|
|
78c99690a9 | ||
|
|
e12e7329be | ||
|
|
b4103af389 | ||
|
|
74a9061721 | ||
|
|
dfe6f4bc10 | ||
|
|
e28c92027a | ||
|
|
6888af2fe7 | ||
|
|
0db9d1f617 |
10 changed files with 703 additions and 59 deletions
19
.github/workflows/githubci.yml
vendored
19
.github/workflows/githubci.yml
vendored
|
|
@ -9,19 +9,12 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: pre-install
|
||||
run: bash ./actions_install.sh
|
||||
- name: test platforms
|
||||
run: |
|
||||
source install.sh
|
||||
- name: install libraries
|
||||
run: |
|
||||
arduino --install-library "Adafruit BusIO"
|
||||
- name: test platform
|
||||
run: |
|
||||
build_platform esp32
|
||||
build_platform uno
|
||||
build_platform leonardo
|
||||
build_platform zero
|
||||
build_platform esp8266
|
||||
build_platform m4
|
||||
build_platform nrf52840
|
||||
python3 build_platform.py uno leonardo mega2560 zero esp8266 esp32 pico_rp2040
|
||||
|
||||
|
|
|
|||
13
.travis.yml
13
.travis.yml
|
|
@ -1,20 +1,15 @@
|
|||
language: c
|
||||
sudo: false
|
||||
language: python
|
||||
|
||||
dist: focal
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- ~/arduino_ide
|
||||
- ~/.arduino15/packages/
|
||||
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-setuptools
|
||||
|
||||
before_install:
|
||||
- source $TRAVIS_BUILD_DIR/install.sh
|
||||
|
|
|
|||
134
README.md
134
README.md
|
|
@ -1,9 +1,9 @@
|
|||
# Travis CI Arduino Init Script [](https://travis-ci.com/adafruit/travis-ci-arduino)
|
||||
|
||||
The purpose of this repo is to create a centrally managed dependency
|
||||
install script for all Adafruit Arduino Library Travis CI configs.
|
||||
install script for all Adafruit Arduino Library Travis CI and Github Actions configs.
|
||||
This will allow us to easily update the install steps without
|
||||
having to manually or programatically update 100+ `.travis.yml` files.
|
||||
having to manually or programmatically update 100+ `.travis.yml` files.
|
||||
|
||||
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/
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/
|
|||
```
|
||||
|
||||
If you only want to install and build on certain platforms, you can set the
|
||||
`INSTALL_PLATFORMS` envionrment variable to a comma-seperated list of platforms.
|
||||
`INSTALL_PLATFORMS` environment variable to a comma-separated list of platforms.
|
||||
|
||||
**Example `.travis.yml`:**
|
||||
```yaml
|
||||
|
|
@ -30,22 +30,35 @@ cache:
|
|||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty-5.0
|
||||
- key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
packages:
|
||||
- clang-format-5.0
|
||||
env:
|
||||
global:
|
||||
# You can uncomment this to explicitly choose an (old) version of the Arduino IDE
|
||||
#- ARDUINO_IDE_VERSION="1.8.10"
|
||||
# - ARDUINO_IDE_VERSION="1.8.10"
|
||||
- PRETTYNAME="Adafruit FT6206 Arduino Library"
|
||||
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
|
||||
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile
|
||||
|
||||
before_install:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
|
||||
- curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/run-clang-format.py > run-clang-format.py
|
||||
|
||||
install:
|
||||
# Note that every library should be installed in a seperate command
|
||||
- arduino --install-library "Adafruit SleepyDog Library"
|
||||
- arduino --install-library "Adafruit FONA Library"
|
||||
- arduino --install-library "Adafruit ILI9341","Adafruit GFX Library"
|
||||
|
||||
script:
|
||||
- build_main_platforms
|
||||
notifications:
|
||||
email:
|
||||
on_success: change
|
||||
on_failure: change
|
||||
- python run-clang-format.py -r .
|
||||
- build_main_platforms
|
||||
|
||||
# Generate and deploy documentation
|
||||
after_success:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
|
||||
```
|
||||
|
||||
**Choosing Arduino IDE version**
|
||||
|
|
@ -148,3 +161,96 @@ deploy:
|
|||
on:
|
||||
tags: true
|
||||
```
|
||||
|
||||
## Running build_platforms.py locally
|
||||
1. Install arduino-cli from here: https://arduino.github.io/arduino-cli/installation/
|
||||
2. Download ci-arduino
|
||||
* `git clone https://github.com/adafruit/ci-arduino`
|
||||
3. Put these lines at the end of your `.bashrc` or `.bash_profile` if you're on OSX. Make sure to fill in the path to where you installed ci-arduino and replacing USER with your username.
|
||||
```bash
|
||||
alias test-platforms='python3 ~/path/to/ci-arduino/build_platform.py'
|
||||
export HOME=/home/USER/
|
||||
```
|
||||
4. Run this at the top level of the library you want to test
|
||||
```bash
|
||||
adafruit@adafruit:~/Adafruit_BMP183_Library$ export GITHUB_WORKSPACE=$(pwd)
|
||||
```
|
||||
5. Remove everything in test library, and re-create it
|
||||
```bash
|
||||
adafruit@adafruit:~/Adafruit_BMP183_Library$ rm -rf ~/Arduino/libraries/Adafruit_Test_Library/; mkdir ~/Arduino/libraries/Adafruit_Test_Library
|
||||
```
|
||||
6. Still in the top-level directory of the library you'll be testing, copy the current library to Adafruit_Test_Library
|
||||
```bash
|
||||
adafruit@adafruit:~/Adafruit_BMP183_Library$ cp * ~/Arduino/libraries/Adafruit_Test_Library/
|
||||
```
|
||||
7. Grep for build_platform.py in githubci.yml to find out what boards to test.
|
||||
```bash
|
||||
adafruit@adafruit:~/Adafruit_BMP183_Library$ grep 'build_platform.py' .github/workflows/githubci.yml
|
||||
run: python3 ci/build_platform.py main_platforms
|
||||
```
|
||||
8. Run test-platforms. This may take a while, and tests for some boards sometimes run orders of magnitude slower than tests for other boards.
|
||||
```bash
|
||||
test-platforms main_platforms
|
||||
```
|
||||
OR, if githubci.yml specified other boards, let's say the metro m0 and pyportal, you'd run this:
|
||||
```bash
|
||||
test-platforms metro_m0 pyportal
|
||||
```
|
||||
|
||||
Here's what that returns
|
||||
```bash
|
||||
adafruit@adafruit:~/Adafruit_BMP183_Library$ test-platforms main_platforms
|
||||
build dir: /home/dherrada/Adafruit_BMP183_Library
|
||||
|
||||
########################################
|
||||
INSTALLING ARDUINO BOARDS
|
||||
########################################
|
||||
arduino-cli core update-index --additional-urls https://adafruit.github.io/arduino-board-index/package_adafruit_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://dl.espressif.com/dl/package_esp32_index.json,https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json > /dev/null
|
||||
|
||||
Installing Adafruit Unified Sensor
|
||||
arduino-cli lib install "Adafruit Unified Sensor" > /dev/null
|
||||
arduino-cli lib uninstall "Adafruit BMP183 Library"
|
||||
Library Adafruit BMP183 Library is not installed
|
||||
Libraries installed: ['/home/adafruit/Arduino/libraries/Adafruit_VL53L0X', '/home/adafruit/Arduino/libraries/RTClib', '/home/adafruit/Arduino/libraries/Adafruit-RGB-LCD-Shield-Library', '/home/adafruit/Arduino/libraries/readme.txt', '/home/adafruit/Arduino/libraries/Adafruit_Test_Library', '/home/adafruit/Arduino/libraries/Adafruit_Unified_Sensor']
|
||||
elif isinstance(platform, collections.Iterable):
|
||||
################################################################################
|
||||
SWITCHING TO arduino:avr:uno
|
||||
Installing arduino:avr ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO arduino:avr:leonardo
|
||||
Installing arduino:avr ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO arduino:avr:mega:cpu=atmega2560
|
||||
Installing arduino:avr ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO arduino:samd:arduino_zero_native
|
||||
Installing arduino:samd ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
|
||||
Installing esp8266:esp8266 ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO esp32:esp32:featheresp32:FlashFreq=80
|
||||
Installing esp32:esp32 ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO adafruit:samd:adafruit_metro_m4:speed=120
|
||||
Installing adafruit:samd ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
################################################################################
|
||||
SWITCHING TO adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0
|
||||
Installing adafruit:nrf52 ✓
|
||||
################################################################################
|
||||
BMP183test.ino ✓
|
||||
```
|
||||
|
|
|
|||
23
actions_install.sh
Normal file
23
actions_install.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
pip3 install clint pyserial setuptools adafruit-nrfutil
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libllvm8 -V
|
||||
sudo apt install -fy cppcheck clang-format-8
|
||||
if [ ! -f /usr/bin/clang-format ]; then
|
||||
sudo ln -s /usr/bin/clang-format-8 /usr/bin/clang-format
|
||||
fi
|
||||
|
||||
# make all our directories we need for files and libraries
|
||||
mkdir ${HOME}/.arduino15
|
||||
mkdir ${HOME}/.arduino15/packages
|
||||
mkdir ${HOME}/Arduino
|
||||
mkdir ${HOME}/Arduino/libraries
|
||||
|
||||
# install arduino IDE
|
||||
export PATH=$PATH:$GITHUB_WORKSPACE/bin
|
||||
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
|
||||
arduino-cli config init > /dev/null
|
||||
arduino-cli core update-index > /dev/null
|
||||
1
assets/doxygen_badge.svg
Normal file
1
assets/doxygen_badge.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="96" height="20"><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="96" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="59" height="20" fill="#007ec6"/><rect width="96" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">Docs</text><text x="195" y="140" transform="scale(.1)" textLength="270">Docs</text><text x="655" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="490">Doxygen</text><text x="655" y="140" transform="scale(.1)" textLength="490">Doxygen</text></g></svg>
|
||||
|
After Width: | Height: | Size: 970 B |
439
build_platform.py
Normal file
439
build_platform.py
Normal file
|
|
@ -0,0 +1,439 @@
|
|||
import sys
|
||||
import glob
|
||||
import time
|
||||
import os
|
||||
import shutil
|
||||
from distutils.dir_util import copy_tree
|
||||
import subprocess
|
||||
import collections
|
||||
|
||||
# optional wall option cause build failed if has warnings
|
||||
BUILD_WALL = False
|
||||
BUILD_WARN = True
|
||||
if "--wall" in sys.argv:
|
||||
BUILD_WALL = True
|
||||
sys.argv.remove("--wall")
|
||||
|
||||
if "--no_warn" in sys.argv:
|
||||
BUILD_WARN = False
|
||||
sys.argv.remove("--no_warn")
|
||||
|
||||
# add user bin to path!
|
||||
BUILD_DIR = ''
|
||||
# add user bin to path!
|
||||
try:
|
||||
# If we're on actions
|
||||
BUILD_DIR = os.environ["GITHUB_WORKSPACE"]
|
||||
except KeyError:
|
||||
try:
|
||||
# If we're on travis
|
||||
BUILD_DIR = os.environ["TRAVIS_BUILD_DIR"]
|
||||
except KeyError:
|
||||
# If we're running on local machine
|
||||
BUILD_DIR = os.path.abspath(".")
|
||||
pass
|
||||
|
||||
os.environ["PATH"] += os.pathsep + BUILD_DIR + "/bin"
|
||||
print("build dir:", BUILD_DIR)
|
||||
|
||||
IS_LEARNING_SYS = False
|
||||
if "Adafruit_Learning_System_Guides" in BUILD_DIR:
|
||||
print("Found learning system repo")
|
||||
IS_LEARNING_SYS = True
|
||||
os.remove(BUILD_DIR + "/ci/examples/Blink/Blink.ino")
|
||||
os.rmdir(BUILD_DIR + "/ci/examples/Blink")
|
||||
elif "METROX-Examples-and-Project-Sketches" in BUILD_DIR:
|
||||
print("Found MetroX Examples Repo")
|
||||
IS_LEARNING_SYS = True
|
||||
|
||||
#os.system('pwd')
|
||||
#os.system('ls -lA')
|
||||
|
||||
CROSS = u'\N{cross mark}'
|
||||
CHECK = u'\N{check mark}'
|
||||
|
||||
ALL_PLATFORMS={
|
||||
# classic Arduino AVR
|
||||
"uno" : ["arduino:avr:uno", None],
|
||||
"leonardo" : ["arduino:avr:leonardo", None],
|
||||
"mega2560" : ["arduino:avr:mega:cpu=atmega2560", None],
|
||||
# Arduino SAMD
|
||||
"zero" : ["arduino:samd:arduino_zero_native", "0x68ed2b88"],
|
||||
"cpx" : ["arduino:samd:adafruit_circuitplayground_m0", "0x68ed2b88"],
|
||||
# Espressif
|
||||
"esp8266" : ["esp8266:esp8266:huzzah:eesz=4M3M,xtal=80", None],
|
||||
"esp32" : ["esp32:esp32:featheresp32:FlashFreq=80", None],
|
||||
"magtag" : ["esp32:esp32:adafruit_magtag29_esp32s2", "0xbfdd4eee"],
|
||||
"funhouse" : ["esp32:esp32:adafruit_funhouse_esp32s2", "0xbfdd4eee"],
|
||||
"metroesp32s2" : ["esp32:esp32:adafruit_metro_esp32s2", "0xbfdd4eee"],
|
||||
"qtpy_esp32s2" : ["esp32:esp32:adafruit_qtpy_esp32s2", "0xbfdd4eee"],
|
||||
"feather_esp32s2" : ["esp32:esp32:adafruit_feather_esp32s2", "0xbfdd4eee"],
|
||||
"feather_esp32s2_tft" : ["esp32:esp32:adafruit_feather_esp32s2_tft", "0xbfdd4eee"],
|
||||
# Adafruit AVR
|
||||
"trinket_3v" : ["adafruit:avr:trinket3", None],
|
||||
"trinket_5v" : ["adafruit:avr:trinket5", None],
|
||||
"protrinket_3v" : ["adafruit:avr:protrinket3", None],
|
||||
"protrinket_5v" : ["adafruit:avr:protrinket5", None],
|
||||
"gemma" : ["adafruit:avr:gemma", None],
|
||||
"flora" : ["adafruit:avr:flora8", None],
|
||||
"feather32u4" : ["adafruit:avr:feather32u4", None],
|
||||
"cpc" : ["arduino:avr:circuitplay32u4cat", None],
|
||||
# Adafruit SAMD
|
||||
"gemma_m0" : ["adafruit:samd:adafruit_gemma_m0", "0x68ed2b88"],
|
||||
"trinket_m0" : ["adafruit:samd:adafruit_trinket_m0", "0x68ed2b88"],
|
||||
"feather_m0_express" : ["adafruit:samd:adafruit_feather_m0_express", "0x68ed2b88"],
|
||||
"feather_m4_express" : ["adafruit:samd:adafruit_feather_m4:speed=120", "0x68ed2b88"],
|
||||
"feather_m4_express_tinyusb" : ["adafruit:samd:adafruit_feather_m4:speed=120,usbstack=tinyusb", "0x68ed2b88"],
|
||||
"feather_m4_can" : ["adafruit:samd:adafruit_feather_m4_can:speed=120", "0x68ed2b88"],
|
||||
"feather_m4_can_tinyusb" : ["adafruit:samd:adafruit_feather_m4_can:speed=120,usbstack=tinyusb", "0x68ed2b88"],
|
||||
"metro_m0" : ["adafruit:samd:adafruit_metro_m0", "0x68ed2b88"],
|
||||
"metro_m0_tinyusb" : ["adafruit:samd:adafruit_metro_m0:usbstack=tinyusb", "0x68ed2b88"],
|
||||
"metro_m4" : ["adafruit:samd:adafruit_metro_m4:speed=120", "0x55114460"],
|
||||
"metro_m4_tinyusb" : ["adafruit:samd:adafruit_metro_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"metro_m4_airliftlite" : ["adafruit:samd:adafruit_metro_m4_airliftlite:speed=120", "0x55114460"],
|
||||
"metro_m4_airliftlite_tinyusb" : ["adafruit:samd:adafruit_metro_m4_airliftlite:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"pybadge" : ["adafruit:samd:adafruit_pybadge_m4:speed=120", "0x55114460"],
|
||||
"pybadge_tinyusb" : ["adafruit:samd:adafruit_pybadge_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"pygamer" : ["adafruit:samd:adafruit_pygamer_m4:speed=120", "0x55114460"],
|
||||
"pygamer_tinyusb" : ["adafruit:samd:adafruit_pygamer_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"hallowing_m0" : ["adafruit:samd:adafruit_hallowing", "0x68ed2b88"],
|
||||
"hallowing_m4" : ["adafruit:samd:adafruit_hallowing_m4:speed=120", "0x55114460"],
|
||||
"hallowing_m4_tinyusb" : ["adafruit:samd:adafruit_hallowing_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"neotrellis_m4" : ["adafruit:samd:adafruit_trellis_m4:speed=120", "0x55114460"],
|
||||
"monster_m4sk" : ["adafruit:samd:adafruit_monster_m4sk:speed=120", "0x55114460"],
|
||||
"monster_m4sk_tinyusb" : ["adafruit:samd:adafruit_monster_m4sk:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"pyportal" : ["adafruit:samd:adafruit_pyportal_m4:speed=120", "0x55114460"],
|
||||
"pyportal_tinyusb" : ["adafruit:samd:adafruit_pyportal_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"pyportal_titano" : ["adafruit:samd:adafruit_pyportal_m4_titano:speed=120", "0x55114460"],
|
||||
"pyportal_titano_tinyusb" : ["adafruit:samd:adafruit_pyportal_m4_titano:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"cpx_ada" : ["adafruit:samd:adafruit_circuitplayground_m0", "0x68ed2b88"],
|
||||
"grand_central" : ["adafruit:samd:adafruit_grandcentral_m4:speed=120", "0x55114460"],
|
||||
"grand_central_tinyusb" : ["adafruit:samd:adafruit_grandcentral_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"matrixportal" : ["adafruit:samd:adafruit_matrixportal_m4:speed=120", "0x55114460"],
|
||||
"matrixportal_tinyusb" : ["adafruit:samd:adafruit_matrixportal_m4:speed=120,usbstack=tinyusb", "0x55114460"],
|
||||
"neotrinkey_m0" : ["adafruit:samd:adafruit_neotrinkey_m0", "0x68ed2b88"],
|
||||
"rotarytrinkey_m0" : ["adafruit:samd:adafruit_rotarytrinkey_m0", "0x68ed2b88"],
|
||||
"neokeytrinkey_m0" : ["adafruit:samd:adafruit_neokeytrinkey_m0", "0x68ed2b88"],
|
||||
"slidetrinkey_m0" : ["adafruit:samd:adafruit_slidetrinkey_m0", "0x68ed2b88"],
|
||||
"proxlighttrinkey_m0" : ["adafruit:samd:adafruit_proxlighttrinkey_m0", "0x68ed2b88"],
|
||||
"qtpy_m0" : ["adafruit:samd:adafruit_qtpy_m0", "0x68ed2b88"],
|
||||
"qtpy_m0_tinyusb" : ["adafruit:samd:adafruit_qtpy_m0:usbstack=tinyusb", "0x68ed2b88"],
|
||||
# Arduino nRF
|
||||
"microbit" : ["sandeepmistry:nRF5:BBCmicrobit:softdevice=s110", None],
|
||||
# Adafruit nRF
|
||||
"nrf52832" : ["adafruit:nrf52:feather52832:softdevice=s132v6,debug=l0", None],
|
||||
"nrf52840" : ["adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0", "0xada52840"],
|
||||
"cpb" : ["adafruit:nrf52:cplaynrf52840:softdevice=s140v6,debug=l0", "0xada52840"],
|
||||
"clue" : ["adafruit:nrf52:cluenrf52840:softdevice=s140v6,debug=l0", "0xada52840"],
|
||||
"ledglasses_nrf52840" : ["adafruit:nrf52:ledglasses_nrf52840:softdevice=s140v6,debug=l0", "0xada52840"],
|
||||
# RP2040 (Philhower)
|
||||
"pico_rp2040" : ["rp2040:rp2040:rpipico:freq=125,flash=2097152_0", "0xe48bff56"],
|
||||
"pico_rp2040_tinyusb" : ["rp2040:rp2040:rpipico:flash=2097152_0,freq=125,dbgport=Disabled,dbglvl=None,usbstack=tinyusb", "0xe48bff56"],
|
||||
"feather_rp2040" : ["rp2040:rp2040:adafruit_feather:freq=125,flash=8388608_0", "0xe48bff56"],
|
||||
"feather_rp2040_tinyusb" : ["rp2040:rp2040:adafruit_feather:flash=8388608_0,freq=125,dbgport=Disabled,dbglvl=None,usbstack=tinyusb", "0xe48bff56"],
|
||||
"qt2040_trinkey" : ["rp2040:rp2040:adafruit_trinkeyrp2040qt:freq=125,flash=8388608_0", "0xe48bff56"],
|
||||
"qt2040_trinkey_tinyusb" : ["rp2040:rp2040:adafruit_trinkeyrp2040qt:flash=8388608_0,freq=125,dbgport=Disabled,dbglvl=None,usbstack=tinyusb", "0xe48bff56"],
|
||||
# Attiny8xy, 16xy, 32xy (SpenceKonde)
|
||||
"attiny3217" : ["megaTinyCore:megaavr:atxy7:chip=3217", None],
|
||||
"attiny3216" : ["megaTinyCore:megaavr:atxy6:chip=3216", None],
|
||||
"attiny1617" : ["megaTinyCore:megaavr:atxy7:chip=1617", None],
|
||||
"attiny1616" : ["megaTinyCore:megaavr:atxy6:chip=1616", None],
|
||||
"attiny1607" : ["megaTinyCore:megaavr:atxy7:chip=1607", None],
|
||||
"attiny1606" : ["megaTinyCore:megaavr:atxy6:chip=1606", None],
|
||||
"attiny817" : ["megaTinyCore:megaavr:atxy7:chip=817", None],
|
||||
"attiny816" : ["megaTinyCore:megaavr:atxy6:chip=816", None],
|
||||
"attiny807" : ["megaTinyCore:megaavr:atxy7:chip=807", None],
|
||||
"attiny806" : ["megaTinyCore:megaavr:atxy6:chip=806", None],
|
||||
# groupings
|
||||
"main_platforms" : ("uno", "leonardo", "mega2560", "zero", "qtpy_m0",
|
||||
"esp8266", "esp32", "metro_m4", "trinket_m0"),
|
||||
"arcada_platforms" : ("pybadge", "pygamer", "hallowing_m4",
|
||||
"cpb", "cpx_ada"),
|
||||
"wippersnapper_platforms" : ("metro_m4_airliftlite_tinyusb", "pyportal_tinyusb"),
|
||||
"rp2040_platforms" : ("pico_rp2040", "feather_rp2040")
|
||||
}
|
||||
|
||||
BSP_URLS = "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json,https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json,http://drazzy.com/package_drazzy.com_index.json"
|
||||
|
||||
class ColorPrint:
|
||||
|
||||
@staticmethod
|
||||
def print_fail(message, end = '\n'):
|
||||
sys.stdout.write('\x1b[1;31m' + message.strip() + '\x1b[0m' + end)
|
||||
|
||||
@staticmethod
|
||||
def print_pass(message, end = '\n'):
|
||||
sys.stdout.write('\x1b[1;32m' + message.strip() + '\x1b[0m' + end)
|
||||
|
||||
@staticmethod
|
||||
def print_warn(message, end = '\n'):
|
||||
sys.stdout.write('\x1b[1;33m' + message.strip() + '\x1b[0m' + end)
|
||||
|
||||
@staticmethod
|
||||
def print_info(message, end = '\n'):
|
||||
sys.stdout.write('\x1b[1;34m' + message.strip() + '\x1b[0m' + end)
|
||||
|
||||
@staticmethod
|
||||
def print_bold(message, end = '\n'):
|
||||
sys.stdout.write('\x1b[1;37m' + message.strip() + '\x1b[0m' + end)
|
||||
|
||||
|
||||
def install_platform(platform):
|
||||
print("Installing", platform, end=" ")
|
||||
if platform == "adafruit:avr": # we have a platform dep
|
||||
install_platform("arduino:avr")
|
||||
if os.system("arduino-cli core install "+platform+" --additional-urls "+BSP_URLS+" > /dev/null") != 0:
|
||||
ColorPrint.print_fail("FAILED to install "+platform)
|
||||
exit(-1)
|
||||
ColorPrint.print_pass(CHECK)
|
||||
# print installed core version
|
||||
print(os.popen('arduino-cli core list | grep {}'.format(platform)).read(), end='')
|
||||
|
||||
def run_or_die(cmd, error):
|
||||
print(cmd)
|
||||
attempt = 0
|
||||
while attempt < 3:
|
||||
if os.system(cmd) == 0:
|
||||
return
|
||||
attempt += 1
|
||||
print('attempt {} failed, {} retry left'.format(attempt, 3-attempt))
|
||||
time.sleep(5)
|
||||
ColorPrint.print_fail(error)
|
||||
exit(-1)
|
||||
|
||||
################################ Install Arduino IDE
|
||||
print()
|
||||
ColorPrint.print_info('#'*40)
|
||||
print("INSTALLING ARDUINO BOARDS")
|
||||
ColorPrint.print_info('#'*40)
|
||||
|
||||
run_or_die("arduino-cli core update-index --additional-urls "+BSP_URLS+
|
||||
" > /dev/null", "FAILED to update core indices")
|
||||
print()
|
||||
|
||||
################################ Install dependencies
|
||||
our_name=None
|
||||
try:
|
||||
if IS_LEARNING_SYS:
|
||||
libprop = open(BUILD_DIR+'/library.deps')
|
||||
else:
|
||||
libprop = open(BUILD_DIR+'/library.properties')
|
||||
for line in libprop:
|
||||
if line.startswith("name="):
|
||||
our_name = line.replace("name=", "").strip()
|
||||
if line.startswith("depends="):
|
||||
deps = line.replace("depends=", "").split(",")
|
||||
for dep in deps:
|
||||
dep = dep.strip()
|
||||
print("Installing "+dep)
|
||||
run_or_die('arduino-cli lib install "'+dep+'" > /dev/null',
|
||||
"FAILED to install dependency "+dep)
|
||||
except OSError:
|
||||
print("No library dep or properties found!")
|
||||
pass # no library properties
|
||||
|
||||
# Delete the existing library if we somehow downloaded
|
||||
# due to dependencies
|
||||
if our_name:
|
||||
run_or_die("arduino-cli lib uninstall \""+our_name+"\"", "Could not uninstall")
|
||||
|
||||
print("Libraries installed: ", glob.glob(os.environ['HOME']+'/Arduino/libraries/*'))
|
||||
|
||||
# link our library folder to the arduino libraries folder
|
||||
if not IS_LEARNING_SYS:
|
||||
try:
|
||||
os.symlink(BUILD_DIR, os.environ['HOME']+'/Arduino/libraries/' + os.path.basename(BUILD_DIR))
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
################################ UF2 Utils.
|
||||
|
||||
def glob1(pattern):
|
||||
result = glob.glob(pattern)
|
||||
if len(result) != 1:
|
||||
raise RuntimeError(f"Required pattern {pattern} to match exactly 1 file, got {result}")
|
||||
return result[0]
|
||||
|
||||
def download_uf2_utils():
|
||||
"""Downloads uf2conv tools if we don't already have them
|
||||
"""
|
||||
cmd = "wget -nc --no-check-certificate http://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2families.json https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2conv.py"
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
r = proc.wait(timeout=60)
|
||||
out = proc.stdout.read()
|
||||
err = proc.stderr.read()
|
||||
if r != 0:
|
||||
ColorPrint.print_fail("Failed to download UF2 Utils!")
|
||||
ColorPrint.print_fail(out.decode("utf-8"))
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
return False
|
||||
return True
|
||||
|
||||
def generate_uf2(example_path):
|
||||
"""Generates a .uf2 file from a .bin or .hex file.
|
||||
:param str example_path: A path to the compiled .bin or .hex file.
|
||||
|
||||
"""
|
||||
if not download_uf2_utils():
|
||||
return None
|
||||
cli_build_path = "build/*.*." + fqbn.split(':')[2] + "/*.hex"
|
||||
input_file = glob1(os.path.join(example_path, cli_build_path))
|
||||
output_file = os.path.splitext(input_file)[0] + ".uf2"
|
||||
family_id = ALL_PLATFORMS[platform][1]
|
||||
cmd = ['python3', 'uf2conv.py', input_file, '-c', '-f', family_id, '-o', output_file]
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
r = proc.wait(timeout=60)
|
||||
out = proc.stdout.read()
|
||||
err = proc.stderr.read()
|
||||
if r == 0 and not err:
|
||||
ColorPrint.print_pass(CHECK)
|
||||
ColorPrint.print_info(out.decode("utf-8"))
|
||||
else:
|
||||
ColorPrint.print_fail(CROSS)
|
||||
ColorPrint.print_fail(out.decode("utf-8"))
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
return None
|
||||
return output_file
|
||||
|
||||
################################ Test platforms
|
||||
platforms = []
|
||||
success = 0
|
||||
|
||||
# expand groups:
|
||||
for arg in sys.argv[1:]:
|
||||
platform = ALL_PLATFORMS.get(arg, None)
|
||||
if isinstance(platform, list):
|
||||
platforms.append(arg)
|
||||
elif isinstance(platform, tuple):
|
||||
for p in platform:
|
||||
platforms.append(p)
|
||||
else:
|
||||
print("Unknown platform: ", arg)
|
||||
exit(-1)
|
||||
|
||||
def test_examples_in_folder(folderpath):
|
||||
global success
|
||||
for example in sorted(os.listdir(folderpath)):
|
||||
examplepath = folderpath+"/"+example
|
||||
if os.path.isdir(examplepath):
|
||||
test_examples_in_folder(examplepath)
|
||||
continue
|
||||
if not examplepath.endswith(".ino"):
|
||||
continue
|
||||
|
||||
print('\t'+example, end=' ')
|
||||
# check if we should SKIP
|
||||
skipfilename = folderpath+"/."+platform+".test.skip"
|
||||
onlyfilename = folderpath+"/."+platform+".test.only"
|
||||
# check if we should GENERATE UF2
|
||||
gen_file_name = folderpath+"/."+platform+".generate"
|
||||
if os.path.exists(skipfilename):
|
||||
ColorPrint.print_warn("skipping")
|
||||
continue
|
||||
if glob.glob(folderpath+"/.*.test.only"):
|
||||
platformname = glob.glob(folderpath+"/.*.test.only")[0].split('.')[1]
|
||||
if platformname != "none" and not platformname in ALL_PLATFORMS:
|
||||
# uh oh, this isnt a valid testonly!
|
||||
ColorPrint.print_fail(CROSS)
|
||||
ColorPrint.print_fail("This example does not have a valid .platform.test.only file")
|
||||
success = 1
|
||||
continue
|
||||
if not os.path.exists(onlyfilename):
|
||||
ColorPrint.print_warn("skipping")
|
||||
continue
|
||||
if os.path.exists(gen_file_name):
|
||||
ColorPrint.print_info("generating")
|
||||
|
||||
if BUILD_WARN:
|
||||
if os.path.exists(gen_file_name):
|
||||
cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, '-e', folderpath]
|
||||
else:
|
||||
cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, folderpath]
|
||||
else:
|
||||
cmd = ['arduino-cli', 'compile', '--warnings', 'none', '--export-binaries', '--fqbn', fqbn, folderpath]
|
||||
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
try:
|
||||
out, err = proc.communicate(timeout=60)
|
||||
r = proc.returncode
|
||||
except:
|
||||
proc.kill()
|
||||
out, err = proc.communicate()
|
||||
r = 1
|
||||
|
||||
if r == 0 and not (err and BUILD_WALL == True):
|
||||
ColorPrint.print_pass(CHECK)
|
||||
if err:
|
||||
# also print out warning message
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
if os.path.exists(gen_file_name):
|
||||
if ALL_PLATFORMS[platform][1] == None:
|
||||
ColorPrint.print_info("Platform does not support UF2 files, skipping...")
|
||||
else:
|
||||
ColorPrint.print_info("Generating UF2...")
|
||||
filename = generate_uf2(folderpath)
|
||||
if filename is None:
|
||||
success = 1 # failure
|
||||
if IS_LEARNING_SYS:
|
||||
fqbnpath, uf2file = filename.split("/")[-2:]
|
||||
os.makedirs(BUILD_DIR+"/build", exist_ok=True)
|
||||
os.makedirs(BUILD_DIR+"/build/"+fqbnpath, exist_ok=True)
|
||||
shutil.copy(filename, BUILD_DIR+"/build/"+fqbnpath+"-"+uf2file)
|
||||
os.system("ls -lR "+BUILD_DIR+"/build")
|
||||
else:
|
||||
ColorPrint.print_fail(CROSS)
|
||||
ColorPrint.print_fail(out.decode("utf-8"))
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
success = 1
|
||||
|
||||
def test_examples_in_learningrepo(folderpath):
|
||||
global success
|
||||
for project in os.listdir(folderpath):
|
||||
projectpath = folderpath+"/"+project
|
||||
if os.path.isdir(learningrepo):
|
||||
test_examples_in_learningrepo(projectpath)
|
||||
continue
|
||||
if not projectpath.endswith(".ino"):
|
||||
continue
|
||||
# found an INO!
|
||||
print('\t'+projectpath, end=' ', flush=True)
|
||||
# check if we should SKIP
|
||||
skipfilename = folderpath+"/."+platform+".test.skip"
|
||||
onlyfilename = folderpath+"/."+platform+".test.only"
|
||||
if os.path.exists(skipfilename):
|
||||
ColorPrint.print_warn("skipping")
|
||||
continue
|
||||
elif glob.glob(folderpath+"/.*.test.only") and not os.path.exists(onlyfilename):
|
||||
ColorPrint.print_warn("skipping")
|
||||
continue
|
||||
|
||||
cmd = ['arduino-cli', 'compile', '--warnings', 'all', '--fqbn', fqbn, projectpath]
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
r = proc.wait()
|
||||
out = proc.stdout.read()
|
||||
err = proc.stderr.read()
|
||||
if r == 0:
|
||||
ColorPrint.print_pass(CHECK)
|
||||
if err:
|
||||
# also print out warning message
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
else:
|
||||
ColorPrint.print_fail(CROSS)
|
||||
ColorPrint.print_fail(out.decode("utf-8"))
|
||||
ColorPrint.print_fail(err.decode("utf-8"))
|
||||
success = 1
|
||||
|
||||
|
||||
for platform in platforms:
|
||||
fqbn = ALL_PLATFORMS[platform][0]
|
||||
print('#'*80)
|
||||
ColorPrint.print_info("SWITCHING TO "+fqbn)
|
||||
install_platform(":".join(fqbn.split(':', 2)[0:2])) # take only first two elements
|
||||
print('#'*80)
|
||||
if not IS_LEARNING_SYS:
|
||||
test_examples_in_folder(BUILD_DIR+"/examples")
|
||||
else:
|
||||
test_examples_in_folder(BUILD_DIR)
|
||||
exit(success)
|
||||
|
|
@ -38,7 +38,29 @@ echo 'Setting up the script...'
|
|||
# Exit with nonzero exit code if anything fails
|
||||
set -e
|
||||
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
export IS_PULL=0
|
||||
|
||||
if [[ -z "${TRAVIS_BUILD_DIR}" ]]; then
|
||||
export BUILD_DIR=${GITHUB_WORKSPACE}
|
||||
export AUTH=${GITHUB_ACTOR}:${GH_REPO_TOKEN}
|
||||
export REPO_SLUG=${GITHUB_REPOSITORY}
|
||||
export COMMIT_SHA1=${GITHUB_SHA}
|
||||
export BUILD_ID="GitHub Actions run: ${GITHUB_RUN_ID}"
|
||||
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
|
||||
export IS_PULL=1
|
||||
fi
|
||||
else
|
||||
export BUILD_DIR=${TRAVIS_BUILD_DIR}
|
||||
export AUTH=${GH_REPO_TOKEN}
|
||||
export REPO_SLUG=${TRAVIS_REPO_SLUG}
|
||||
export COMMIT_SHA1=${TRAVIS_COMMIT}
|
||||
export BUILD_ID="Travis build: ${TRAVIS_BUILD_NUMBER}"
|
||||
if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
||||
export IS_PULL=1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $BUILD_DIR
|
||||
|
||||
# The default version of doxygen is too old so we'll use a modern version
|
||||
wget -q https://cdn-learn.adafruit.com/assets/assets/000/067/405/original/doxygen-1.8.13.linux.bin.tar.gz
|
||||
|
|
@ -51,16 +73,16 @@ mkdir code_docs
|
|||
cd code_docs
|
||||
|
||||
# Get the current gh-pages branch
|
||||
git clone -b gh-pages https://github.com/${TRAVIS_REPO_SLUG}.git
|
||||
export TRAVIS_REPO_NAME=${TRAVIS_REPO_SLUG#*/}
|
||||
cd ${TRAVIS_REPO_NAME}
|
||||
git clone -b gh-pages https://github.com/${REPO_SLUG}.git
|
||||
export REPO_NAME=${REPO_SLUG#*/}
|
||||
cd ${REPO_NAME}
|
||||
|
||||
##### Configure git.
|
||||
# Set the push default to simple i.e. push only the current branch.
|
||||
git config --global push.default simple
|
||||
# Pretend to be an user called Travis CI.
|
||||
git config user.name "Travis CI"
|
||||
git config user.email "travis@travis-ci.org"
|
||||
# Pretend to be an user called Doxygen CI.
|
||||
git config user.name "Doxygen CI"
|
||||
git config user.email "ci-arduino@invalid"
|
||||
|
||||
# Remove everything currently in the gh-pages branch.
|
||||
# GitHub is smart enough to know which files have changed and which files have
|
||||
|
|
@ -88,9 +110,9 @@ echo "" > .nojekyll
|
|||
echo 'Generating Doxygen code documentation...'
|
||||
# Redirect both stderr and stdout to the log file AND the console.
|
||||
|
||||
if [ ! -f "$DOXYFILE" ]; then
|
||||
export DOXYFILE=${BUILD_DIR}/Doxyfile
|
||||
if [ ! -f ${DOXYFILE} ]; then
|
||||
echo "Grabbing default Doxyfile"
|
||||
export DOXYFILE=${TRAVIS_BUILD_DIR}/Doxyfile
|
||||
|
||||
curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/Doxyfile.default > ${DOXYFILE}
|
||||
#sed -i "s/^INPUT .*/INPUT = ..\/../" ${DOXYFILE}
|
||||
|
|
@ -101,11 +123,17 @@ if [ ! -f "$DOXYFILE" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
sed -i "s;^HTML_OUTPUT .*;HTML_OUTPUT = code_docs/${TRAVIS_REPO_NAME}/html;" ${DOXYFILE}
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
sed -i "s;^HTML_OUTPUT .*;HTML_OUTPUT = code_docs/${REPO_NAME}/html;" ${DOXYFILE}
|
||||
cd $BUILD_DIR
|
||||
|
||||
# Print out doxygen warnings in red
|
||||
${TRAVIS_BUILD_DIR}/doxygen $DOXYFILE 2>&1 | tee foo.txt > >(while read line; do echo -e "\e[01;31m$line\e[0m" >&2; done)
|
||||
if [ ! -z $1 ]
|
||||
then
|
||||
# Print out doxygen warnings in red, use specified path (for when everything is in src)
|
||||
( cat $DOXYFILE; echo "INPUT=${BUILD_DIR}/$1" ) | ${BUILD_DIR}/doxygen - 2>&1 | tee foo.txt > >(while read line; do echo -e "\e[01;31m$line\e[0m" >&2; done)
|
||||
else
|
||||
# Print out doxygen warnings in red, use default path
|
||||
${BUILD_DIR}/doxygen $DOXYFILE 2>&1 | tee foo.txt > >(while read line; do echo -e "\e[01;31m$line\e[0m" >&2; done)
|
||||
fi
|
||||
|
||||
# if any warnings, bail!
|
||||
if [ -s foo.txt ]; then exit 1 ; fi
|
||||
|
|
@ -113,14 +141,14 @@ if [ -s foo.txt ]; then exit 1 ; fi
|
|||
rm foo.txt
|
||||
|
||||
# If we're a pull request, don't push docs to github!
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
if [ ${IS_PULL} == 1 ]; then
|
||||
echo "This is a Pull Request, we're done!"
|
||||
exit 0
|
||||
else
|
||||
echo "This is a Commit, Uploading documentation..."
|
||||
fi
|
||||
|
||||
cd code_docs/${TRAVIS_REPO_NAME}
|
||||
cd code_docs/${REPO_NAME}
|
||||
|
||||
################################################################################
|
||||
##### Upload the documentation to the gh-pages branch of the repository. #####
|
||||
|
|
@ -147,13 +175,15 @@ if [ -d "html" ] && [ -f "html/index.html" ]; then
|
|||
# Commit the added files with a title and description containing the Travis CI
|
||||
# build number and the GitHub commit reference that issued this build.
|
||||
echo 'Git committing'
|
||||
git commit -m "Deploy code docs to GitHub Pages Travis build: ${TRAVIS_BUILD_NUMBER}" -m "Commit: ${TRAVIS_COMMIT}"
|
||||
git commit \
|
||||
-m "Deploy docs to GitHub Pages from commit ${COMMIT_SHA1:0:10}" \
|
||||
-m "Commit: ${COMMIT_SHA1}"$'\n'"${BUILD_ID}"
|
||||
|
||||
# Force push to the remote gh-pages branch.
|
||||
# The ouput is redirected to /dev/null to hide any sensitive credential data
|
||||
# The output is redirected to /dev/null to hide any sensitive credential data
|
||||
# that might otherwise be exposed.
|
||||
echo 'Git pushing'
|
||||
git push --force "https://${GH_REPO_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" > /dev/null 2>&1
|
||||
git push --force "https://${AUTH}@github.com/${REPO_SLUG}.git" > /dev/null 2>&1
|
||||
else
|
||||
echo '' >&2
|
||||
echo 'Warning: No documentation (html) files have been found!' >&2
|
||||
|
|
|
|||
32
example_actions.yml
Normal file
32
example_actions.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
name: Arduino Library CI
|
||||
|
||||
on: [pull_request, push, repository_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
||||
- name: pre-install
|
||||
run: bash ci/actions_install.sh
|
||||
|
||||
- name: test platforms
|
||||
run: python3 ci/build_platform.py main_platforms
|
||||
|
||||
- name: clang
|
||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
||||
|
||||
- name: doxygen
|
||||
env:
|
||||
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
|
||||
PRETTYNAME : "Adafruit Arduino Library"
|
||||
run: bash ci/doxy_gen_and_deploy.sh
|
||||
|
|
@ -13,6 +13,8 @@ addons:
|
|||
- llvm-toolchain-trusty-5.0
|
||||
- key_url: 'http://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
packages:
|
||||
- python3-pip
|
||||
- python3-wheel
|
||||
- clang-format-5.0
|
||||
env:
|
||||
global:
|
||||
|
|
|
|||
33
install.sh
Normal file → Executable file
33
install.sh
Normal file → Executable file
|
|
@ -19,7 +19,7 @@ export CPLAY_PLATFORMS='declare -A cplay_platforms=( [cplayClassic]="arduino:avr
|
|||
|
||||
export SAMD_PLATFORMS='declare -A samd_platforms=( [zero]="arduino:samd:arduino_zero_native", [cplayExpress]="arduino:samd:adafruit_circuitplayground_m0", [m4]="adafruit:samd:adafruit_metro_m4:speed=120" )'
|
||||
|
||||
export M4_PLATFORMS='declare -A m4_platforms=( [m4]="adafruit:samd:adafruit_metro_m4:speed=120", [trellis_m4]="adafruit:samd:adafruit_trellis_m4:speed=120" )'
|
||||
export M4_PLATFORMS='declare -A m4_platforms=( [m4]="adafruit:samd:adafruit_metro_m4:speed=120", [trellis_m4]="adafruit:samd:adafruit_trellis_m4:speed=120", [grand_central_m4]="adafruit:samd:adafruit_grand_central_m4:speed=120" )'
|
||||
|
||||
export ARCADA_PLATFORMS='declare -A arcada_platforms=( [pybadge]="adafruit:samd:adafruit_pybadge_m4:speed=120", [pygamer]="adafruit:samd:adafruit_pygamer_m4:speed=120", [hallowing_m4]="adafruit:samd:adafruit_hallowing_m4:speed=120", [cplayExpressAda]="adafruit:samd:adafruit_circuitplayground_m0" )'
|
||||
|
||||
|
|
@ -32,6 +32,8 @@ export NRF5X_PLATFORMS='declare -A nrf5x_platforms=( [nrf52840]="adafruit:nrf52:
|
|||
sleep 3
|
||||
export DISPLAY=:1.0
|
||||
|
||||
#This condition is to avoid reruning install when build argument is passed
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
# define colors
|
||||
GRAY='\033[1;30m'; RED='\033[0;31m'; LRED='\033[1;31m'; GREEN='\033[0;32m'; LGREEN='\033[1;32m'; ORANGE='\033[0;33m'; YELLOW='\033[1;33m'; BLUE='\033[0;34m'; LBLUE='\033[1;34m'; PURPLE='\033[0;35m'; LPURPLE='\033[1;35m'; CYAN='\033[0;36m'; LCYAN='\033[1;36m'; LGRAY='\033[0;37m'; WHITE='\033[1;37m';
|
||||
|
||||
|
|
@ -41,7 +43,7 @@ echo "########################################################################";
|
|||
|
||||
# if .travis.yml does not set version
|
||||
if [ -z $ARDUINO_IDE_VERSION ]; then
|
||||
export ARDUINO_IDE_VERSION="1.8.10"
|
||||
export ARDUINO_IDE_VERSION="1.8.11"
|
||||
echo "NOTE: YOUR .TRAVIS.YML DOES NOT SPECIFY ARDUINO IDE VERSION, USING $ARDUINO_IDE_VERSION"
|
||||
fi
|
||||
|
||||
|
|
@ -72,7 +74,7 @@ echo -e """$GREEN""\xe2\x9c\x93"
|
|||
fi
|
||||
|
||||
# define output directory for .hex files
|
||||
export ARDUINO_HEX_DIR=$HOME/compiled_arduino_sketches/arduino_build_$TRAVIS_BUILD_NUMBER
|
||||
export ARDUINO_HEX_DIR=arduino_build_$TRAVIS_BUILD_NUMBER
|
||||
|
||||
# link test library folder to the arduino libraries folder
|
||||
ln -s $TRAVIS_BUILD_DIR $HOME/arduino_ide/libraries/Adafruit_Test_Library
|
||||
|
|
@ -84,6 +86,8 @@ echo -e "\n#####################################################################
|
|||
echo -e "${YELLOW}INSTALLING DEPENDENCIES"
|
||||
echo "########################################################################";
|
||||
|
||||
# install dependancy libraries in library.properties
|
||||
grep "depends=" $HOME/arduino_ide/libraries/Adafruit_Test_Library/library.properties | sed 's/depends=//' | sed -n 1'p' | tr ',' '\n' | while read word; do arduino --install-library "$word"; done
|
||||
|
||||
# install the zero, esp8266, and adafruit board packages
|
||||
echo -n "ADD PACKAGE INDEX: "
|
||||
|
|
@ -105,6 +109,7 @@ INSTALL_NRF52=$([[ $INSTALL_PLATFORMS == *"nrf52"* || -z "$INSTALL_PLATFORMS" ]]
|
|||
|
||||
if [[ $INSTALL_ESP32 == 1 ]]; then
|
||||
echo -n "ESP32: "
|
||||
pip install pyserial
|
||||
DEPENDENCY_OUTPUT=$(arduino --install-boards esp32:esp32 2>&1)
|
||||
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
|
||||
fi
|
||||
|
|
@ -135,7 +140,10 @@ fi
|
|||
|
||||
if [[ $INSTALL_NRF52 == 1 ]]; then
|
||||
echo -n "ADAFRUIT NRF5X: "
|
||||
pip3 install --user adafruit-nrfutil
|
||||
pip install wheel
|
||||
pip install setuptools
|
||||
pip install adafruit-nrfutil
|
||||
pip install pyserial
|
||||
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:nrf52 2>&1)
|
||||
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
|
||||
fi
|
||||
|
|
@ -159,8 +167,10 @@ export PASS_COUNT=0
|
|||
export SKIP_COUNT=0
|
||||
export FAIL_COUNT=0
|
||||
export PDE_COUNT=0
|
||||
|
||||
# close if [[ $# -eq 0 ]] ; then
|
||||
fi
|
||||
# build all of the examples for the passed platform
|
||||
#Sourcing and defining functions
|
||||
function build_platform()
|
||||
{
|
||||
|
||||
|
|
@ -851,3 +861,16 @@ function json_main_platforms()
|
|||
echo -e "||||||||||||||||||||||||||||| JSON STATUS ||||||||||||||||||||||||||||||\n"
|
||||
|
||||
}
|
||||
#If there is an argument
|
||||
if [[ ! $# -eq 0 ]] ; then
|
||||
# define output directory for .hex files
|
||||
export ARDUINO_HEX_DIR=arduino_build_$TRAVIS_BUILD_NUMBER
|
||||
|
||||
# link test library folder to the arduino libraries folder
|
||||
ln -s $TRAVIS_BUILD_DIR $HOME/arduino_ide/libraries/Adafruit_Test_Library
|
||||
|
||||
# add the arduino CLI to our PATH
|
||||
export PATH="$HOME/arduino_ide:$PATH"
|
||||
|
||||
"$@"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue