Repository navigation
60 lines (54 loc) · 1.96 KB
/
Copy pathci.yml
File metadata and controls
60 lines (54 loc) · 1.96 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
name: ESPHome CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
# Seed a dummy secrets.yaml so `esphome config` resolves !secret
# references during the lint. Real secrets live in the maintainer's
# local secrets.yaml (gitignored) and are not needed for CI.
- name: Stage dummy secrets for lint
run: |
python3 -c 'import base64, os; print("api_encryption_key: \"" + base64.b64encode(os.urandom(32)).decode() + "\"")' > secrets.yaml
cat >> secrets.yaml <<EOF
wifi_ssid: "CiDummyNet"
wifi_password: "ci-dummy-password"
ota_password: "ci-dummy-ota-password"
mqtt_host: "192.0.2.1"
mqtt_user: "ci-dummy-user"
mqtt_password: "ci-dummy-password"
EOF
- name: Validate ESPHome config
uses: esphome/build-action@v7
with:
yaml-file: fancontrol.yaml
version: latest
- name: Firmware size gate (<= 1.5 MB)
run: |
FW=$(find . -path './.esphome/build/*/firmware.bin' -type f | head -1)
if [ -z "$FW" ]; then
echo "No firmware.bin found — build step likely failed."
exit 1
fi
SIZE=$(stat -c%s "$FW")
echo "Firmware size: $SIZE bytes"
if [ "$SIZE" -gt 1500000 ]; then
echo "ERROR: firmware too large (>1.5MB)"
exit 1
fi
- name: Upload firmware artifacts
uses: actions/upload-artifact@v7
with:
name: fancontrol-${{ github.sha }}
path: |
.esphome/build/fancontrol/.pioenvs/fancontrol/firmware.bin
.esphome/build/fancontrol/.pioenvs/fancontrol/firmware.ota.bin
.esphome/build/fancontrol/.pioenvs/fancontrol/firmware.factory.bin
retention-days: 30
if-no-files-found: warn