File tree 4 files changed +62
-11
lines changed
4 files changed +62
-11
lines changed Original file line number Diff line number Diff line change 34
34
- uses : actions/setup-python@v4
35
35
with :
36
36
python-version : ' 3.9'
37
+ - name : Install jq
38
+ run : sudo apt-get install -yq jq
37
39
- name : Install PlatformIO Core
38
40
run : pip install --upgrade platformio
39
41
- name : Build examples
40
- run : |
41
- for example in examples/*; do
42
- cd "$example"
43
- platformio init --board ${{ matrix.board }}
44
- grep -q ArduinoJson *.ino && echo "lib_deps = bblanchon/ArduinoJson" >> platformio.ini
45
- mv *.ino src/
46
- ln -s ../../../ lib/PicoMQTT
47
- pio run
48
- cd ../..
49
- done
42
+ run : ./build_examples.sh ${{ matrix.board }}
Original file line number Diff line number Diff line change 1
1
.pio
2
2
* .orig
3
3
* .tar.gz
4
- * .sh
4
+ /examples.build
5
+ /config.h
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [ " $# " -ne 1 ]
4
+ then
5
+ echo " Usage: $0 <pio-board-name>"
6
+ exit 1
7
+ fi
8
+
9
+ set -e
10
+
11
+ cd " $( dirname " $0 " ) "
12
+
13
+ mkdir -p examples.build
14
+ ROOT_DIR=$PWD
15
+
16
+ BOARD=" $1 "
17
+ PLATFORM=" $( pio boards --json-output | jq -r " .[] | select(.id == \" $BOARD \" ) | .platform" ) "
18
+
19
+ if [ -z " $PLATFORM " ]
20
+ then
21
+ echo " Unknown board $BOARD "
22
+ exit 2
23
+ fi
24
+
25
+ find examples -mindepth 1 -type d | cut -d/ -f2 | sort | while read -r EXAMPLE
26
+ do
27
+ COMPATIBLE_PLATFORMS=" $( grep -hoiE ' platform compatibility:.*' " $ROOT_DIR /examples/$EXAMPLE /" * | cut -d: -f2- | head -n1) "
28
+ DEPENDENCIES=" $( grep -hoiE ' dependencies:.*' " $ROOT_DIR /examples/$EXAMPLE /" * | cut -d: -f2- | head -n1) "
29
+ echo " $EXAMPLE :$COMPATIBLE_PLATFORMS "
30
+ if [ -n " $COMPATIBLE_PLATFORMS " ] && ! echo " $COMPATIBLE_PLATFORMS " | grep -qFiw " $PLATFORM "
31
+ then
32
+ echo " $EXAMPLE : This example is not compatible with this platform"
33
+ continue
34
+ fi
35
+
36
+ mkdir -p examples.build/$BOARD /$EXAMPLE
37
+ pushd examples.build/$BOARD /$EXAMPLE
38
+ if [ ! -f platformio.ini ]
39
+ then
40
+ pio init --board=$BOARD
41
+ echo " monitor_speed = 115200" >> platformio.ini
42
+ echo " upload_speed = 921600" >> platformio.ini
43
+ if [ -n " $DEPENDENCIES " ]
44
+ then
45
+ echo " lib_deps = $DEPENDENCIES " >> platformio.ini
46
+ fi
47
+ fi
48
+ ln -s -f -t src/ " $ROOT_DIR /examples/$EXAMPLE /" *
49
+ ln -s -f -t lib/ " $ROOT_DIR "
50
+ if [ -e " $ROOT_DIR /config.h" ]
51
+ then
52
+ ln -s -f -t src/ " $ROOT_DIR /config.h"
53
+ fi
54
+ pio run
55
+ popd
56
+ done
Original file line number Diff line number Diff line change
1
+ // dependencies: bblanchon/ArduinoJson
1
2
#include < PicoMQTT.h>
2
3
3
4
#if __has_include("config.h")
You can’t perform that action at this time.
0 commit comments