Compare commits

...

371 commits

Author SHA1 Message Date
Limor "Ladyada" Fried
4ca170f09a
Merge pull request #113 from nkaaf/fixing_some_typos
typos
2022-02-10 10:54:27 -05:00
lady ada
078f453be3 no src afterall 2022-01-25 17:05:39 -05:00
lady ada
32f60f499e search default src folder too! 2022-01-25 11:14:15 -05:00
lady ada
04727ed0d4 fix ci for m4 tinyusb 2022-01-01 21:28:04 -05:00
lady ada
d827a91a24 add new esp32s2 board defs 2021-12-27 17:16:30 -05:00
Phillip Burgess
c9945ba55e Add more ATtiny varieties to build_platform.py
We don’t NEED all of these right now, but might become necessary due to parts availability, so I’m adding them while the process is fresh in my head rather than floundering later.
2021-11-18 11:15:12 -08:00
Phillip Burgess
324b4f8f3a Add attiny1617 to tinyMegaCore section of build platforms 2021-11-18 10:08:11 -08:00
nkaaf
eb96289980 typos 2021-11-11 21:47:32 +01:00
lady ada
e659722956 ?? 2021-10-09 14:52:14 -04:00
lady ada
a1cd2c9e46 add eyelights 2021-10-09 13:51:00 -04:00
lady ada
092a5ecfbd ok 2021-10-09 13:32:25 -04:00
lady ada
373f0c0c22 put fqbn in filename to make it unique 2021-10-09 13:30:17 -04:00
lady ada
3fc602ef7a just the uf2 2021-10-09 13:09:09 -04:00
lady ada
4e812d285c try to be specific about filename 2021-10-09 12:58:37 -04:00
lady ada
7283e8e87e more dirs 2021-10-09 12:24:45 -04:00
lady ada
28dc122a5c wrong dir 2021-10-09 12:16:36 -04:00
lady ada
23118ee09d did it work? 2021-10-09 12:12:00 -04:00
lady ada
dd58a69a9e trytyr 2021-10-09 12:01:40 -04:00
lady ada
a05792c0d7 ridic 2021-10-09 11:30:57 -04:00
lady ada
1e54f73313 python cant actually move dirs 2021-10-09 11:13:15 -04:00
lady ada
24542df558 try moving output to one dir 2021-10-09 11:02:41 -04:00
lady ada
f08b762a34 printy 2021-10-09 10:51:05 -04:00
Limor "Ladyada" Fried
319b6613e4
Merge pull request #111 from adafruit/retry-failed-install
retry up to 3 times for run_or_die()
2021-10-08 11:50:28 -04:00
hathach
4d09c4abe4
sleep 5 seconds between attempts 2021-10-08 15:43:42 +07:00
hathach
fa2c172a12
retry up to 3 times for run_or_die() 2021-10-08 00:58:04 +07:00
Limor "Ladyada" Fried
3907bae549
Merge pull request #110 from adafruit/fix-proc-timeout
Fix proc timeout
2021-10-07 12:27:49 -04:00
hathach
c173d84c6d
get returncode 2021-10-07 22:36:18 +07:00
hathach
6ba1af1dfe
use proc.communicate() instead of wait() to prevent deadlock 2021-10-07 22:26:14 +07:00
hathach
6c55535367
get stdout of timeout proc 2021-10-07 21:36:28 +07:00
hathach
8dda6941f5
test 2021-10-07 20:45:34 +07:00
hathach
42f4803327
increase timeout 2021-10-07 19:27:08 +07:00
hathach
8639df4c99
fix install script 2021-10-07 17:02:13 +07:00
hathach
bf8812dd55
use latest arduino cli 2021-10-07 16:55:23 +07:00
Limor "Ladyada" Fried
6b10fd6eb6
Merge pull request #109 from adafruit/PaintYourDragon-patch-1
Restore Arduino build timeout to 60 seconds
2021-10-06 14:08:28 -04:00
Paint Your Dragon
febfc922c4
Restore Arduino build timeout to 60 seconds
Problem was Elsewhere.
2021-10-06 10:33:27 -07:00
Limor "Ladyada" Fried
ca4de93cc4
Merge pull request #108 from adafruit/PaintYourDragon-patch-1
Change build timeout from 60 to 120 seconds
2021-10-06 12:19:08 -04:00
Paint Your Dragon
2c53c9bda1
Change build timeout from 60 to 120 seconds 2021-10-06 09:15:27 -07:00
ladyada
6a67a1dec1 add pygamer tinyusb 2021-10-01 13:36:00 -04:00
ladyada
b64a59cec8 remove 2021-10-01 12:30:58 -04:00
ladyada
1b72ada926 tyop 2021-10-01 12:29:18 -04:00
ladyada
b6e95ad50d learning sys doesnt test blink 2021-10-01 12:25:44 -04:00
ladyada
696be13876 shhh! 2021-10-01 12:06:07 -04:00
ladyada
2602c52184 remove shell? 2021-10-01 11:59:58 -04:00
ladyada
d0893ffd9f what are we doing? 2021-10-01 11:53:18 -04:00
ladyada
b8d1a1315b skip it 2021-10-01 11:49:11 -04:00
ladyada
764f427a25 bytey 2021-10-01 11:47:12 -04:00
ladyada
efd44cee4d fixverb 2021-10-01 11:43:58 -04:00
ladyada
4eff8b6c4b verbose 2021-10-01 11:38:43 -04:00
lady ada
22bd6d6cc4 allow real skips 2021-09-30 18:26:40 -04:00
lady ada
aa7b9800a1 pardon, typo! 2021-09-30 18:21:02 -04:00
lady ada
eb515470b7 pathypath 2021-09-30 18:16:21 -04:00
lady ada
49a97f0acc slightly more helpful 2021-09-30 18:09:19 -04:00
lady ada
76b0b0fbfe dont let invalid test.only! 2021-09-30 17:59:06 -04:00
Limor "Ladyada" Fried
777e49e47f
Merge pull request #107 from kattni/feather-m4-express
Add Feather M4 Express.
2021-09-30 17:37:17 -04:00
Kattni Rembor
7840ec8a9f Add Feather M4 Express. 2021-09-30 16:50:24 -04:00
Limor "Ladyada" Fried
5172372545
Merge pull request #106 from adafruit/fix-esp32s2-build
Fix ci build with esp32s2 boards
2021-09-29 09:58:39 -04:00
hathach
e4760ab70e
print installed core version 2021-09-29 19:31:56 +07:00
hathach
5bd604c966
enable 'shell=True' for building esp32s2 board
use folder path i.e example dir instead of path to .ino file
2021-09-29 17:42:29 +07:00
lady ada
fa90162410 add base addr 2021-09-16 13:00:27 -04:00
ladyada
888253b2de qtpy first class! 2021-09-15 16:38:13 -04:00
Brent Rubell
af388556f0
Merge pull request #105 from brentru/master
Add support for exporting compiled examples
2021-09-10 17:14:27 -04:00
brentru
cd2c49a796 remove uf2 generation for ESP32 2021-09-10 15:43:37 -04:00
brentru
1f3a9aea38 add qtpy 2021-09-10 14:49:25 -04:00
brentru
ba452bb270 only download uf2 if we're on a platform which supports 2021-09-10 11:16:22 -04:00
brentru
22307baa0e skip 2021-09-10 11:09:10 -04:00
brentru
3640064284 optionally create uf2, test for uno 2021-09-10 11:04:37 -04:00
brentru
efc9ca81ec ret. correctly, print the output of uf2 generation 2021-09-10 10:28:33 -04:00
brentru
1841e5b121 dont ret success? 2021-09-08 18:37:08 -04:00
brentru
d16676c9c7 add print 2021-09-08 18:33:25 -04:00
brentru
b863a6b594 remove platform parse for None, TODO: ADDBACK 2021-09-08 18:29:26 -04:00
brentru
adaa941584 symlink!~ 2021-09-08 18:23:06 -04:00
brentru
dee8376c41 use latest version of cli to match brent computer 2021-09-08 18:04:03 -04:00
brentru
3127711e16 newest version of arduino-cli 2021-09-08 18:00:51 -04:00
Brent Rubell
90fac687a1
Merge pull request #1 from brentru/generate-uf2
Generate uf2
2021-09-08 17:54:50 -04:00
brentru
fc374d68bb work for groupings and singleton 2021-09-08 17:26:10 -04:00
brentru
a47bd2ea9a add ws platforms, build using the cli path 2021-09-08 17:01:22 -04:00
brentru
18d7089513 add glob1 pattern matchin 2021-09-08 14:35:40 -04:00
brentru
5851559e4d use os.path instead 2021-09-08 14:19:22 -04:00
brentru
1d634ea903 add all platforms 2021-09-08 14:11:05 -04:00
brentru
4c593787b4 use FID 2021-09-08 13:56:52 -04:00
brentru
0c7fa0126f check dir name 2021-09-08 12:52:02 -04:00
brentru
4b002375e7 append platform onto output file name 2021-09-08 12:40:10 -04:00
brentru
363a50de81 None for AVRs 2021-09-08 12:19:48 -04:00
brentru
c31ee4dea9 add docstring 2021-09-03 17:13:28 -04:00
brentru
f452154470 better generation of the uf2 name 2021-09-03 17:09:11 -04:00
brentru
2c389af214 use output path as the name 2021-09-03 17:06:41 -04:00
brentru
67feedfeee split out to generate_uf2, use example name as output name 2021-09-03 17:01:30 -04:00
brentru
88b746ff77 pull examplepath from global 2021-09-03 16:47:55 -04:00
brentru
9a8728c380 add uf2 commands 2021-09-03 16:43:46 -04:00
brentru
1fcc2329ee download uf2 tools 2021-09-03 16:35:04 -04:00
brentru
a6a0e86502 build and export 2021-09-03 16:05:46 -04:00
brentru
9c244d68ed add export-binaries tag 2021-09-03 11:07:52 -04:00
Limor "Ladyada" Fried
7351a8957b
Merge pull request #104 from adafruit/symlink-with-library-name
make symlink with library name rather than 'Adafruit_Test_Library'
2021-07-16 16:14:09 -04:00
hathach
f1a8355781 make symlink with library name rather than 'Adafruit_Test_Library' 2021-07-16 15:44:20 +07:00
ladyada
63b7c7e7e1 try no warnings 2021-07-06 17:58:30 -04:00
ladyada
6b3d2e3b2b timeout the proc.wait 2021-07-06 17:48:21 -04:00
ladyada
00bc76f9c9 use s110 softdev 2021-07-06 17:08:28 -04:00
lady ada
26112fa943 Merge branch 'master' of github.com:adafruit/ci-arduino 2021-07-01 17:47:52 -04:00
lady ada
4f21970e59 flush example name first 2021-07-01 17:47:47 -04:00
Limor "Ladyada" Fried
144a80dd3a
Merge pull request #103 from kattni/fix
Syntax fix.
2021-06-22 12:08:44 -04:00
Kattni Rembor
22b835bfb2 Syntax fix. 2021-06-22 12:07:36 -04:00
Kattni
74610a110d
Merge pull request #102 from kattni/add-qt-trinkey
Adding QT2040 Trinkey.
2021-06-22 11:54:12 -04:00
Kattni Rembor
9b8cd9511d Add QT Trinkey. 2021-06-22 11:40:24 -04:00
Kattni Rembor
9ad307d36f Adding QT2040 Trinkey. 2021-06-22 11:38:20 -04:00
lady ada
8617e71e7d some more attiny8s 2021-06-12 16:33:07 -04:00
lady ada
acaa4b761c add 816 2021-06-12 16:11:40 -04:00
lady ada
4434e2cc44 try adding new attiny817 target 2021-06-12 15:48:02 -04:00
Limor "Ladyada" Fried
ddcbcde7a1
Merge pull request #100 from brentru/add-m4airlift-tinyusb
Add Platform - Metro M4 AirLift w/TinyUSB stack
2021-06-04 12:34:16 -04:00
brentru
31fe9f5f64 add tinyusb for m4 airlift lite 2021-06-04 12:00:50 -04:00
Kattni
3a7e6065aa
Merge pull request #99 from kattni/add-trinkeys
Adding Trinkeys
2021-05-25 15:28:45 -04:00
Kattni Rembor
71bef419dc Adding Trinkeys 2021-05-25 15:11:16 -04:00
Limor "Ladyada" Fried
27df6130e3
Merge pull request #98 from adafruit/correct-board-fqbn
separate the fqbn for arduino/tinyusb stack for some variants
2021-05-24 14:17:40 -04:00
hathach
23f3180f36
separate the fqbn for arduino/tinyusb stack for some variants 2021-05-25 00:42:24 +07:00
Limor "Ladyada" Fried
81aa9cb758
Merge pull request #97 from adafruit/add-wall
add optional --wall option for ci
2021-05-24 10:39:36 -04:00
hathach
6ff9f7096a always build with all warnings, only failed with --wall option 2021-05-24 14:53:35 +07:00
hathach
e8902ddae1 add optional --wall option for ci 2021-05-24 13:29:25 +07:00
Ha Thach
4e069bd16b
Merge pull request #96 from adafruit/travfix
Travfix
2021-05-05 00:27:11 +07:00
hathach
f49b8e3e6e clean up 2021-05-04 23:56:57 +07:00
hathach
40a78a0aba pip without sudo 2021-05-04 23:45:57 +07:00
hathach
97fc171114 try dist 20.04 2021-05-04 23:35:01 +07:00
lady ada
a688e13e7c make trinket a defualt 2021-05-01 15:19:07 -04:00
lady ada
7d0c6a18eb who knows 2021-05-01 14:44:02 -04:00
lady ada
bf2d23f5ff why is there 27? 2021-05-01 14:33:55 -04:00
lady ada
771ad04e80 pip 2021-05-01 14:20:56 -04:00
lady ada
200a3c0bf4 try new dist? 2021-05-01 14:09:13 -04:00
lady ada
291765dca0 try 3.8? 2021-05-01 13:32:43 -04:00
lady ada
65a4580800 wheel around 2021-05-01 13:18:59 -04:00
lady ada
20cfc49f70 add wheel? 2021-05-01 13:10:36 -04:00
lady ada
b6466e2092 why is this here 2021-05-01 12:59:13 -04:00
Paint Your Dragon
37f36870c4
Merge pull request #95 from adafruit/pb-rp2040
Add RP2040 (Philhower core)
2021-04-29 18:28:50 -07:00
Phillip Burgess
a3f77586be Fix typo 2021-04-29 18:25:25 -07:00
Phillip Burgess
e60cb85683 Add pico_rp2040 to githubci.yml 2021-04-29 18:23:49 -07:00
Phillip Burgess
b731f8a295 Add RP2040 (Philhower core) 2021-04-29 18:05:19 -07:00
Limor "Ladyada" Fried
58d99c4da1
Merge pull request #94 from makermelissa/master
Added Esp32-s2 boards
2021-04-20 11:19:01 -04:00
Melissa LeBlanc-Williams
de6ad7a3f6 Remove install.sh changes 2021-04-20 08:16:48 -07:00
Melissa LeBlanc-Williams
31575a9335 Add esp32-s2 boards 2021-04-20 08:12:07 -07:00
Melissa LeBlanc-Williams
2deeba4613 Merge branch 'master' of https://github.com/adafruit/ci-arduino 2021-04-20 08:05:37 -07:00
Limor "Ladyada" Fried
9b0a17ddea
Merge pull request #93 from adafruit/add-platform-m4-can
add feather m4 can to platform list
2021-04-09 11:04:31 -04:00
hathach
9c83e4de86
add feather m4 can to platform list 2021-04-09 13:46:08 +07:00
Limor "Ladyada" Fried
de76725537
Merge pull request #92 from adafruit/ubu20
try changing to unpinned
2021-03-07 11:35:26 -05:00
lady ada
441382d135 try changing to unpinned 2021-03-07 11:30:14 -05:00
Limor "Ladyada" Fried
83b8102c73
Merge pull request #91 from edgar-bonet/commit-fmt
Format documentation commit in GitHub actions
2021-01-03 13:01:58 -05:00
lady ada
f21ee38196 try another timeout 2020-12-30 13:09:32 -05:00
lady ada
893fcd5730 Merge branch 'master' of github.com:adafruit/ci-arduino 2020-12-30 12:43:51 -05:00
lady ada
ecf8ecea5d give more time 2020-12-30 12:43:46 -05:00
Edgar Bonet
4fbe599cac Format documentation commit in GitHub actions
The commit message provides the SHA1 of the current commit and an ID for
the build, now both on Travis and GitHub actions.

