-
Notifications
You must be signed in to change notification settings - Fork 6
166 lines (149 loc) · 5.52 KB
/
build.yaml
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
name: Build and Publish Matter Example firmware
on:
push:
branches: [ main ]
paths:
- '.github/workflows/build.yaml'
- '**.patch'
- '**/sdkconfig.defaults'
pull_request:
paths:
- '.github/workflows/build.yaml'
- '**.patch'
- '**/sdkconfig.defaults'
workflow_dispatch:
jobs:
# Inspired by .github/workflows/examples-esp32.yaml
build:
name: Build ${{ matrix.firmware.name }}
runs-on: ubuntu-latest
strategy:
matrix:
firmware:
- {
"name": "lighting-app-esp32-c3",
"dir": "lighting-app-example/esp32-c3/",
"root": "examples/lighting-app/esp32/",
"appbin": "chip-lighting-app.bin",
"idf_target": "esp32c3",
"chip_ref": "v1.1.0.2"
}
- {
"name": "lighting-app-esp32-atom-lite",
"dir": "lighting-app-example/esp32-atom-lite/",
"root": "examples/lighting-app/esp32/",
"appbin": "chip-lighting-app.bin",
"idf_target": "esp32",
"chip_ref": "v1.1.0.2"
}
- {
"name": "lighting-app-esp32-c3-m5stamp",
"dir": "lighting-app-example/esp32-c3-m5stamp/",
"root": "examples/lighting-app/esp32/",
"appbin": "chip-lighting-app.bin",
"idf_target": "esp32c3",
"chip_ref": "v1.1.0.2"
}
- {
"name": "light-switch-app-esp32-c3",
"dir": "light-switch-app-example/esp32-c3/",
"root": "examples/light-switch-app/esp32/",
"appbin": "chip-light-switch-app.bin",
"idf_target": "esp32c3",
"chip_ref": "v1.1.0.2"
}
- {
"name": "all-clusters-app-esp32-m5-basic-core",
"dir": "all-clusters-app-example/esp32-m5-basic-core/",
"root": "examples/all-clusters-app/esp32/",
"appbin": "chip-all-clusters-app.bin",
"idf_target": "esp32",
"chip_ref": "v1.1.0.2"
}
container:
image: connectedhomeip/chip-build-esp32:0.7.0
outputs:
git-hash: ${{ steps.git-version.outputs.hash }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout CHIP repository
uses: actions/checkout@v4
with:
repository: project-chip/connectedhomeip
ref: ${{ matrix.firmware.chip_ref }}
submodules: true
path: connectedhomeip
# Fixup for Matter v1.1 (see https://github.com/project-chip/connectedhomeip/pull/28507/files)
- name: Fixup GdbGui requirement
run: perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt
- name: Apply global patches
shell: bash
run: |
cd connectedhomeip
for patch in ../*.patch; do
patch -p1 < "${patch}"
done
- name: Get firmware git hash
run: |
ghash=$(git -C connectedhomeip rev-parse --short HEAD)
echo "hash=${ghash}" >> $GITHUB_OUTPUT
id: git-version
- name: Build
shell: bash
run: |
cd connectedhomeip
scripts/checkout_submodules.py --shallow --platform esp32
for patch in ../${{ matrix.firmware.dir }}*.patch; do
patch -p1 < "${patch}"
done
source "$IDF_PATH/export.sh"
source scripts/activate.sh
root="${{ matrix.firmware.root }}"
rm -f "$root"/sdkconfig
cp "../${{ matrix.firmware.dir }}/sdkconfig.defaults" "${root}"
(
cd "$root"
sed -i "s/CONFIG_DEVICE_SOFTWARE_VERSION=.*/CONFIG_DEVICE_SOFTWARE_VERSION=\"${{ steps.git-version.outputs.hash }}\"/" sdkconfig.defaults
idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults" set-target "${{ matrix.firmware.idf_target }}" build
)
mkdir -p ../deploy/${{ matrix.firmware.dir }}
cp ${{ matrix.firmware.root }}/build/${{ matrix.firmware.appbin }} ../deploy/${{ matrix.firmware.dir }}
cp ${{ matrix.firmware.root }}/build/bootloader/bootloader.bin ../deploy/${{ matrix.firmware.dir }}
cp ${{ matrix.firmware.root }}/build/partition_table/partition-table.bin ../deploy/${{ matrix.firmware.dir }}
cp ${{ matrix.firmware.root }}/build/ota_data_initial.bin ../deploy/${{ matrix.firmware.dir }}
- name: Upload artifacts
uses: actions/[email protected]
with:
name: ${{ matrix.firmware.name }}
path: deploy
publish:
name: Publish new firmware and website to GitHub Pages
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
contents: write
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
path: artifacts/
- name: Set version in manifest.json
shell: bash
run: |
for file in */*/manifest.json; do
jq ".version = \"${{ needs.build.outputs.git-hash }}\"" "${file}" > "${file}.tmp"
mv "${file}.tmp" "${file}"
done
- name: Copy artifacts
shell: bash
run: |
cp -R "artifacts/"*/* ./
rm -r "artifacts/"
- name: Deploy 🚀
uses: EndBug/add-and-commit@v9
with:
message: Bump firmware version to ${{ needs.build.outputs.git-hash }}
committer_name: GitHub Actions
committer_email: [email protected]