Skip to content

Commit 6eb6134

Browse files
committed
build examples in CI using github actions
The examples are built for various different boards/platforms. Where necessary, examples were changed to enable compilation also for ESP8266 and ESP32 platforms.
1 parent 47e033b commit 6eb6134

File tree

9 files changed

+81
-16
lines changed

9 files changed

+81
-16
lines changed

.github/workflows/build.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
name: build
10+
jobs:
11+
12+
build:
13+
runs-on: ubuntu-20.04
14+
steps:
15+
- name: checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: install python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.8'
22+
23+
- name: install platformio
24+
run: |
25+
pip install platformio==5.0.3
26+
27+
- name: build FastLED examples
28+
run: ./ci/ci-compile

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FastLED/public)
22
[![arduino-library-badge](https://www.ardu-badge.com/badge/FastLED.svg)](https://www.ardu-badge.com/FastLED)
3+
![build status](https://github.com/FastLED/FastLED/workflows/build/badge.svg)
34

45
IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later.
56

ci/ci-compile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
#
3+
# compile FastLED examples with platformio for various boards. This script
4+
# is usually run by the CI, but can also be run locally. Only dependency
5+
# is platformio.
6+
#
7+
# usage:
8+
# [BOARDS=boards] [EXAMPLES=examples] ./ci-compile
9+
#
10+
# e.g.
11+
# $ ./compile-ci
12+
# - compile all board/examples combinations
13+
#
14+
# $ BOARDS="esp32 esp01" EXAMPLES=Blink ./compile-ci
15+
# - compile only Blink example for the esp32 and esp8266 platforms
16+
#
17+
set -eou pipefail
18+
19+
# List of examples that will be compiled by default
20+
EXAMPLES=${EXAMPLES:-"Blink ColorPalette ColorTemperature Cylon DemoReel100
21+
Fire2012 FirstLight Multiple/MultipleStripsInOneArray
22+
Multiple/ArrayOfLedArrays Noise NoisePlayground NoisePlusPalette Pacifica
23+
Pride2015 RGBCalibrate RGBSetDemo TwinkleFox XYMatrix"}
24+
25+
# list of boards to compile for by default
26+
BOARDS=${BOARDS:-"uno esp32dev esp01 yun digix teensy30"}
27+
28+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
29+
BOARD_OPTS=$(for b in $BOARDS; do echo -n "--board $b "; done)
30+
31+
cd "$DIR/.."
32+
33+
for d in $EXAMPLES ; do
34+
echo "*** building example $d for $BOARDS ***"
35+
pio ci $BOARD_OPTS --lib=src "examples/$d/"*ino
36+
done

examples/Cylon/Cylon.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// For led chips like Neopixels, which have a data line, ground, and power, you just
77
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
88
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
9-
#define DATA_PIN 7
9+
#define DATA_PIN 2
1010
#define CLOCK_PIN 13
1111

1212
// Define the array of leds

examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];
1212
// For mirroring strips, all the "special" stuff happens just in setup. We
1313
// just addLeds multiple times, once for each strip
1414
void setup() {
15-
// tell FastLED there's 60 NEOPIXEL leds on pin 10
16-
FastLED.addLeds<NEOPIXEL, 10>(leds[0], NUM_LEDS_PER_STRIP);
15+
// tell FastLED there's 60 NEOPIXEL leds on pin 2
16+
FastLED.addLeds<NEOPIXEL, 2>(leds[0], NUM_LEDS_PER_STRIP);
1717

18-
// tell FastLED there's 60 NEOPIXEL leds on pin 11
19-
FastLED.addLeds<NEOPIXEL, 11>(leds[1], NUM_LEDS_PER_STRIP);
18+
// tell FastLED there's 60 NEOPIXEL leds on pin 3
19+
FastLED.addLeds<NEOPIXEL, 3>(leds[1], NUM_LEDS_PER_STRIP);
2020

21-
// tell FastLED there's 60 NEOPIXEL leds on pin 12
22-
FastLED.addLeds<NEOPIXEL, 12>(leds[2], NUM_LEDS_PER_STRIP);
21+
// tell FastLED there's 60 NEOPIXEL leds on pin 4
22+
FastLED.addLeds<NEOPIXEL, 4>(leds[2], NUM_LEDS_PER_STRIP);
2323

2424
}
2525

examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
1313
// For mirroring strips, all the "special" stuff happens just in setup. We
1414
// just addLeds multiple times, once for each strip
1515
void setup() {
16-
// tell FastLED there's 60 NEOPIXEL leds on pin 10, starting at index 0 in the led array
17-
FastLED.addLeds<NEOPIXEL, 10>(leds, 0, NUM_LEDS_PER_STRIP);
16+
// tell FastLED there's 60 NEOPIXEL leds on pin 2, starting at index 0 in the led array
17+
FastLED.addLeds<NEOPIXEL, 2>(leds, 0, NUM_LEDS_PER_STRIP);
1818

19-
// tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array
20-
FastLED.addLeds<NEOPIXEL, 11>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
19+
// tell FastLED there's 60 NEOPIXEL leds on pin 3, starting at index 60 in the led array
20+
FastLED.addLeds<NEOPIXEL, 3>(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
2121

22-
// tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array
23-
FastLED.addLeds<NEOPIXEL, 12>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
22+
// tell FastLED there's 60 NEOPIXEL leds on pin 4, starting at index 120 in the led array
23+
FastLED.addLeds<NEOPIXEL, 4>(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
2424

2525
}
2626

examples/Noise/Noise.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void setup() {
6969
// Serial.begin(38400);
7070
// Serial.println("resetting!");
7171
delay(3000);
72-
LEDS.addLeds<WS2811,5,RGB>(leds,NUM_LEDS);
72+
LEDS.addLeds<WS2811,2,RGB>(leds,NUM_LEDS);
7373
LEDS.setBrightness(96);
7474

7575
// Initialize our coordinates to some random values

examples/NoisePlayground/NoisePlayground.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void setup() {
6161
Serial.println("resetting!");
6262

6363
delay(3000);
64-
LEDS.addLeds<WS2811,6,GRB>(leds,NUM_LEDS);
64+
LEDS.addLeds<WS2811,2,GRB>(leds,NUM_LEDS);
6565
LEDS.setBrightness(96);
6666

6767
hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16();

examples/RGBSetDemo/RGBSetDemo.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
CRGBArray<NUM_LEDS> leds;
55

6-
void setup() { FastLED.addLeds<NEOPIXEL,6>(leds, NUM_LEDS); }
6+
void setup() { FastLED.addLeds<NEOPIXEL,2>(leds, NUM_LEDS); }
77

88
void loop(){
99
static uint8_t hue;

0 commit comments

Comments
 (0)