-
Notifications
You must be signed in to change notification settings - Fork 25
137 lines (119 loc) · 5.97 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
board:
- esp32:esp32:esp32:DebugLevel=none
- esp32:esp32:esp32:DebugLevel=verbose
- esp32:esp32:firebeetle32
#- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_V1
#- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_V2
- esp32:esp32:ttgo-lora32:Revision=TTGO_LoRa32_v21new
- esp32:esp32:heltec_wireless_stick:PSRAM=disabled
- esp32:esp32:heltec_wifi_lora_32_V2
- esp32:esp32:heltec_wifi_lora_32_V3
- esp32:esp32:adafruit_feather_esp32s2
- esp32:esp32:featheresp32
- esp8266:esp8266:generic:dbg=Disabled
- esp8266:esp8266:generic:dbg=Serial
- rp2040:rp2040:adafruit_feather:dbgport=Serial
runs-on: ubuntu-latest
name: ${{ matrix.board }}
env:
run-build: ${{ contains(matrix.board, 'esp32:esp32') || contains(matrix.board, 'esp8266:esp8266') || contains(matrix.board, 'rp2040:rp2040') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.board)) }}
steps:
- name: Install arduino-cli
if: ${{ env.run-build == 'true' }}
run:
|
mkdir -p ~/.local/bin
echo "~/.local/bin" >> $GITHUB_PATH
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/.local/bin sh
- name: Get platform name
if: ${{ env.run-build == 'true' }}
uses: jungwinter/split@v2
id: split
with:
msg: ${{ matrix.board }}
separator: ':'
- name: Prepare platform-specific settings
if: ${{ env.run-build == 'true' }}
id: prep
run:
|
# common settings - no extra options, skip nothing, all warnings
echo "options=''" >> $GITHUB_OUTPUT
echo "logdef=''" >> $GITHUB_OUTPUT
echo "skip-pattern=(Feather32u4).*ino" >> $GITHUB_OUTPUT
echo "warnings='all'" >> $GITHUB_OUTPUT
#if [[ "${{ contains(matrix.loglevel, 'LOG_LEVEL_NONE') }}" == "true" ]]; then
# echo "logdef=--build-property "build.extra_flags=\"-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE\" >> $GITHUB_OUTPUT
#
#elif [[ "${{ contains(matrix.loglevel, 'LOG_LEVEL_VERBOSE') }}" == "true" ]]; then
# echo "logdef=--build-property "build.extra_flags=\"-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE\" >> $GITHUB_OUTPUT
#fi
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
if [[ "${{ contains(matrix.board, 'esp32:esp32') }}" == "true" ]]; then
# ESP32
python -m pip install pyserial
echo "index-url=--additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" >> $GITHUB_OUTPUT
elif [[ "${{ contains(matrix.board, 'esp8266:esp8266') }}" == "true" ]]; then
# ESP8266
echo "options=,xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
#echo "skip-pattern=(HTTP|MQTT).*ino" >> $GITHUB_OUTPUT
elif [[ "${{ contains(matrix.board, 'rp2040:rp2040') }}" == "true" ]]; then
# RP2040
#echo "options=,xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K" >> $GITHUB_OUTPUT
echo "index-url=--additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" >> $GITHUB_OUTPUT
echo "skip-pattern=(MQTT|Domoticz|Feather32u4).*ino" >> $GITHUB_OUTPUT
fi
- name: Install libraries
if: ${{ env.run-build == 'true' }}
run:
|
ps -p "$$"
arduino-cli lib install [email protected]
arduino-cli lib install "LoRa Serialization"@3.1.0
arduino-cli lib install [email protected]
arduino-cli lib install [email protected]
arduino-cli lib install [email protected]
arduino-cli lib install [email protected]
arduino-cli lib install [email protected]
- name: Install platform
if: ${{ env.run-build == 'true' }}
run:
|
arduino-cli core update-index ${{ format('{0}', steps.prep.outputs.index-url) }}
arduino-cli core install ${{ format('{0}:{1} {2}', steps.split.outputs._0, steps.split.outputs._1, steps.prep.outputs.index-url) }}
- name: Checkout repository
if: ${{ env.run-build == 'true' }}
uses: actions/checkout@v4
- name: Build examples
if: ${{ env.run-build == 'true' }}
run:
|
for example in $(find $PWD/examples -name '*.ino' | sort); do
# check whether to skip this sketch
if [ ! -z '${{ steps.prep.outputs.skip-pattern }}' ] && [[ ${example} =~ ${{ steps.prep.outputs.skip-pattern }} ]]; then
# skip sketch
echo -e "\n\033[1;33mSkipped ${example##*/} (matched with ${{ steps.prep.outputs.skip-pattern }})\033[0m";
else
# build sketch
echo -e "\n\033[1;33mBuilding ${example##*/} ... \033[0m";
arduino-cli compile --libraries /home/runner/work/BresserWeatherSensorReceiver --fqbn ${{ matrix.board }}${{ steps.prep.outputs.options }} $example --warnings=${{ steps.prep.outputs.warnings }}
if [ $? -ne 0 ]; then
echo -e "\033[1;31m${example##*/} build FAILED\033[0m\n";
exit 1;
else
echo -e "\033[1;32m${example##*/} build PASSED\033[0m\n";
fi
fi
done