Skip to content

Commit ea3a52f

Browse files
committed
Split firmware CI build package release steps
1 parent 190d5c6 commit ea3a52f

1 file changed

Lines changed: 122 additions & 7 deletions

File tree

.github/workflows/light-firmware-build.yml

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,125 @@ jobs:
4040
submodules: recursive
4141
fetch-depth: 0
4242

43-
- name: Install esp-matter dependencies
43+
- name: Install Python native build deps
4444
shell: bash
4545
run: |
4646
set -euo pipefail
47-
cd esp-matter
48-
./install.sh --ninja-jobs 2
47+
apt-get update
48+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
49+
libffi-dev \
50+
pkg-config \
51+
python3-dev
52+
rm -rf /var/lib/apt/lists/*
53+
54+
- name: Restore Matter bootstrap cache
55+
id: restore-matter-bootstrap
56+
uses: actions/cache/restore@v4
57+
with:
58+
path: esp-matter/connectedhomeip/connectedhomeip/.environment
59+
key: ${{ runner.os }}-matter-bootstrap-v2-${{ hashFiles('esp-matter/connectedhomeip/connectedhomeip/scripts/setup/**/*.txt', 'esp-matter/connectedhomeip/connectedhomeip/scripts/setup/**/*.json', 'esp-matter/connectedhomeip/connectedhomeip/BUILD.gn', 'esp-matter/install.sh') }}
60+
61+
- name: Bootstrap Matter environment
62+
shell: bash
63+
run: |
64+
set -euo pipefail
65+
cd esp-matter/connectedhomeip/connectedhomeip
66+
source scripts/bootstrap.sh -p all,esp32
67+
if declare -F deactivate >/dev/null; then
68+
deactivate
69+
fi
70+
71+
- name: Save Matter bootstrap cache
72+
if: steps.restore-matter-bootstrap.outputs.cache-hit != 'true'
73+
uses: actions/cache/save@v4
74+
with:
75+
path: esp-matter/connectedhomeip/connectedhomeip/.environment
76+
key: ${{ steps.restore-matter-bootstrap.outputs.cache-primary-key }}
77+
78+
- name: Restore pip cache
79+
id: restore-pip
80+
uses: actions/cache/restore@v4
81+
with:
82+
path: /root/.cache/pip
83+
key: ${{ runner.os }}-esp-matter-pip-v1-${{ hashFiles('esp-matter/requirements.txt') }}
84+
85+
- name: Install repo-local Python deps
86+
shell: bash
87+
run: |
88+
set -euo pipefail
89+
python3 -m pip install -r esp-matter/requirements.txt
90+
91+
- name: Save pip cache
92+
if: steps.restore-pip.outputs.cache-hit != 'true'
93+
uses: actions/cache/save@v4
94+
with:
95+
path: /root/.cache/pip
96+
key: ${{ steps.restore-pip.outputs.cache-primary-key }}
97+
98+
- name: Restore compiler cache
99+
id: restore-ccache
100+
uses: actions/cache/restore@v4
101+
with:
102+
path: .ccache
103+
key: ${{ runner.os }}-light-c6-thread-ccache-v1-${{ github.ref_name }}-${{ github.sha }}
104+
restore-keys: |
105+
${{ runner.os }}-light-c6-thread-ccache-v1-${{ github.ref_name }}-
106+
${{ runner.os }}-light-c6-thread-ccache-v1-
107+
108+
- name: Configure base light firmware
109+
shell: bash
110+
env:
111+
CCACHE_DIR: ${{ github.workspace }}/.ccache
112+
IDF_CCACHE_ENABLE: "1"
113+
run: |
114+
set -euo pipefail
115+
. /opt/esp/idf/export.sh
116+
. ./esp-matter/export.sh
117+
mkdir -p "${BUILD_DIR}"
118+
cd esp-matter/examples/light
119+
idf.py -B "../../../${BUILD_DIR}" set-target esp32c6
49120
50121
- name: Build base light firmware
51122
shell: bash
123+
env:
124+
CCACHE_DIR: ${{ github.workspace }}/.ccache
125+
IDF_CCACHE_ENABLE: "1"
52126
run: |
53127
set -euo pipefail
54128
. /opt/esp/idf/export.sh
55129
. ./esp-matter/export.sh
56-
mkdir -p build/light-c6-thread
57130
cd esp-matter/examples/light
58-
idf.py -B ../../../build/light-c6-thread set-target esp32c6 build
131+
idf.py -B "../../../${BUILD_DIR}" build
132+
133+
- name: Save compiler cache
134+
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
135+
uses: actions/cache/save@v4
136+
with:
137+
path: .ccache
138+
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
139+
140+
- name: Upload raw build tree
141+
uses: actions/upload-artifact@v4
142+
with:
143+
name: light-c6-thread-build-tree
144+
path: build/light-c6-thread
145+
if-no-files-found: error
146+
compression-level: 0
147+
148+
package-light-core:
149+
runs-on: ubuntu-latest
150+
needs:
151+
- build-light-core
152+
153+
steps:
154+
- name: Checkout repository
155+
uses: actions/checkout@v4
156+
157+
- name: Download raw build tree
158+
uses: actions/download-artifact@v4
159+
with:
160+
name: light-c6-thread-build-tree
161+
path: build/light-c6-thread
59162

60163
- name: Package build artifacts
61164
shell: bash
@@ -65,15 +168,27 @@ jobs:
65168
tar -C build -czf dist/light-core/light-c6-thread-build.tar.gz light-c6-thread
66169
cp docs/ci-and-releases.md dist/light-core/README-device-specific-build.md
67170
68-
- name: Upload build artifact
171+
- name: Upload packaged artifact
69172
uses: actions/upload-artifact@v4
70173
with:
71174
name: light-c6-thread-build
72175
path: dist/light-core/*
73176
if-no-files-found: error
74177

178+
publish-light-core-release:
179+
runs-on: ubuntu-latest
180+
needs:
181+
- package-light-core
182+
if: startsWith(github.ref, 'refs/tags/v')
183+
184+
steps:
185+
- name: Download packaged artifact
186+
uses: actions/download-artifact@v4
187+
with:
188+
name: light-c6-thread-build
189+
path: dist/light-core
190+
75191
- name: Publish GitHub release assets
76-
if: startsWith(github.ref, 'refs/tags/v')
77192
uses: softprops/action-gh-release@v2
78193
with:
79194
files: |

0 commit comments

Comments
 (0)