-
Notifications
You must be signed in to change notification settings - Fork 156
195 lines (160 loc) · 7.32 KB
/
pages.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
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
# Copyright 2022 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow build examples, store the artifacts and deploy them to github pages.
# Generates the launchpad configuration file that can be used with the url.
name: Build Examples
on:
workflow_run:
workflows: ["Build Docker"]
types: [completed]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
Build-Matter:
# Disable the job in forks
if: ${{ github.repository_owner == 'espressif' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest
container:
image: espressif/esp-matter:latest
strategy:
matrix:
targets:
- {example: light, target: esp32, prefix: wifi_matter}
- {example: light, target: esp32c3, prefix: wifi_matter}
- {example: light, target: esp32c6, prefix: wifi_matter}
- {example: light, target: esp32c6, prefix: thread_matter, sdkconfig: sdkconfig.defaults.c6_thread}
- {example: light, target: esp32h2, prefix: thread_matter}
- {example: light_switch, target: esp32c3, prefix: wifi_matter}
steps:
- run: mkdir -p images
- name: build application
run: |
. $IDF_PATH/export.sh
. $ESP_MATTER_PATH/export.sh
cd $ESP_MATTER_PATH/examples/${{ matrix.targets.example }}
if [ "${{ matrix.targets.sdkconfig }}" != "" ]
then
idf.py -D SDKCONFIG_DEFAULTS="${{ matrix.targets.sdkconfig }}" set-target ${{ matrix.targets.target }} build
else
idf.py set-target ${{ matrix.targets.target }} build
fi
cd build
TARGET_CHIP=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["target"])'`
APP_BIN=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["app_bin"])'`
OUT_BIN="$GITHUB_WORKSPACE/images/$TARGET_CHIP"_${{ matrix.targets.prefix }}_"$APP_BIN"
esptool.py --chip $TARGET_CHIP merge_bin -o $OUT_BIN `cat flash_args | tr '\n' '\ '`
# record the esp-idf and esp-matter commit
idf_rev=`git -C $IDF_PATH rev-parse --short HEAD`
mtr_rev=`git -C $ESP_MATTER_PATH rev-parse --short HEAD`
chip_rev=`git -C $ESP_MATTER_PATH/connectedhomeip/connectedhomeip rev-parse --short HEAD`
echo "- esp-idf: [$idf_rev](https://github.com/espressif/esp-idf/tree/$idf_rev)" >> $GITHUB_WORKSPACE/images/.esp-idf
echo "- esp-matter: [$mtr_rev](https://github.com/espressif/esp-matter/tree/$mtr_rev)" >> $GITHUB_WORKSPACE/images/.esp-matter
echo "- connectedhomeip: [$chip_rev](https://github.com/project-chip/connectedhomeip/tree/$chip_rev)" >> $GITHUB_WORKSPACE/images/.chip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: build-images-${{ matrix.targets.target }}-${{ matrix.targets.prefix }}-${{ matrix.targets.example }}
path: images/
Build-Rainmaker:
# Disable the job in forks
if: ${{ github.repository_owner == 'espressif' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest
container:
image: espressif/esp-matter:latest
strategy:
matrix:
targets:
- {example: matter_light, target: esp32c3, prefix: wifi_rainmaker}
steps:
- run: mkdir -p images
- uses: actions/checkout@v4
with:
repository: 'espressif/esp-rainmaker'
submodules: 'recursive'
path: 'esp-rainmaker'
- name: build application
run: |
. $IDF_PATH/export.sh
. $ESP_MATTER_PATH/export.sh
cd esp-rainmaker/examples/matter/${{ matrix.targets.example }}
SDK_CFG="sdkconfig.defaults"
if [ "${{ matrix.targets.sdkconfig }}" != "" ]; then
SDK_CFG="$SDK_CFG;${{ matrix.targets.sdkconfig }}"
elif [ -f sdkconfig.defaults.${{ matrix.targets.target }} ]; then
SDK_CFG="$SDK_CFG;sdkconfig.defaults.${{ matrix.targets.target }}"
fi
idf.py -D SDKCONFIG_DEFAULTS="$SDK_CFG" set-target ${{ matrix.targets.target }} build
cd build
TARGET_CHIP=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["target"])'`
APP_BIN=`cat project_description.json | python3 -c 'import sys,json; print(json.load(sys.stdin)["app_bin"])'`
OUT_BIN="$GITHUB_WORKSPACE/images/$TARGET_CHIP"_${{ matrix.targets.prefix }}_"$APP_BIN"
esptool.py --chip $TARGET_CHIP merge_bin -o $OUT_BIN `cat flash_args | tr '\n' '\ '`
# record the esp-rainmaker commit
rmaker_rev=`git rev-parse --short HEAD`
echo "- esp-rainmaker: [$rmaker_rev](https://github.com/espressif/esp-rainmaker/tree/$rmaker_rev)" >> $GITHUB_WORKSPACE/images/.esp-rainmaker
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: build-images-${{ matrix.targets.target }}-${{ matrix.targets.prefix }}-${{ matrix.targets.example }}
path: images/
deploy:
# Disable the job in forks
if: ${{ github.repository_owner == 'espressif' }}
needs:
- Build-Matter
- Build-Rainmaker
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
container:
image: espressif/esp-matter:latest
steps:
- name: Download builds
uses: actions/download-artifact@v4
with:
pattern: build-images-*
path: images/
merge-multiple: true
- name: generate launchpad config
run: |
cd images/
$ESP_MATTER_PATH/tools/launchpad/generate_launchpad_config.sh ${{ github.repository_owner }}
# Put together the commit ids used when building the firmwares
echo "#### Build Config" >> build_cfg.md
cat .esp-idf >> build_cfg.md
cat .esp-matter >> build_cfg.md
cat .chip >> build_cfg.md
cat .esp-rainmaker >> build_cfg.md
tree -H '.' -L 1 --noreport -T 'ESP Matter Launchpad Artifacts' -shi --charset utf-8 -I "index.html" -o index.html
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: images/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4