-
-
Notifications
You must be signed in to change notification settings - Fork 7
236 lines (224 loc) · 8.29 KB
/
esphome_build.yml
File metadata and controls
236 lines (224 loc) · 8.29 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
---
name: Build ESPHome
# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- "nspanel_esphome*.yaml"
- "esphome/nspanel_esphome*.yaml"
- "prebuilt/nspanel_esphome*.yaml"
- "prebuilt/wall_display*.yaml"
- ".github/workflows/esphome_build.yml"
- ".test/*.yaml"
- "*.h"
- "*.c"
- "*.cpp"
- "*.py"
schedule:
# Run daily at 10:00 AM UTC
- cron: '0 10 * * *'
workflow_dispatch:
env:
# Repository URL and ref for external_components resolution.
# For fork PRs, points to the fork so the PR code is actually tested.
REF_URL: >-
https://github.com/${{
github.event.pull_request.head.repo.full_name
|| github.repository
}}
REF_NAME: ${{ github.head_ref || github.ref_name }}
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
code_scan:
name: Code scan (YAML)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6.2.0
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r .github/requirements.txt
- name: Validate YAML files
run: find . \( -name "*.yaml" -o -name "*.yml" \) -exec yamllint -c ./.rules/yamllint.yml {} +
# ===========================================================================
# ESPHome Latest
# ===========================================================================
build_latest:
name: ${{ matrix.firmware.name }} (latest)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: Basic (IDF)
yaml-file: .test/esphome_idf_basic.yaml
- name: Basic (Arduino)
yaml-file: .test/esphome_ard_basic.yaml
- name: BLE Tracker
yaml-file: .test/esphome_idf_ble_tracker.yaml
- name: Bluetooth Proxy
yaml-file: .test/esphome_idf_bluetooth_proxy.yaml
- name: Climate Cool
yaml-file: .test/esphome_idf_climate_cool.yaml
- name: Climate Heat
yaml-file: .test/esphome_idf_climate_heat.yaml
- name: Climate Dual
yaml-file: .test/esphome_idf_climate_dual.yaml
- name: Cover
yaml-file: .test/esphome_idf_cover.yaml
- name: Customizations
yaml-file: .test/esphome_idf_climate_heat_customizations.yaml
- name: Climate Cool + Bluetooth Proxy
yaml-file: .test/esphome_idf_climate_cool_bluetooth_proxy.yaml
- name: Display as a Light
yaml-file: .test/esphome_idf_display_as_light.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
# ===========================================================================
# ESPHome Dev
# ===========================================================================
build_dev:
name: ${{ matrix.firmware.name }} (dev)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: Basic (IDF)
yaml-file: .test/esphome_idf_basic.yaml
- name: Basic (Arduino)
yaml-file: .test/esphome_ard_basic.yaml
- name: BLE Tracker
yaml-file: .test/esphome_idf_ble_tracker.yaml
- name: Bluetooth Proxy
yaml-file: .test/esphome_idf_bluetooth_proxy.yaml
- name: Climate Cool
yaml-file: .test/esphome_idf_climate_cool.yaml
- name: Climate Heat
yaml-file: .test/esphome_idf_climate_heat.yaml
- name: Climate Dual
yaml-file: .test/esphome_idf_climate_dual.yaml
- name: Cover
yaml-file: .test/esphome_idf_cover.yaml
- name: Customizations
yaml-file: .test/esphome_idf_climate_heat_customizations.yaml
- name: Climate Cool + Bluetooth Proxy
yaml-file: .test/esphome_idf_climate_cool_bluetooth_proxy.yaml
- name: Display as a Light
yaml-file: .test/esphome_idf_display_as_light.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
version: dev
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
# ===========================================================================
# Pre-built firmware - ESPHome Latest
# ===========================================================================
build_prebuilt_latest:
name: ${{ matrix.firmware.name }} - Pre-built (latest)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: NSPanel Easy
yaml-file: prebuilt/nspanel_esphome_prebuilt.yaml
- name: Wall Display
yaml-file: prebuilt/wall_display.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
- name: Verify compiled output
run: |
# Locate the binary produced by the build action.
# Using find avoids hardcoding the device name from the YAML.
BIN=$(find prebuilt/.esphome/build -name "firmware.bin" | head -1)
BIN_FACTORY=$(find prebuilt/.esphome/build -name "firmware-factory.bin" | head -1)
ok=true
if [ ! -s "$BIN" ]; then
echo "ERROR: firmware.bin missing or empty"
ok=false
else
echo "OK: firmware.bin ($(wc -c < "$BIN") bytes)"
fi
if [ -n "$BIN_FACTORY" ] && [ ! -s "$BIN_FACTORY" ]; then
echo "ERROR: firmware-factory.bin found but empty"
ok=false
elif [ -n "$BIN_FACTORY" ]; then
echo "OK: firmware-factory.bin ($(wc -c < "$BIN_FACTORY") bytes)"
fi
[ "$ok" = true ] || exit 1
# ===========================================================================
# Pre-built firmware - ESPHome Dev
# ===========================================================================
build_prebuilt_dev:
name: ${{ matrix.firmware.name }} - Pre-built (dev)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firmware:
- name: NSPanel Easy
yaml-file: prebuilt/nspanel_esphome_prebuilt.yaml
- name: Wall Display
yaml-file: prebuilt/wall_display.yaml
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build firmware
uses: edwardtfn/build-action@add-substitutions-support
with:
yaml-file: ${{ matrix.firmware.yaml-file }}
version: dev
substitutions: |
ref_name=${{ env.REF_NAME }}
ref_url=${{ env.REF_URL }}
- name: Verify compiled output
run: |
# Locate the binary produced by the build action.
# Using find avoids hardcoding the device name from the YAML.
BIN=$(find prebuilt/.esphome/build -name "firmware.bin" | head -1)
BIN_FACTORY=$(find prebuilt/.esphome/build -name "firmware-factory.bin" | head -1)
ok=true
if [ ! -s "$BIN" ]; then
echo "ERROR: firmware.bin missing or empty"
ok=false
else
echo "OK: firmware.bin ($(wc -c < "$BIN") bytes)"
fi
if [ -n "$BIN_FACTORY" ] && [ ! -s "$BIN_FACTORY" ]; then
echo "ERROR: firmware-factory.bin found but empty"
ok=false
elif [ -n "$BIN_FACTORY" ]; then
echo "OK: firmware-factory.bin ($(wc -c < "$BIN_FACTORY") bytes)"
fi
[ "$ok" = true ] || exit 1
...