Fixes #74.
2020-12-29 21:22:00 +01:00
Josef Schlehofer
4fb9820b2d
Fix typos in README (#87) 2020-12-28 23:49:06 -05:00
Zach Whitehead
39087b3b5b
Fix typo, add note about Github actions (#89) 2020-12-28 23:48:39 -05:00
lady ada
0362af3856 remove caching 2020-12-28 23:32:00 -05:00
Brent Rubell
26d7b20482
Patch for MetroX Arduino Repo (#88)
* add new build platform

* split it out

Co-authored-by: brentru <robots199@me.com>
2020-12-11 17:04:13 -05:00
Jeff Epler
939d3f0f18
Resolve warning that will affect Python 3.10 compatibility (#86)
I noticed this message during an otherwise successful build of
our arduino-CAN fork:

/home/runner/work/arduino-CAN/arduino-CAN/ci/build_platform.py:183: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

This should resolve the problem.
2020-11-05 10:26:49 -05:00
lady ada
2ef0a08c8b revert 2020-10-18 18:45:15 -04:00
lady ada
a99332cdf0 just skip nrf52 for now 2020-10-18 14:06:49 -04:00
lady ada
9c928bd99b try no link? 2020-10-18 11:45:00 -04:00
lady ada
801625e311 try removing newer py 2020-10-17 17:17:33 -04:00
lady ada
d3327dcd96 Merge branch 'master' of github.com:adafruit/ci-arduino 2020-10-17 17:03:37 -04:00
lady ada
2ec63b8c97 try a specific version of python? 2020-10-17 17:03:32 -04:00
Paint Your Dragon
718b33bf51
Add matrixportal (w/tinyusb stack) to build platforms (#85) 2020-10-17 16:58:42 -04:00
Melissa LeBlanc-Williams
6f36123a95 Merge branch 'master' of https://github.com/adafruit/ci-arduino 2020-10-12 08:49:34 -06:00
siddacious
8a8685e5d4
Merge pull request #82 from adafruit/local-platforms
Added steps for running build_platforms.py locally
2020-09-11 12:33:17 -07:00
Limor "Ladyada" Fried
4b9c824f8b
Update build_platform.py
fix grand central BSP name
2020-07-13 23:48:26 -04:00
dherrada
3160146029
Made requested changes 2020-07-10 18:17:43 -04:00
dherrada
9b23b4ed54
Added better code blocks 2020-07-10 16:48:55 -04:00
dherrada
fb6c7bcd30
Added explanation that running it takes a long time 2020-07-10 14:30:08 -04:00
dherrada
e27ab26c34
Fixed typos, made it clearer 2020-07-10 14:26:56 -04:00
dherrada
378d1f6688 Added steps for running build_platforms.py locally 2020-07-10 14:24:26 -04:00
Paint Your Dragon
d2a70ce596
Add Grand Central M4 (#81) 2020-07-09 20:20:35 -04:00
dherrada
d60c54a3d5
Added option to set input for doxygen (#78) 2020-07-06 12:19:44 -04:00
lady ada
cfb70dfd09 typofix 2020-07-02 14:20:37 -04:00
lady ada
5151de05ef Merge branch 'master' of github.com:adafruit/ci-arduino 2020-07-02 14:18:42 -04:00
lady ada
fcc3ed0d08 let us run this twice per compy 2020-07-02 14:18:38 -04:00
dherrada
3db4cc852d
Fix actions install script (#77) 2020-06-30 13:22:42 -04:00
lady ada
3d8c53d6b5 add path 2020-06-28 12:56:27 -04:00
lady ada
116b7211b8 Merge branch 'master' of github.com:adafruit/ci-arduino 2020-06-28 12:32:06 -04:00
lady ada
a71fa4ae57 do more earlier 2020-06-28 12:32:03 -04:00
lady ada
61328c7e4a install arduino earlier 2020-06-28 12:31:42 -04:00
per1234
44550ac828
Remove code for unnecessary Adafruit SAMD Boards platform dependency (#76)
Adafruit SAMD Boards doesn't have a dependency on Arduino SAMD Boards, so this only slows down the CI run.
2020-06-06 20:45:31 -04:00
lady ada
121a199460 use duinostack 2020-05-16 23:06:31 -04:00
lady ada
32a36d690c add neotrel 2020-05-16 22:41:24 -04:00
lady ada
877503d4c8 tinyusb 2020-05-16 20:43:06 -04:00
lady ada
13809eba12 m4 tinyusb default 2020-05-16 18:58:52 -04:00
lady ada
41e1245872 fqbn fixes 2020-05-16 17:33:34 -04:00
lady ada
c185d7f69e fix floraname 2020-05-16 17:32:30 -04:00
lady ada
54f696f68f add feather m0 exp 2020-05-16 14:20:28 -04:00
lady ada
06dd52f251 m0ar 2020-05-16 13:56:02 -04:00
lady ada
79ef30ea63 sort for easier scanning 2020-05-16 13:40:03 -04:00
lady ada
36b7448087 add flora 2020-05-16 13:38:55 -04:00
lady ada
5aac028d65 add protrinketz 2020-05-16 13:18:07 -04:00
lady ada
1acf77adc2 add nrf52382 feather 2020-05-16 13:14:42 -04:00
lady ada
964c55dda9 try recycling testcode 2020-05-16 13:04:58 -04:00
lady ada
f39b6dd49d try detecing if its a learning repo 2020-05-16 12:53:37 -04:00
siddacious
37dc6a1146
Merge pull request #73 from adafruit/docs_badge
Added doxygen badge to assets
2020-04-21 12:07:43 -07:00
dherrada
60ed1e1417
Added doxygen badge to assets 2020-04-21 15:05:55 -04:00
jxltom
52cf6c5109
Install required pip3 in travis example and update the example in README (#72)
* Install pip3 which is required for adafruit-nrfutil

* Update travis example in README
2020-04-07 11:48:11 -04:00
siddacious
8a824e66dc
Merge pull request #71 from adafruit/3v_trinket
adding targets to specify which trinket
2020-04-03 13:26:08 -07:00
siddacious
4951bc3c00 removing old trinket target 2020-04-03 12:56:24 -07:00
siddacious
f2b1c97381 adding targets to specify which trinket 2020-04-03 12:49:06 -07:00
siddacious
49d6719456
Merge pull request #70 from adafruit/avr_dep
fixing missing arduino:avr dep for adafruit:avr
2020-04-03 12:19:18 -07:00
siddacious
6eabe3a119 fixing missing arduino:avr dep for adafruit:avr 2020-04-03 12:02:53 -07:00
ladyada
78d622bb6f check link exists 2020-03-18 11:10:19 -04:00
ladyada
948602c863 bump action 2020-03-18 10:51:22 -04:00
Lady Ada
71973a2beb --allow-downgrades 2020-02-15 21:18:09 -05:00
Lady Ada
b4e414b593 try being specific 2020-02-15 21:16:57 -05:00
Lady Ada
2aee9fca88 try llvm8 manual install 2020-02-15 21:14:25 -05:00
Lady Ada
3e6b877477 trigger build 2020-02-15 21:12:39 -05:00
Dimitris Platis
8bbb960f22 Use the latest Arduino IDE version (#66)
As of today, the latest Arduino IDE version is 1.8.11 which includes
several bug-fixes and enhancements.
2020-01-28 15:47:19 -05:00
Lady Ada
b3cd0e4bd2 add clue 2020-01-26 13:26:30 -05:00
Lady Ada
0b1516adb7 add pybadge_tinyusb 2020-01-13 21:35:15 -05:00
Lady Ada
3878f9ca1e just look for file 2020-01-13 20:58:07 -05:00
Lady Ada
ecf38d7965 maybe needed? 2020-01-11 12:47:58 -05:00
Lady Ada
df5a4187d1 add example simple actions 2020-01-07 11:57:42 -05:00
ladyada
990c7bd882 add metro_m4_airliftlite 2020-01-03 17:59:13 -05:00
Ha Thach
46c4442951 add metro_m0/m4_tinyusb platform (#65)
* add metro_m0/m4_tinyusb platform
2019-12-30 12:17:43 -05:00
Lady Ada
1e7527758d fix replace 2019-12-29 15:21:29 -05:00
Lady Ada
c38310b90a uninstall ourselves if installed by library manager 2019-12-29 15:21:29 -05:00
Lady Ada
d134ae2322 Add terminal colors to output that works in actions. Move all stderr to stdout since that seems to do weird things in travis 2019-12-29 15:21:29 -05:00
Lady Ada
ff70119f3d add metro m0 & microbit 2019-12-29 15:21:28 -05:00
Lady Ada
580d01bf17 recursively test all examples in example folder 2019-12-29 15:21:26 -05:00
Lady Ada
c73a88f91c add m4sk 2019-12-27 23:14:19 -05:00
Lady Ada
154c52cda1 add hallowing and titano 2019-12-27 23:05:49 -05:00
Lady Ada
991de58fe0 bail on unknown platform 2019-12-27 22:56:18 -05:00
Lady Ada
f1df107adf dont make directories here 2019-12-27 22:53:14 -05:00
Lady Ada
4fe206d3b0 make subdirs earlier 2019-12-27 22:51:37 -05:00
Lady Ada
83a347b22f print libraries 2019-12-27 22:49:31 -05:00
Lady Ada
1eabd339f5 we need arduino samd for adafruit samd 2019-12-27 21:52:26 -05:00
Lady Ada
0f4444341f remove extra , 2019-12-27 18:10:15 -05:00
Lady Ada
ace797d03b ?? 2019-12-27 18:09:54 -05:00
Lady Ada
43e681d7c8 woops should be tuple 2019-12-27 18:03:29 -05:00
Lady Ada
e7beb63633 add arcadas' 2019-12-27 18:00:49 -05:00
Lady Ada
eeb0097451 make feather nrf52840 the default nrf52840 platform 2019-12-27 16:37:25 -05:00
Lady Ada
7c96931b3d skip skipped 2019-12-27 16:18:07 -05:00
Lady Ada
b3034f1cec ok nvmd 2019-12-27 16:12:00 -05:00
Lady Ada
1ef3bbd8eb maybe 9 is available? 2019-12-27 16:11:15 -05:00
Lady Ada
3135549440 missing dots 2019-12-27 16:04:04 -05:00
Lady Ada
ed2d0da596 bump to 10 2019-12-27 15:58:20 -05:00
Lady Ada
e9d769022e switcheroo 2019-12-27 15:57:28 -05:00
Lady Ada
ddbc929ec4 add some debugs 2019-12-27 15:54:52 -05:00
Lady Ada
b37793d67b add skips/onlys 2019-12-27 15:30:37 -05:00
Lady Ada
0b6e0a1dfc bash comparison for strings 2019-12-27 14:31:27 -05:00
Lady Ada
e1c77451c3 strings are iterable! 2019-12-27 13:58:56 -05:00
Lady Ada
38d0ee8832 add adafruit deps 2019-12-27 13:57:38 -05:00
Lady Ada
1484ae176d fix fqbn expansion 2019-12-27 13:51:16 -05:00
Lady Ada
6cecf5b864 py3 2019-12-27 13:48:27 -05:00
Lady Ada
e259e716d5 :! 2019-12-27 13:46:13 -05:00
Lady Ada
89d2729504 try expanding groups 2019-12-27 13:44:10 -05:00
Lady Ada
85b5b7ec4e squash actions/doxy commits 2019-12-27 03:38:02 -05:00
Lady Ada
76ef9e5356 Merge branch 'master' of github.com:adafruit/travis-ci-arduino 2019-12-26 23:30:33 -05:00
Limor "Ladyada" Fried
0f60ffbab9
Clang prereqs (#64) 2019-12-26 23:14:12 -05:00
Lady Ada
d345562264 Merge branch 'master' of github.com:adafruit/travis-ci-arduino 2019-12-26 23:13:41 -05:00
Lady Ada
5b8bc05149 try clang and doxy? 2019-12-26 23:13:28 -05:00
Lady Ada
916a3859e0 install library deps, only print output of compile on failure 2019-12-26 23:13:26 -05:00
Lady Ada
f1599a75d5 try clang and doxy? 2019-12-26 21:46:16 -05:00
Lady Ada
2246f91be8 add quotes for dep 2019-12-26 21:39:10 -05:00
Lady Ada
c1479ad96e add library dep loop 2019-12-26 21:34:27 -05:00
Lady Ada
215665c142 paren 2019-12-26 21:22:26 -05:00
Lady Ada
c5c85e40ac print error on failure 2019-12-26 21:19:53 -05:00
Lady Ada
30c5eacd8e make cmd a list to match subproc popen 2019-12-26 21:12:50 -05:00
Lady Ada
877218032a import subproc 2019-12-26 21:09:49 -05:00
Lady Ada
22449f8dff call exit 2019-12-26 21:08:36 -05:00
Lady Ada
e8b9c17e8c get subproc outputs 2019-12-26 21:07:32 -05:00
Lady Ada
d52d214753 add prereq installer 2019-12-26 20:58:06 -05:00
Limor "Ladyada" Fried
afe4379a35
Add actions version of CI (#63) 2019-12-26 20:04:40 -05:00
Lady Ada
50242a2a78 try installing library dependencies 2019-12-22 17:09:39 -05:00
Melissa LeBlanc-Williams
338302c9da Getting path 2019-12-17 11:52:41 -08:00
Melissa LeBlanc-Williams
86a998bdd4 Getting home folder 2019-12-17 11:48:35 -08:00
Melissa LeBlanc-Williams
ebe9f6fcc7 home check 2019-12-17 11:41:41 -08:00
Melissa LeBlanc-Williams
842bf91740
Merge pull request #61 from BenoitAnastay/master
Change build directory and fix issue #59
2019-12-17 09:06:55 -08:00
BenoitAnastay
8f87204e04 Fix https://github.com/adafruit/travis-ci-arduino/issues/59 2019-12-17 04:17:45 +01:00
BenoitAnastay
a2db5dc356
Revert old call for travis 2019-12-17 04:11:11 +01:00
BenoitAnastay
7c2cb85215
Remove path edit 2019-12-17 03:51:49 +01:00
BenoitAnastay
cd2b33b349
Change build directory
This change is to let travis access the files with deploy
2019-12-17 03:39:24 +01:00
Melissa LeBlanc-Williams
5834089b2b Revert "Make it work with Github CI (#58)" (#60)
This reverts commit 29fb06963c.
2019-12-16 21:07:57 -05:00
BenoitAnastay
29fb06963c Make it work with Github CI (#58)
* Fix setuptools

* Remove install libs

* Try to fix build command

* Only conserve exports on build.sh

* Try to chmod

* ESP8266 Only

* cleanup

* Revert "cleanup"

This reverts commit e12e7329be.

* All cards re-enabled

* Add pyserial

* Add pip

* Remove nrfutis pip

* Attemp to force python3

* Add .local/bin to path

* sudo install nrfutil

* Sudo all pip

* revert unaltered files

* attempt to merge install.sh and build.sh

* Chmod +x
2019-12-16 17:34:39 -05:00
BenoitAnastay
14974ef3ee Chmod +x 2019-12-16 23:19:46 +01:00
BenoitAnastay
78553afdf0 attempt to merge install.sh and build.sh 2019-12-16 23:05:36 +01:00
BenoitAnastay
664c5af0f9 revert unaltered files 2019-12-16 21:29:32 +01:00
BenoitAnastay
556a874e9a
Sudo all pip 2019-12-16 21:02:14 +01:00
BenoitAnastay
4f82eef86f
sudo install nrfutil 2019-12-16 20:54:52 +01:00
BenoitAnastay
c2248ad7b1
Add .local/bin to path 2019-12-16 20:43:50 +01:00
BenoitAnastay
7d7876e26a Attemp to force python3 2019-12-16 20:27:39 +01:00
Chris Mumford
457fbe47e2 Added markdown code language specifications for syntax highlighting. (#57) 2019-12-16 14:15:03 -05:00
BenoitAnastay
ab6c9461f8 Remove nrfutis pip 2019-12-16 20:14:03 +01:00
BenoitAnastay
024c685c42 Add pip 2019-12-16 20:03:38 +01:00
BenoitAnastay
90c915992a Add pyserial 2019-12-16 19:27:46 +01:00
BenoitAnastay
a656bd1bfe All cards re-enabled 2019-12-16 19:17:20 +01:00
BenoitAnastay
78c99690a9 Revert "cleanup"
This reverts commit e12e7329be.
2019-12-16 19:15:09 +01:00
BenoitAnastay
e12e7329be cleanup 2019-12-16 17:03:06 +01:00
BenoitAnastay
b4103af389 ESP8266 Only 2019-12-16 16:57:38 +01:00
BenoitAnastay
74a9061721 Try to chmod 2019-12-16 16:44:17 +01:00
BenoitAnastay
dfe6f4bc10 Only conserve exports on build.sh 2019-12-16 16:26:59 +01:00
BenoitAnastay
e28c92027a Try to fix build command 2019-12-16 16:18:16 +01:00
BenoitAnastay
6888af2fe7 Remove install libs 2019-12-16 15:49:28 +01:00
BenoitAnastay
0db9d1f617 Fix setuptools 2019-12-16 15:02:31 +01:00
frazar
476992e770 Bump Arduino IDE version to 1.8.10 (#54) 2019-10-28 17:20:17 -04:00
ladyada
cea55de9d5 few people have a due, lets skip it 2019-10-28 17:12:57 -04:00
ladyada
6aa88d4075 fix typedefs for function ptrs 2019-10-27 19:22:16 -04:00
ladyada
4620e1ef27 unbreak 2019-10-14 11:54:17 -04:00
ladyada
9c579f3292 try simplifying nrf 2019-10-14 11:43:39 -04:00
ladyada
bb2340b667 skip nrf for now 2019-10-12 03:14:57 -04:00
ladyada
56642255c6 add cplays for arcada testing 2019-10-11 18:44:44 -04:00
ladyada
b307ed3f40 Merge branch 'master' of github.com:adafruit/travis-ci-arduino 2019-10-06 22:56:01 -04:00
ladyada
c053f8b0ba add nrfutil install 2019-10-06 22:55:56 -04:00
Melissa LeBlanc-Williams
9d3d27abd8
Merge pull request #53 from makermelissa/master
Adding some options to CPB like the nRF52840 has
2019-10-01 09:40:58 -07:00
Melissa LeBlanc-Williams
b983a7260f Adding some options to CPB like the nRF52840 has 2019-10-01 09:33:04 -07:00
Melissa LeBlanc-Williams
906753abbb Merge branch 'master' of https://github.com/adafruit/travis-ci-arduino 2019-10-01 09:31:25 -07:00
Melissa LeBlanc-Williams
f50aa7ed74 Removed commas. It didn't like that (#52)
* Added HalloWing M4 to Arcade Platforms

* Added Adafruit CircuitPlayground Express and Bluefruit

* Removed commas. It didn't like that
2019-09-28 17:04:16 -04:00
Melissa LeBlanc-Williams
d29c7248cc Fix merge conflict 2019-09-28 12:15:49 -07:00
Melissa LeBlanc-Williams
2bf942ac7f Removed commas. It didn't like that 2019-09-28 12:13:24 -07:00
Melissa LeBlanc-Williams
30b5962be7 Added Adafruit CircuitPlayground Express and Bluefruit (#51)
* Added HalloWing M4 to Arcade Platforms

* Added Adafruit CircuitPlayground Express and Bluefruit
2019-09-28 13:58:19 -04:00
Melissa LeBlanc-Williams
ddaeb5bd79 Added Adafruit CircuitPlayground Express and Bluefruit 2019-09-28 10:36:15 -07:00
Melissa LeBlanc-Williams
3af278bc3d Merge branch 'master' of https://github.com/adafruit/travis-ci-arduino 2019-09-28 10:29:49 -07:00
Melissa LeBlanc-Williams
eda5934b82 Added HalloWing M4 to Arcade Platforms (#50) 2019-09-13 15:43:54 -04:00
Melissa LeBlanc-Williams
4349455772 Added HalloWing M4 to Arcade Platforms 2019-09-13 11:32:27 -07:00
Dimitris Platis
c12f3718a6 Preserve temporary files after compilation (#49)
Preserve the temporary files (e.g. '.hex') so they
can be found at a deterministic location and be
deployed if there's a need to.
2019-09-01 19:38:07 -04:00
Ladyada
62f87be84e Merge branch 'master' of github.com:adafruit/travis-ci-arduino 2019-08-15 15:05:00 -04:00
Ladyada
6070f57c7b test dir before failing 2019-08-15 15:04:53 -04:00
Limor "Ladyada" Fried
303f79629c
Update githubci.yml 2019-08-15 15:01:01 -04:00
Limor "Ladyada" Fried
85ea20a9e9
Rename blank.yml to githubci.yml 2019-08-15 14:55:17 -04:00
Noah
901c33f98f Add space in external libraries bash script (#48) 2019-08-06 02:03:16 -04:00
Ladyada
876150cf53 test only cpp 2019-08-01 19:38:19 -04:00
Ladyada
47ae5eb630 require clang formatting 2019-08-01 14:18:05 -04:00
Ladyada
e302fecbbc mirror of https://github.com/Sarcasm/run-clang-format 2019-08-01 13:54:28 -04:00
Limor "Ladyada" Fried
4d057e638b
Update example_travis.yml 2019-07-27 14:25:29 -04:00
Leonardo
ab1bff035d Talking about ARDUINO_IDE_VERSION (#47)
* Note about installing multiple libraries

* "Hack" on how to install external libraries

* Explaining what ARDUINO_IDE_VERSION="1.8.7" does

The script usually chooses the newset stable version

* typo
2019-07-13 13:20:02 -04:00
Leonardo
f6dfb27e3d Note about installing multiple libraries (#46)
* Note about installing multiple libraries

* "Hack" on how to install external libraries
2019-07-12 19:35:09 -04:00
Andrew Dassonville
b311699243 Allow custom installation (#43)
* Allow user to customize installation

* Add documentation about INSTALL_PLATFORMS
2019-06-29 14:43:50 -04:00
hathach
b874c11fa9 add nrf52840 self-test, use addon pip3 to install adafruit-nrfutil (#42)
* add nrf52840 self-test, use addon pip3 to install adafruit-nrfutil

* add setuptools to be safe
2019-06-07 12:43:28 -04:00
hathach
8abbe133db Add nrf5x to build platform (#41)
* adding nrf5x platform

* minor clean up

* remove comment code
2019-05-31 02:31:28 -04:00
ladyada
f3f08dd7f7 fix arcada typo 2019-05-25 02:06:30 -04:00
ladyada
478e265ba2 test arcada too! 2019-05-25 02:00:04 -04:00
ladyada
4cc53f68c6 add arcada boardset 2019-05-25 00:08:56 -04:00
brentrubell
38483584d9
Merge pull request #40 from brentru/add-m4-airlift-target
Add Metro M4 AirLift to IO_Platforms
2019-05-22 09:56:37 -04:00
brentru
2a536995c3 switch to airliftlite 2019-05-21 19:11:20 -04:00
brentru
774b497c03 add speed 2019-05-21 17:16:45 -04:00
brentru
80f0deb5b6 add m4 airlift to install.sh 2019-05-21 17:14:30 -04:00
Limor "Ladyada" Fried
d99bba0266
Update install.sh 2019-04-24 15:50:18 -04:00
Limor "Ladyada" Fried
5fd467f0c8
one more speed 2019-04-24 15:49:18 -04:00
Limor "Ladyada" Fried
ba8f2abbbf
re-add speed 2019-04-24 15:48:45 -04:00
Limor "Ladyada" Fried
471f6d66bb
Update install.sh
try removing opts?
2019-04-24 14:21:40 -04:00
Limor "Ladyada" Fried
7208102404
Update .travis.yml 2019-04-23 23:22:35 -04:00
Limor "Ladyada" Fried
b57074dd61
Try opts for metro m4 2019-04-23 23:22:04 -04:00
Limor "Ladyada" Fried
cb181f62c3
Update README.md 2019-04-23 23:14:52 -04:00
Kryštof Černý
cf3b801448 Try Arduino IDE 1.8.9 (#39)
* Try Arduino IDE 1.8.9

* Use version from script
2019-04-17 00:31:14 -04:00
Limor "Ladyada" Fried
6d27177ff7
Update install.sh 2019-01-29 13:06:49 -05:00
Limor "Ladyada" Fried
59f28502db
Update install.sh 2019-01-29 13:03:33 -05:00
Dan Halbert
5a1423e234
Merge pull request #38 from adafruit/dhalbert-no-verbose
oops, remove --verbose
2019-01-28 12:55:34 -05:00
Dan Halbert
91b95630f2
oops, remove --verbose 2019-01-28 12:12:30 -05:00
Dan Halbert
5f1cdbbf57
Merge pull request #37 from dhalbert/signing.py-execute
stop trying to fix esp8266 2.5.0-beta1 permission problem
2019-01-28 11:36:57 -05:00
Dan Halbert
c6ff350267 turn on arduino --verbose to see failure 2019-01-28 10:47:53 -05:00
Dan Halbert
6cb5be0ad4 stop trying to fix esp8266 2.5.0-beta1 permission problem 2019-01-28 10:11:47 -05:00
Limor "Ladyada" Fried
e5d9f883eb
Update Doxyfile.default
don't test markdowns!
2019-01-22 11:56:58 -05:00
Brennen Bearnes
7f78883303 add PLATFORM_CHECK_ONLY_ON_FILE environment var for limiting arduino checks (#36)
* add PLATFORM_CHECK_ONLY_ON_FILE environment var for limiting arduino checks

* add build_aux_platforms()
2019-01-10 17:31:13 -05:00
Dan Halbert
905dfd1a1d
Merge pull request #35 from dhalbert/esp8266-build-options
update esp8266 option names
2018-12-12 13:54:46 -05:00
Dan Halbert
690f46db1a bump arduino ide version to 1.8.7 2018-12-12 13:48:42 -05:00
Dan Halbert
723ef580ae update esp8266 option names 2018-12-12 13:44:36 -05:00
ladyada
59d27fe9e2 just to check 2018-12-12 13:27:42 -05:00
ladyada
dff2042ce0 what if we just chmod it, does that help? 2018-12-12 13:13:45 -05:00
ladyada
5636eb82fa fix another esp note 2018-12-12 13:05:00 -05:00
ladyada
654a669b5c fix changed esp8266 menu options 2018-12-12 13:00:44 -05:00
Dan Halbert
7345b3c614
Merge pull request #33 from dhalbert/doxygen-download
ftp.stack.nl is gone; change download location
2018-12-12 10:56:24 -05:00
Dan Halbert
1d4d820fa7 ftp.stack.nl is gone; change download location 2018-12-11 18:12:38 -05:00
dean
a6a4ff40ae DM: add trellis m4 to m4 platforms 2018-11-01 13:52:13 -04:00
Kryštof Černý
cf69420be1 Version bump + note (#31)
* Bump version in install.sh as well

* Add a note about IDE version variable
2018-10-17 11:10:19 -07:00
frazar
a2ededd6ee Bump Arduino IDE version to 1.8.7 (#30) 2018-10-08 09:10:23 -07:00
Kryštof Černý
efa12188d2 Use stable ESP32 library + fixes (#29)
* Use stable esp32 library

* Fixes

* Version bump + cleanup

* Bump IDE version

* Fix

* Switch to old version for testing purposes

* Switch back to newer version of IDE
2018-09-01 08:21:43 -07:00
Kryštof Černý
38c5f8e901 Add more colors and enhance log output (#28)
* Add color definition

* Replace current colors

* Add some yellow and tweak color names

* Fix

* Add more info about Installing Arduino IDE

* Improvements

* Uppercase

* Make esp32 pull silent

* Enhancements

* Fix

* Fix color codes

* Fix checkmarks

* Add more colors!

* Remove not-working coloring

* Remove mkdir warning when cache is on
2018-07-19 06:29:51 -07:00
Kryštof Černý
e38c333761 Major bug fix + fix building PRs on adafruit/travis-ci-arduino (#27)
* Fix install.sh path

* Fix

* Remove newline

* Fix Arduino IDE reinstall

* Use normal blink instead of BlinkPlus
2018-07-18 11:41:36 -07:00
deanm1278
aa64a8fc4a
Merge pull request #26 from adafruit/travis-cache
Travis cache
2018-07-09 17:45:30 -04:00
dean
518f03876a DM: fix? 2018-07-09 17:15:02 -04:00
CornyjK
2e4b76d31a
Add caching support 2018-07-09 20:29:49 +02:00
deanm1278
1f99208418
Merge pull request #24 from adafruit/io-platforms
add io platforms
2018-06-20 14:02:37 -04:00
14 changed files with 1451 additions and 190 deletions

20
.github/workflows/githubci.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: Github Arduino Library CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
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: |
python3 build_platform.py uno leonardo mega2560 zero esp8266 esp32 pico_rp2040

View file

@ -1,13 +1,28 @@
language: c
sudo: false
language: python
dist: focal
cache:
directories:
- ~/arduino_ide
git:
depth: false
quiet: true
before_install:
- source <(curl -SLs https://raw.githubusercontent.com/${TRAVIS_REPO_SLUG}/${TRAVIS_BRANCH}/install.sh)
- source $TRAVIS_BUILD_DIR/install.sh
script:
- build_platform nrf52840
- build_platform esp32
- build_platform uno
- build_platform leonardo
- build_platform zero
- build_platform esp8266
- build_platform m4
notifications:
email:
on_success: change

View file

@ -820,45 +820,11 @@ FILE_PATTERNS = *.c \
*.cxx \
*.cpp \
*.c++ \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.idl \
*.ddl \
*.odl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.cs \
*.d \
*.php \
*.php4 \
*.php5 \
*.phtml \
*.inc \
*.m \
*.markdown \
*.md \
*.mm \
*.dox \
*.py \
*.pyw \
*.f90 \
*.f95 \
*.f03 \
*.f08 \
*.f \
*.for \
*.tcl \
*.vhd \
*.vhdl \
*.ucf \
*.qsf
*.h++
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@ -889,7 +855,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = *.md
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -2099,7 +2065,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED =
PREDEFINED = __cdecl=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

189
README.md
View file

@ -1,9 +1,9 @@
# Travis CI Arduino Init Script [![Build Status](https://travis-ci.org/adafruit/travis-ci-arduino.svg?branch=master)](https://travis-ci.org/adafruit/travis-ci-arduino)
# Travis CI Arduino Init Script [![Build Status](https://travis-ci.com/adafruit/travis-ci-arduino.svg?branch=master)](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/
@ -12,26 +12,59 @@ We have a guide that you can use to follow along to install both TravisCI and Do
You will need to source the script in the `before_install` step of your
`.travis.yml` file.
```
```sh
source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
```
If you only want to install and build on certain platforms, you can set the
`INSTALL_PLATFORMS` environment variable to a comma-separated list of platforms.
**Example `.travis.yml`:**
```
```yaml
language: c
sudo: false
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
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:
# - 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:
- arduino --install-library "Adafruit SleepyDog 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**
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.
## Automated Example Verification Bash Functions
`build_platform` will build all `.ino` examples in the repo using the passed platform. The platforms
@ -41,13 +74,13 @@ All of the examples will be built with the platforms in `MAIN_PLATFORMS` if you
and `AUX_PLATFORMS` can be used to define other platforms that don't need to be verified for every repo.
Build the examples using the platforms in the MAIN_PLATFORMS array:
```
```yaml
script:
- build_main_platforms
```
Build the examples only using the trinket:
```
```yaml
script:
- build_platform trinket
```
@ -62,7 +95,7 @@ you wish to skip.
For example, if you would like to skip the `esp8266` platform for an example
in your lib called `blink.ino`, you would need to do something like this in your library repo:
```
```sh
$ touch examples/blink/.esp8266.test.skip
$ git add -A
$ git commit -a
@ -71,7 +104,7 @@ $ git push
If you need an easy way to skip a platform, you can also add something like this to your `~/.bash_profile`:
```
```sh
function travis_skip()
{
@ -96,6 +129,128 @@ function travis_skip()
You will then be able to skip a platform for all examples by running the `travis_skip` function from your library repo.
It will automatically add the `.YOUR_PLATFORM_HERE.test.skip` files to the examples.
```
```sh
$ travis_skip esp8266
```
## Using external libraries
External libraries (which are not hosted by the Arduino library manager) can be installed using the following command:
```sh
- if [ ! -d "$HOME/arduino_ide/libraries/<Name>" ]; then git clone <URL> $HOME/arduino_ide/libraries/<Name>; fi
```
## Deploying compiled artifacts
If you need to get hold of the compiled sketches of your project, in order to release them or forward them to an
deployment pipeline, you can find them in the `$ARDUINO_HEX_DIR` directory. Specifically, if `Foo` is the name
of your project, you are compiling for an `Arduino Mega` and the primary sketch is called `Foo.ino`, the flashable
`.hex` files will be found inside `$ARDUINO_HEX_DIR/mega2560/Foo` as `Foo.ino.hex` and `Foo.ino.with_bootloader.hex`.
Similarly for the rest of the platforms.
For example, assuming you have a `Foo` project as outlined above, to create a release which includes the `.hex`
files on GitHub, you could add this to your `.travis.yml` configuration:
```yaml
deploy:
provider: releases
api_key:
secure: YOUR_API_KEY_ENCRYPTED
file:
- $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.hex
- $ARDUINO_HEX_DIR/mega2560/Foo/Foo.ino.with_bootloader.hex
skip_cleanup: true
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
View 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
View 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
View 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)

View file

@ -29,7 +29,7 @@ __AUTHOR__="Jeroen de Bruijn, modified by ladyada"
# the gh-pages branch of a repository
# Before this script is used there should already be a gh-pages branch in the
# repository.
#
#
################################################################################
################################################################################
@ -38,10 +38,32 @@ 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 ftp://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.13.linux.bin.tar.gz
wget -q https://cdn-learn.adafruit.com/assets/assets/000/067/405/original/doxygen-1.8.13.linux.bin.tar.gz
tar -xf doxygen-1.8.13.linux.bin.tar.gz
mv doxygen-1.8.13/bin/doxygen .
chmod +x doxygen
@ -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
@ -68,7 +90,7 @@ git config user.email "travis@travis-ci.org"
# can be safely cleaned, and it is sure that everything pushed later is the new
# documentation.
# If there's no index.html (forwarding stub) grab our default one
shopt -s extglob
shopt -s extglob
if [ ! -f index.html ]; then
rm -rf *
curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_index.html > index.html
@ -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. #####
@ -137,7 +165,7 @@ if [ -d "html" ] && [ -f "html/index.html" ]; then
echo 'Adding all files'
git add --all
if [ -n "$(git status --porcelain)" ]; then
if [ -n "$(git status --porcelain)" ]; then
echo "Changes to commit"
else
echo "No changes to commit"
@ -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
View 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

View file

@ -1,27 +1,40 @@
language: c
sudo: false
# Blacklist
branches:
except:
- gh-pages
cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
git:
depth: false
quiet: true
addons:
apt:
sources:
- 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:
# - 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)
- curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/run-clang-format.py > run-clang-format.py
install:
- arduino --install-library "Adafruit ILI9341","Adafruit GFX Library"
script:
- 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)
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)

37
examples/Blink/Blink.ino Normal file
View file

@ -0,0 +1,37 @@
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

View file

@ -1,49 +0,0 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
modified 19 Dec 2015
by Olivier Chatelain
modified 9 Jan 2016
by Olivier Chatelain
For Digispark
*/
// #define LED_PIN_FIRST 0 // First pin
#define LED_PIN_FIRST 1 // Digispark
// #define LED_PIN_FIRST 13 // Arduino UNO
// #define LED_PIN_LAST 19
#ifndef LED_PIN_LAST
#define LED_PIN_LAST LED_PIN_FIRST
#endif
#define DELAY_HIGH_ON 400
#define DELAY_LOW_OFF 600
// the setup function runs once when you press reset or power the board
void setup() {
// initialize the pin range "first" to "last" as an output.
for(int i = LED_PIN_FIRST; i <= LED_PIN_LAST; i++) pinMode(i, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
for(int i = LED_PIN_FIRST; i <= LED_PIN_LAST; i++) digitalWrite(i, HIGH); // turn the LED on (HIGH is the voltage level)
delay( DELAY_HIGH_ON ); // wait for a second
for(int i = LED_PIN_FIRST; i <= LED_PIN_LAST; i++) digitalWrite(i, LOW); // turn the LED off by making the voltage LOW
delay( DELAY_LOW_OFF ); // wait for a second
}

364
install.sh Normal file → Executable file
View file

@ -8,87 +8,156 @@ fi
# associative array for the platforms that will be verified in build_main_platforms()
# this will be eval'd in the functions below because arrays can't be exported
# Uno is ATmega328, Zero is SAMD21G18, ESP8277, Leonardo is ATmega32u4, M4 is SAMD51, Mega is ATmega2560, ESP32
export MAIN_PLATFORMS='declare -A main_platforms=( [uno]="arduino:avr:uno" [due]="arduino:sam:arduino_due_x" [zero]="arduino:samd:arduino_zero_native" [esp8266]="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80" [leonardo]="arduino:avr:leonardo" [m4]="adafruit:samd:adafruit_metro_m4" [mega2560]="arduino:avr:mega:cpu=atmega2560" [esp32]="espressif:esp32:featheresp32:FlashFreq=80" )'
# Uno is ATmega328, Zero is SAMD21G18, ESP8266, Leonardo is ATmega32u4, M4 is SAMD51, Mega is ATmega2560, ESP32
export MAIN_PLATFORMS='declare -A main_platforms=( [uno]="arduino:avr:uno" [zero]="arduino:samd:arduino_zero_native" [esp8266]="esp8266:esp8266:huzzah:eesz=4M3M,xtal=80" [leonardo]="arduino:avr:leonardo" [m4]="adafruit:samd:adafruit_metro_m4:speed=120" [mega2560]="arduino:avr:mega:cpu=atmega2560" [esp32]="esp32:esp32:featheresp32:FlashFreq=80" )'
# associative array for other platforms that can be called explicitly in .travis.yml configs
# this will be eval'd in the functions below because arrays can't be exported
export AUX_PLATFORMS='declare -A aux_platforms=( [trinket]="adafruit:avr:trinket5" [gemma]="arduino:avr:gemma" )'
export CPLAY_PLATFORMS='declare -A cplay_platforms=( [cplayClassic]="arduino:avr:circuitplay32u4cat" [cplayExpress]="arduino:samd:adafruit_circuitplayground_m0" ) '
export CPLAY_PLATFORMS='declare -A cplay_platforms=( [cplayClassic]="arduino:avr:circuitplay32u4cat" [cplayExpress]="arduino:samd:adafruit_circuitplayground_m0" [cplayExpressAda]="adafruit:samd:adafruit_circuitplayground_m0" [cplayBluefruit]="adafruit:nrf52:cplaynrf52840:softdevice=s140v6,debug=l0" )'
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" )'
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" )'
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 IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero_native" [esp8266]="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80" [esp32]="espressif:esp32:featheresp32:FlashFreq=80" )'
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" )'
export IO_PLATFORMS='declare -A io_platforms=( [zero]="arduino:samd:arduino_zero_native", [m4wifi]="adafruit:samd:adafruit_metro_m4_airliftlite:speed=120", [esp8266]="esp8266:esp8266:huzzah:eesz=4M3M,xtal=80" [esp32]="esp32:esp32:featheresp32:FlashFreq=80" )'
export NRF5X_PLATFORMS='declare -A nrf5x_platforms=( [nrf52840]="adafruit:nrf52:feather52840:softdevice=s140v6,debug=l0")'
# make display available for arduino CLI
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
sleep 3
export DISPLAY=:1.0
# download and install arduino 1.8.5
wget --quiet https://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
tar xf arduino-1.8.5-linux64.tar.xz
mv arduino-1.8.5 $HOME/arduino_ide
#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';
# move this library to the arduino libraries folder
ln -s $PWD $HOME/arduino_ide/libraries/Adafruit_Test_Library
echo -e "\n########################################################################";
echo -e "${YELLOW}INSTALLING ARDUINO IDE"
echo "########################################################################";
# if .travis.yml does not set version
if [ -z $ARDUINO_IDE_VERSION ]; then
export ARDUINO_IDE_VERSION="1.8.11"
echo "NOTE: YOUR .TRAVIS.YML DOES NOT SPECIFY ARDUINO IDE VERSION, USING $ARDUINO_IDE_VERSION"
fi
# if newer version is requested
if [ ! -f $HOME/arduino_ide/$ARDUINO_IDE_VERSION ] && [ -f $HOME/arduino_ide/arduino ]; then
echo -n "DIFFERENT VERSION OF ARDUINO IDE REQUESTED: "
shopt -s extglob
cd $HOME/arduino_ide/
rm -rf *
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
cd $OLDPWD
fi
# if not already cached, download and install arduino IDE
echo -n "ARDUINO IDE STATUS: "
if [ ! -f $HOME/arduino_ide/arduino ]; then
echo -n "DOWNLOADING: "
wget --quiet https://downloads.arduino.cc/arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
echo -n "UNPACKING ARDUINO IDE: "
[ ! -d $HOME/arduino_ide/ ] && mkdir $HOME/arduino_ide
tar xf arduino-$ARDUINO_IDE_VERSION-linux64.tar.xz -C $HOME/arduino_ide/ --strip-components=1
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
touch $HOME/arduino_ide/$ARDUINO_IDE_VERSION
else
echo -n "CACHED: "
echo -e """$GREEN""\xe2\x9c\x93"
fi
# 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"
echo -e "\n########################################################################";
echo "INSTALLING DEPENDENCIES"
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 due, esp8266, and adafruit board packages
# install the zero, esp8266, and adafruit board packages
echo -n "ADD PACKAGE INDEX: "
DEPENDENCY_OUTPUT=$(arduino --pref "boardsmanager.additional.urls=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
DEPENDENCY_OUTPUT=$(arduino --pref "boardsmanager.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" --save-prefs 2>&1)
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
echo -n "ESP32: "
DEPENDENCY_OUTPUT=$(mkdir -p $HOME/Arduino/hardware/espressif &&
cd $HOME/Arduino/hardware/espressif &&
git clone https://github.com/espressif/arduino-esp32.git esp32 &&
cd esp32/tools/ &&
python get.py &&
cd $TRAVIS_BUILD_DIR
)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
# This is a hack, we have to install by hand so lets delete it
echo "Removing ESP32 cache"
rm -rf ~/.arduino15/packages/esp32
echo -n "Current packages list:"
[ -d ~/.arduino15/packages/ ] && ls ~/.arduino15/packages/
echo -n "DUE: "
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:sam 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
INSTALL_ESP32=$([[ $INSTALL_PLATFORMS == *"esp32"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
INSTALL_ZERO=$([[ $INSTALL_PLATFORMS == *"zero"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
INSTALL_ESP8266=$([[ $INSTALL_PLATFORMS == *"esp8266"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
INSTALL_AVR=$([[ $INSTALL_PLATFORMS == *"avr"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
INSTALL_SAMD=$([[ $INSTALL_PLATFORMS == *"samd"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
INSTALL_NRF52=$([[ $INSTALL_PLATFORMS == *"nrf52"* || -z "$INSTALL_PLATFORMS" ]] && echo 1 || echo 0)
echo -n "ZERO: "
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
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
echo -n "ESP8266: "
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [[ $INSTALL_ZERO == 1 ]]; then
echo -n "ZERO: "
DEPENDENCY_OUTPUT=$(arduino --install-boards arduino:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
fi
echo -n "ADAFRUIT AVR: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [[ $INSTALL_ESP8266 == 1 ]]; then
echo -n "ESP8266: "
DEPENDENCY_OUTPUT=$(arduino --install-boards esp8266:esp8266 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
fi
echo -n "ADAFRUIT SAMD: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [[ $INSTALL_AVR == 1 ]]; then
echo -n "ADAFRUIT AVR: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:avr 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
fi
if [[ $INSTALL_SAMD == 1 ]]; then
echo -n "ADAFRUIT SAMD: "
DEPENDENCY_OUTPUT=$(arduino --install-boards adafruit:samd 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96 OR CACHED"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
fi
if [[ $INSTALL_NRF52 == 1 ]]; then
echo -n "ADAFRUIT NRF5X: "
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
# install random lib so the arduino IDE grabs a new library index
# see: https://github.com/arduino/Arduino/issues/3535
echo -n "UPDATE LIBRARY INDEX: "
DEPENDENCY_OUTPUT=$(arduino --install-library USBHost > /dev/null 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
# set the maximal compiler warning level
echo -n "SET BUILD PREFERENCES: "
DEPENDENCY_OUTPUT=$(arduino --pref "compiler.warning_level=all" --save-prefs 2>&1)
if [ $? -ne 0 ]; then echo -e "\xe2\x9c\x96"; else echo -e "\xe2\x9c\x93"; fi
if [ $? -ne 0 ]; then echo -e """$RED""\xe2\x9c\x96"; else echo -e """$GREEN""\xe2\x9c\x93"; fi
# init the json temp var for the current platform
export PLATFORM_JSON=""
@ -98,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()
{
@ -108,7 +179,9 @@ function build_platform()
eval $AUX_PLATFORMS
eval $CPLAY_PLATFORMS
eval $M4_PLATFORMS
eval $ARCADA_PLATFORMS
eval $IO_PLATFORMS
eval $NRF5X_PLATFORMS
# reset platform json var
PLATFORM_JSON=""
@ -125,8 +198,20 @@ function build_platform()
# grab all pde and ino example sketches
declare -a examples
# loop through results and add them to the array
examples=($(find $PWD -name "*.pde" -o -name "*.ino"))
if [ "$PLATFORM_CHECK_ONLY_ON_FILE" = true ]; then
# loop through results and add them to the array
examples=($(
for f in $(find . -type f -iname '*.ino' -o -iname '*.pde'); do
# TODO: distinguish platforms
if [ -e "$(dirname $f)/.$platform_key.test" ]; then
echo "$f"
fi
done
))
else
# loop through results and add them to the array
examples=($(find $PWD -name "*.pde" -o -name "*.ino"))
fi
# get the last example in the array
local last="${examples[@]:(-1)}"
@ -140,8 +225,12 @@ function build_platform()
platform=${cplay_platforms[$platform_key]}
elif [[ ${m4_platforms[$platform_key]} ]]; then
platform=${m4_platforms[$platform_key]}
elif [[ ${arcada_platforms[$platform_key]} ]]; then
platform=${arcada_platforms[$platform_key]}
elif [[ ${io_platforms[$platform_key]} ]]; then
platform=${io_platforms[$platform_key]}
elif [[ ${nrf5x_platforms[$platform_key]} ]]; then
platform=${nrf5x_platforms[$platform_key]}
else
echo "NON-STANDARD PLATFORM KEY: $platform_key"
platform=$platform_key
@ -149,7 +238,7 @@ function build_platform()
echo -e "\n########################################################################";
echo -n "SWITCHING TO ${platform_key}: "
echo -e -n "${YELLOW}SWITCHING TO ${platform_key}: "
# switch to the requested board.
# we have to avoid reading the exit code of local:
@ -163,12 +252,13 @@ function build_platform()
# notify if the platform switch failed
if [ $platform_switch -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e """$RED""\xe2\x9c\x96"
echo -e "arduino --board ${platform} --save-prefs 2>&1"
echo $platform_stdout
exit_code=1
else
# heavy checkmark
echo -e "\xe2\x9c\x93"
echo -e """$GREEN""\xe2\x9c\x93"
fi
echo "########################################################################";
@ -193,7 +283,7 @@ function build_platform()
# continue to next example if platform switch failed
if [ $platform_switch -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e """$RED""\xe2\x9c\x96"
# add json
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 0 $example_file $last_example)"
@ -243,10 +333,10 @@ function build_platform()
if [[ $example =~ \.pde$ ]]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e """$RED""\xe2\x9c\x96"
echo -e "-------------------------- DEBUG OUTPUT --------------------------\n"
echo "PDE EXTENSION. PLEASE UPDATE TO INO"
echo "${LRED}PDE EXTENSION. PLEASE UPDATE TO INO"
echo -e "\n------------------------------------------------------------------\n"
# add json
@ -262,17 +352,21 @@ function build_platform()
fi
# get the sketch name so we can place the generated files in the respective folder
local sketch_filename_with_ending=$(basename -- "$example")
local sketch_filename="${sketch_filename_with_ending%.*}"
local build_path=$ARDUINO_HEX_DIR/$platform_key/$sketch_filename
# verify the example, and save stdout & stderr to a variable
# we have to avoid reading the exit code of local:
# "when declaring a local variable in a function, the local acts as a command in its own right"
local build_stdout
build_stdout=$(arduino --verify $example 2>&1)
build_stdout=$(arduino --verify --pref build.path=$build_path --preserve-temp-files $example 2>&1)
# echo output if the build failed
if [ $? -ne 0 ]; then
# heavy X
echo -e "\xe2\x9c\x96"
echo -e """$RED""\xe2\x9c\x96"
echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n"
echo "$build_stdout"
@ -290,7 +384,7 @@ function build_platform()
else
# heavy checkmark
echo -e "\xe2\x9c\x93"
echo -e """$GREEN""\xe2\x9c\x93"
# add json
PLATFORM_JSON="${PLATFORM_JSON}$(json_sketch 1 "$example_file" $last_example)"
@ -306,7 +400,7 @@ function build_platform()
}
# build all examples for every platform in $main_platforms
# build all examples for every platform in $MAIN_PLATFORMS
function build_main_platforms()
{
@ -355,6 +449,54 @@ function build_main_platforms()
}
# build all examples for every platform in $AUX_PLATFORMS
function build_aux_platforms()
{
# arrays can't be exported, so we have to eval
eval $AUX_PLATFORMS
# track the build status all platforms
local exit_code=0
# var to hold platforms
local platforms_json=""
# get the last element in the array
local last="${aux_platforms[@]:(-1)}"
# loop through platforms in main platforms assoc array
for p_key in "${!aux_platforms[@]}"; do
# is this the last platform in the loop
local last_platform=0
if [ "$last" == "${aux_platforms[$p_key]}" ]; then
last_platform=1
fi
# build all examples for this platform
build_platform $p_key
# check if build failed
if [ $? -ne 0 ]; then
platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)"
exit_code=1
else
platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)"
fi
done
# exit code is opposite of json build status
if [ $exit_code -eq 0 ]; then
json_main_platforms 1 "$platforms_json"
else
json_main_platforms 0 "$platforms_json"
fi
return $exit_code
}
function build_cplay_platforms()
{
@ -547,6 +689,106 @@ function build_io_platforms()
}
function build_arcada_platforms()
{
# arrays can't be exported, so we have to eval
eval $ARCADA_PLATFORMS
# track the build status all platforms
local exit_code=0
# var to hold platforms
local platforms_json=""
# get the last element in the array
local last="${arcada_platforms[@]:(-1)}"
# loop through platforms in main platforms assoc array
for p_key in "${!arcada_platforms[@]}"; do
# is this the last platform in the loop
local last_platform=0
if [ "$last" == "${arcada_platforms[$p_key]}" ]; then
last_platform=1
fi
# build all examples for this platform
build_platform $p_key
# check if build failed
if [ $? -ne 0 ]; then
platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)"
exit_code=1
else
platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)"
fi
done
# exit code is opposite of json build status
if [ $exit_code -eq 0 ]; then
json_main_platforms 1 "$platforms_json"
else
json_main_platforms 0 "$platforms_json"
fi
return $exit_code
}
function build_nrf5x_platforms()
{
# arrays can't be exported, so we have to eval
eval $NRF5X_PLATFORMS
# track the build status all platforms
local exit_code=0
# var to hold platforms
local platforms_json=""
# get the last element in the array
local last="${nrf5x_platforms[@]:(-1)}"
# loop through platforms in main platforms assoc array
for p_key in "${!nrf5x_platforms[@]}"; do
# is this the last platform in the loop
local last_platform=0
if [ "$last" == "${nrf5x_platforms[$p_key]}" ]; then
last_platform=1
fi
# build all examples for this platform
build_platform $p_key
# check if build failed
if [ $? -ne 0 ]; then
platforms_json="${platforms_json}$(json_platform $p_key 0 "$PLATFORM_JSON" $last_platform)"
exit_code=1
else
platforms_json="${platforms_json}$(json_platform $p_key 1 "$PLATFORM_JSON" $last_platform)"
fi
done
# exit code is opposite of json build status
if [ $exit_code -eq 0 ]; then
json_main_platforms 1 "$platforms_json"
else
json_main_platforms 0 "$platforms_json"
fi
return $exit_code
}
# generate json string for a sketch
function json_sketch()
{
@ -619,4 +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

325
run-clang-format.py Normal file
View file

@ -0,0 +1,325 @@
#!/usr/bin/env python
"""A wrapper script around clang-format, suitable for linting multiple files
and to use for continuous integration.
This is an alternative API for the clang-format command line.
It runs over multiple files and directories in parallel.
A diff output is produced and a sensible exit code is returned.
"""
from __future__ import print_function, unicode_literals
import argparse
import codecs
import difflib
import fnmatch
import io
import multiprocessing
import os
import signal
import subprocess
import sys
import traceback
from functools import partial
DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
class ExitStatus:
SUCCESS = 0
DIFF = 1
TROUBLE = 2
def list_files(files, recursive=False, extensions=None, exclude=None):
if extensions is None:
extensions = []
if exclude is None:
exclude = []
out = []
for file in files:
if recursive and os.path.isdir(file):
for dirpath, dnames, fnames in os.walk(file):
fpaths = [os.path.join(dirpath, fname) for fname in fnames]
for pattern in exclude:
# os.walk() supports trimming down the dnames list
# by modifying it in-place,
# to avoid unnecessary directory listings.
dnames[:] = [
x for x in dnames
if
not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)
]
fpaths = [
x for x in fpaths if not fnmatch.fnmatch(x, pattern)
]
for f in fpaths:
ext = os.path.splitext(f)[1][1:]
if ext in extensions:
out.append(f)
else:
out.append(file)
return out
def make_diff(file, original, reformatted):
return list(
difflib.unified_diff(
original,
reformatted,
fromfile='{}\t(original)'.format(file),
tofile='{}\t(reformatted)'.format(file),
n=3))
class DiffError(Exception):
def __init__(self, message, errs=None):
super(DiffError, self).__init__(message)
self.errs = errs or []
class UnexpectedError(Exception):
def __init__(self, message, exc=None):
super(UnexpectedError, self).__init__(message)
self.formatted_traceback = traceback.format_exc()
self.exc = exc
def run_clang_format_diff_wrapper(args, file):
try:
ret = run_clang_format_diff(args, file)
return ret
except DiffError:
raise
except Exception as e:
raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,
e), e)
def run_clang_format_diff(args, file):
try:
with io.open(file, 'r', encoding='utf-8') as f:
original = f.readlines()
except IOError as exc:
raise DiffError(str(exc))
invocation = [args.clang_format_executable, file]
# Use of utf-8 to decode the process output.
#
# Hopefully, this is the correct thing to do.
#
# It's done due to the following assumptions (which may be incorrect):
# - clang-format will returns the bytes read from the files as-is,
# without conversion, and it is already assumed that the files use utf-8.
# - if the diagnostics were internationalized, they would use utf-8:
# > Adding Translations to Clang
# >
# > Not possible yet!
# > Diagnostic strings should be written in UTF-8,
# > the client can translate to the relevant code page if needed.
# > Each translation completely replaces the format string
# > for the diagnostic.
# > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation
#
# It's not pretty, due to Python 2 & 3 compatibility.
encoding_py3 = {}
if sys.version_info[0] >= 3:
encoding_py3['encoding'] = 'utf-8'
try:
proc = subprocess.Popen(
invocation,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
**encoding_py3)
except OSError as exc:
raise DiffError(str(exc))
proc_stdout = proc.stdout
proc_stderr = proc.stderr
if sys.version_info[0] < 3:
# make the pipes compatible with Python 3,
# reading lines should output unicode
encoding = 'utf-8'
proc_stdout = codecs.getreader(encoding)(proc_stdout)
proc_stderr = codecs.getreader(encoding)(proc_stderr)
# hopefully the stderr pipe won't get full and block the process
outs = list(proc_stdout.readlines())
errs = list(proc_stderr.readlines())
proc.wait()
if proc.returncode:
raise DiffError("clang-format exited with status {}: '{}'".format(
proc.returncode, file), errs)
return make_diff(file, original, outs), errs
def bold_red(s):
return '\x1b[1m\x1b[31m' + s + '\x1b[0m'
def colorize(diff_lines):
def bold(s):
return '\x1b[1m' + s + '\x1b[0m'
def cyan(s):
return '\x1b[36m' + s + '\x1b[0m'
def green(s):
return '\x1b[32m' + s + '\x1b[0m'
def red(s):
return '\x1b[31m' + s + '\x1b[0m'
for line in diff_lines:
if line[:4] in ['--- ', '+++ ']:
yield bold(line)
elif line.startswith('@@ '):
yield cyan(line)
elif line.startswith('+'):
yield green(line)
elif line.startswith('-'):
yield red(line)
else:
yield line
def print_diff(diff_lines, use_color):
if use_color:
diff_lines = colorize(diff_lines)
if sys.version_info[0] < 3:
sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
else:
sys.stdout.writelines(diff_lines)
def print_trouble(prog, message, use_colors):
error_text = 'error:'
if use_colors:
error_text = bold_red(error_text)
print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--clang-format-executable',
metavar='EXECUTABLE',
help='path to the clang-format executable',
default='clang-format')
parser.add_argument(
'--extensions',
help='comma separated list of file extensions (default: {})'.format(
DEFAULT_EXTENSIONS),
default=DEFAULT_EXTENSIONS)
parser.add_argument(
'-r',
'--recursive',
action='store_true',
help='run recursively over directories')
parser.add_argument('files', metavar='file', nargs='+')
parser.add_argument(
'-q',
'--quiet',
action='store_true')
parser.add_argument(
'-j',
metavar='N',
type=int,
default=0,
help='run N clang-format jobs in parallel'
' (default number of cpus + 1)')
parser.add_argument(
'--color',
default='auto',
choices=['auto', 'always', 'never'],
help='show colored diff (default: auto)')
parser.add_argument(
'-e',
'--exclude',
metavar='PATTERN',
action='append',
default=[],
help='exclude paths matching the given glob-like pattern(s)'
' from recursive search')
args = parser.parse_args()
# use default signal handling, like diff return SIGINT value on ^C
# https://bugs.python.org/issue14229#msg156446
signal.signal(signal.SIGINT, signal.SIG_DFL)
try:
signal.SIGPIPE
except AttributeError:
# compatibility, SIGPIPE does not exist on Windows
pass
else:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
colored_stdout = False
colored_stderr = False
if args.color == 'always':
colored_stdout = True
colored_stderr = True
elif args.color == 'auto':
colored_stdout = sys.stdout.isatty()
colored_stderr = sys.stderr.isatty()
retcode = ExitStatus.SUCCESS
files = list_files(
args.files,
recursive=args.recursive,
exclude=args.exclude,
extensions=args.extensions.split(','))
if not files:
return
njobs = args.j
if njobs == 0:
njobs = multiprocessing.cpu_count() + 1
njobs = min(len(files), njobs)
if njobs == 1:
# execute directly instead of in a pool,
# less overhead, simpler stacktraces
it = (run_clang_format_diff_wrapper(args, file) for file in files)
pool = None
else:
pool = multiprocessing.Pool(njobs)
it = pool.imap_unordered(
partial(run_clang_format_diff_wrapper, args), files)
while True:
try:
outs, errs = next(it)
except StopIteration:
break
except DiffError as e:
print_trouble(parser.prog, str(e), use_colors=colored_stderr)
retcode = ExitStatus.TROUBLE
sys.stderr.writelines(e.errs)
except UnexpectedError as e:
print_trouble(parser.prog, str(e), use_colors=colored_stderr)
sys.stderr.write(e.formatted_traceback)
retcode = ExitStatus.TROUBLE
# stop at the first unexpected error,
# something could be very wrong,
# don't process all files unnecessarily
if pool:
pool.terminate()
break
else:
sys.stderr.writelines(errs)
if outs == []:
continue
if not args.quiet:
print_diff(outs, use_color=colored_stdout)
if retcode == ExitStatus.SUCCESS:
retcode = ExitStatus.DIFF
return retcode
if __name__ == '__main__':
sys.exit(main())