Skip to content

Commit 62cfe91

Browse files
committed
2 parents 6382814 + 81b8137 commit 62cfe91

File tree

95 files changed

+9642
-3737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+9642
-3737
lines changed

.github/workflows/build-esp8266.yml

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: (ESP32) Build dev with Arduino CLI
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- dev
10+
11+
pull_request:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
arduino-esp32:
19+
name: ESP32 (arduino-cli) (shard=${{ matrix.shard }})
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
shard: [1, 2, 3, 4]
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Install arduino-cli
30+
run: curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh
31+
32+
- name: Cache Arduino CLI data
33+
uses: actions/cache@v4
34+
with:
35+
key: ${{ runner.os }}-arduino-esp32-${{ hashFiles('.github/workflows/cli-build-esp32-dev.yml') }}-${{ github.run_id }}-${{ matrix.shard }}
36+
restore-keys: |
37+
${{ runner.os }}-arduino-esp32-${{ hashFiles('.github/workflows/cli-build-esp32-dev.yml') }}-
38+
${{ runner.os }}-arduino-esp32-
39+
path: |
40+
~/.arduino15
41+
~/Arduino
42+
~/.cache/arduino-cli
43+
44+
- name: Update core index
45+
run: arduino-cli core update-index --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json
46+
47+
- name: Install core
48+
run: arduino-cli core install --additional-urls https://espressif.github.io/arduino-esp32/package_esp32_index.json esp32:esp32
49+
50+
- name: Install ArduinoJson
51+
run: arduino-cli lib install ArduinoJson
52+
53+
- name: Install AsyncTCP (ESP32)
54+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/AsyncTCP#v3.3.7
55+
56+
- name: Install ESPAsyncWebServer
57+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/ESP32Async/ESPAsyncWebServer#v3.7.3
58+
59+
- name: Install Arduino-MySQL
60+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/cotestatnt/Arduino-MySQL
61+
62+
- name: Install Arduino_MFRC522v2
63+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/OSSLibraries/Arduino_MFRC522v2
64+
65+
- name: Install PubSubCLient
66+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/knolleary/pubsubclient
67+
68+
- name: Build Examples
69+
run: |
70+
set -uo pipefail
71+
72+
total_shards=4
73+
shard="${{ matrix.shard }}"
74+
75+
report_file="build-report-esp32-arduino-cli-shard${{ matrix.shard }}.txt"
76+
: > "$report_file"
77+
78+
failures=0
79+
total=0
80+
index=0
81+
82+
for dir in examples/*; do
83+
if [[ ! -d "$dir" ]]; then
84+
continue
85+
fi
86+
87+
example="$(basename "$dir")"
88+
89+
# Split examples across shards for faster CI.
90+
index=$((index + 1))
91+
example_shard=$(( (index - 1) % total_shards + 1 ))
92+
if [[ "$example_shard" != "$shard" ]]; then
93+
continue
94+
fi
95+
96+
sketch="examples/${example}/${example}.ino"
97+
total=$((total + 1))
98+
99+
echo "============================================================="
100+
echo "Building ${sketch}..."
101+
echo "============================================================="
102+
103+
if [[ ! -f "$sketch" ]]; then
104+
failures=$((failures + 1))
105+
printf '%-25s : FAIL (missing %s)\n' "${example}" "${sketch}" >> "$report_file"
106+
continue
107+
fi
108+
109+
echo "::group::arduino-cli compile - ${example}"
110+
set +e
111+
arduino-cli compile \
112+
--library . \
113+
--warnings none \
114+
--build-cache-path "$HOME/.cache/arduino-cli" \
115+
-b esp32:esp32:esp32 \
116+
"$sketch"
117+
rc=$?
118+
set -e
119+
echo "::endgroup::"
120+
121+
if [[ $rc -eq 0 ]]; then
122+
printf '%-25s : OK\n' "${example}" >> "$report_file"
123+
else
124+
failures=$((failures + 1))
125+
printf '%-25s : FAIL (exit=%s)\n' "${example}" "$rc" >> "$report_file"
126+
fi
127+
done
128+
129+
echo ""
130+
echo "==================== Build report (arduino-cli) ===================="
131+
cat "$report_file"
132+
echo "==================================================================="
133+
echo "Total attempted: ${total} | Failures: ${failures}"
134+
135+
# Do not fail the job here: the final report job will decide.
136+
137+
- name: Upload build report
138+
if: always()
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: arduino-cli-esp32-report-shard${{ matrix.shard }}
142+
path: build-report-esp32-arduino-cli-shard${{ matrix.shard }}.txt
143+
144+
report:
145+
name: ESP32 (arduino-cli) - Final report
146+
runs-on: ubuntu-latest
147+
needs: arduino-esp32
148+
if: always()
149+
steps:
150+
- name: Download all reports
151+
uses: actions/download-artifact@v4
152+
with:
153+
pattern: arduino-cli-esp32-report-*
154+
merge-multiple: true
155+
path: reports
156+
157+
- name: Print final report and set status
158+
run: |
159+
set -uo pipefail
160+
echo "==================== Final build report (ESP32/arduino-cli) ===================="
161+
failures=0
162+
files=0
163+
shopt -s nullglob
164+
for f in reports/*.txt; do
165+
files=$((files + 1))
166+
echo "--- ${f} ---"
167+
cat "$f"
168+
if grep -q " : FAIL" "$f"; then
169+
failures=$((failures + 1))
170+
fi
171+
done
172+
if [[ $files -eq 0 ]]; then
173+
echo "No report files found (artifact download failed?)"
174+
exit 1
175+
fi
176+
echo "==========================================================================="
177+
if [[ $failures -gt 0 ]]; then
178+
echo "One or more shards reported FAIL."
179+
exit 1
180+
fi
181+

0 commit comments

Comments
 (0)