Skip to content

Commit 69cf3ff

Browse files
committed
ci(component): Move component compilation in a separate workflow
1 parent 4eff7f9 commit 69cf3ff

File tree

4 files changed

+159
-106
lines changed

4 files changed

+159
-106
lines changed

.github/scripts/set_push_chunks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ chunks+="]"
7878
echo "build_all=$build_all"
7979
echo "build_libraries=$BUILD_LIBRARIES"
8080
echo "build_static_sketches=$BUILD_STATIC_SKETCHES"
81-
echo "build_idf=$BUILD_IDF"
8281
echo "chunk_count=$chunks_count"
8382
echo "chunks=$chunks"
8483
} >> "$GITHUB_OUTPUT"

.github/workflows/build_component.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Arduino as ESP-IDF Component
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
idf_ver:
7+
description: "IDF Versions"
8+
default: "release-v5.3,release-v5.4,release-v5.5"
9+
type: "string"
10+
required: true
11+
idf_targets:
12+
description: "IDF Targets"
13+
default: "esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
14+
type: "string"
15+
required: true
16+
push:
17+
branches:
18+
- master
19+
- release/*
20+
pull_request:
21+
paths:
22+
- "cores/**"
23+
- "libraries/**/*.cpp"
24+
- "libraries/**/*.c"
25+
- "libraries/**/*.h"
26+
- "libraries/**/*.ino"
27+
- "libraries/**/ci.json"
28+
- "idf_component_examples/**"
29+
- "idf_component.yml"
30+
- "Kconfig.projbuild"
31+
- "CMakeLists.txt"
32+
- ".github/workflows/build_component.yml"
33+
- ".github/scripts/check-cmakelists.sh"
34+
- ".github/scripts/on-push-idf.sh"
35+
- ".github/scripts/sketch_utils.sh"
36+
- "variants/esp32/**"
37+
- "variants/esp32c2/**"
38+
- "variants/esp32c3/**"
39+
- "variants/esp32c6/**"
40+
- "variants/esp32h2/**"
41+
- "variants/esp32p4/**"
42+
- "variants/esp32s2/**"
43+
- "variants/esp32s3/**"
44+
- "!*.md"
45+
- "!*.txt"
46+
- "!*.properties"
47+
48+
concurrency:
49+
group: build-component-${{github.event.pull_request.number || github.ref}}
50+
cancel-in-progress: true
51+
52+
jobs:
53+
cmake-check:
54+
name: Check CMakeLists
55+
runs-on: ubuntu-latest
56+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
57+
steps:
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
- run: bash ./.github/scripts/check-cmakelists.sh
60+
61+
set-matrix:
62+
name: Set Matrix
63+
runs-on: ubuntu-latest
64+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
65+
outputs:
66+
idf_ver: ${{ steps.set-matrix.outputs.idf_ver }}
67+
idf_target: ${{ steps.set-matrix.outputs.idf_target }}
68+
steps:
69+
- name: Get IDF Version and Targets
70+
id: set-matrix
71+
run: |
72+
# Default values
73+
idf_ver="release-v5.3,release-v5.4,release-v5.5"
74+
idf_targets="esp32,esp32s2,esp32s3,esp32c2,esp32c3,esp32c6,esp32h2,esp32p4"
75+
76+
# Override with inputs if provided
77+
if [[ -n "${{ inputs.idf_ver }}" ]]; then
78+
idf_ver="${{ inputs.idf_ver }}"
79+
fi
80+
if [[ -n "${{ inputs.idf_targets }}" ]]; then
81+
idf_targets="${{ inputs.idf_targets }}"
82+
fi
83+
84+
# Convert comma-separated strings to JSON arrays using a more robust method
85+
idf_ver_json=$(printf '%s\n' "$idf_ver" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
86+
idf_targets_json=$(printf '%s\n' "$idf_targets" | tr ',' '\n' | jq -R . | jq -s . | jq -c .)
87+
88+
# Debug: Print the JSON for verification
89+
echo "Debug - idf_ver_json: $idf_ver_json"
90+
echo "Debug - idf_targets_json: $idf_targets_json"
91+
92+
# Set outputs - ensure no extra whitespace
93+
printf "idf_ver=%s\n" "$idf_ver_json" >> $GITHUB_OUTPUT
94+
printf "idf_target=%s\n" "$idf_targets_json" >> $GITHUB_OUTPUT
95+
96+
build-esp-idf-component:
97+
name: Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
98+
runs-on: ubuntu-latest
99+
needs: set-matrix
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
# The version names here correspond to the versions of espressif/idf Docker image.
104+
# See https://hub.docker.com/r/espressif/idf/tags and
105+
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
106+
# for details.
107+
idf_ver: ${{ fromJson(needs.set-matrix.outputs.idf_ver) }}
108+
idf_target: ${{ fromJson(needs.set-matrix.outputs.idf_target) }}
109+
container: espressif/idf:${{ matrix.idf_ver }}
110+
steps:
111+
- name: Check out arduino-esp32 as a component
112+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
113+
with:
114+
submodules: recursive
115+
path: components/arduino-esp32
116+
117+
- name: Setup jq
118+
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
119+
120+
- name: Build
121+
env:
122+
IDF_TARGET: ${{ matrix.idf_target }}
123+
shell: bash
124+
run: |
125+
chmod a+x ./components/arduino-esp32/.github/scripts/*
126+
./components/arduino-esp32/.github/scripts/on-push-idf.sh
127+
128+
- name: Upload generated sdkconfig files for debugging
129+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
130+
if: always()
131+
with:
132+
name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }}
133+
path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig

.github/workflows/push.yml

Lines changed: 22 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,32 @@ on:
2525
pull_request:
2626
paths:
2727
- "cores/**"
28-
- "libraries/**"
29-
- "!libraries/**.md"
30-
- "!libraries/**.txt"
31-
- "!libraries/**.properties"
32-
- "!libraries/**.py"
28+
- "libraries/**/*.cpp"
29+
- "libraries/**/*.c"
30+
- "libraries/**/*.h"
31+
- "libraries/**/*.ino"
32+
- "libraries/**/ci.json"
3333
- "package/**"
34-
- "idf_component_examples/**"
35-
- "tools/**.py"
34+
- "tools/get.*"
3635
- "platform.txt"
3736
- "programmers.txt"
38-
- "idf_component.yml"
39-
- "Kconfig.projbuild"
4037
- "package.json"
41-
- "CMakeLists.txt"
4238
- ".github/workflows/push.yml"
43-
- ".github/scripts/**"
44-
- "!.github/scripts/find_*"
45-
- "!.github/scripts/on-release.sh"
46-
- "!.github/scripts/tests_*"
47-
- "!.github/scripts/upload_*"
48-
- "variants/esp32/**/*"
49-
- "variants/esp32c3/**/*"
50-
- "variants/esp32c5/**/*"
51-
- "variants/esp32c6/**/*"
52-
- "variants/esp32h2/**/*"
53-
- "variants/esp32p4/**/*"
54-
- "variants/esp32s2/**/*"
55-
- "variants/esp32s3/**/*"
39+
- ".github/scripts/install-*"
40+
- ".github/scripts/on-push.sh"
41+
- ".github/scripts/set_push_chunks.sh"
42+
- ".github/scripts/sketch_utils.sh"
43+
- "variants/esp32/**"
44+
- "variants/esp32c3/**"
45+
- "variants/esp32c5/**"
46+
- "variants/esp32c6/**"
47+
- "variants/esp32h2/**"
48+
- "variants/esp32p4/**"
49+
- "variants/esp32s2/**"
50+
- "variants/esp32s3/**"
51+
- "!*.md"
52+
- "!*.txt"
53+
- "!*.properties"
5654

5755
concurrency:
5856
group: build-${{github.event.pull_request.number || github.ref}}
@@ -62,14 +60,6 @@ env:
6260
MAX_CHUNKS: 15
6361

6462
jobs:
65-
cmake-check:
66-
name: Check cmake file
67-
runs-on: ubuntu-latest
68-
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
69-
steps:
70-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
71-
- run: bash ./.github/scripts/check-cmakelists.sh
72-
7363
gen-chunks:
7464
name: Generate chunks
7565
runs-on: ubuntu-latest
@@ -78,7 +68,6 @@ jobs:
7868
build_all: ${{ steps.set-chunks.outputs.build_all }}
7969
build_libraries: ${{ steps.set-chunks.outputs.build_libraries }}
8070
build_static_sketches: ${{ steps.set-chunks.outputs.build_static_sketches }}
81-
build_idf: ${{ steps.set-chunks.outputs.build_idf }}
8271
chunk_count: ${{ steps.set-chunks.outputs.chunk_count }}
8372
chunks: ${{ steps.set-chunks.outputs.chunks }}
8473
steps:
@@ -99,13 +88,7 @@ jobs:
9988
- 'tools/**'
10089
- 'platform.txt'
10190
- 'programmers.txt'
102-
- "variants/esp32/**/*"
103-
- "variants/esp32c3/**/*"
104-
- "variants/esp32c6/**/*"
105-
- "variants/esp32h2/**/*"
106-
- "variants/esp32p4/**/*"
107-
- "variants/esp32s2/**/*"
108-
- "variants/esp32s3/**/*"
91+
- "variants/**"
10992
libraries:
11093
- 'libraries/**/examples/**'
11194
- 'libraries/**/src/**'
@@ -121,19 +104,13 @@ jobs:
121104
- 'libraries/NetworkClientSecure/src/**'
122105
- 'libraries/BLE/src/**'
123106
- 'libraries/Insights/src/**'
124-
idf:
125-
- 'idf_component.yml'
126-
- 'Kconfig.projbuild'
127-
- 'CMakeLists.txt'
128-
- "idf_component_examples/**"
129107
130108
- name: Set chunks
131109
id: set-chunks
132110
env:
133111
LIB_FILES: ${{ steps.changed-files.outputs.libraries_all_changed_files }}
134112
IS_PR: ${{ github.event_name == 'pull_request' }}
135113
MAX_CHUNKS: ${{ env.MAX_CHUNKS }}
136-
BUILD_IDF: ${{ steps.changed-files.outputs.idf_any_changed == 'true' }}
137114
BUILD_LIBRARIES: ${{ steps.changed-files.outputs.libraries_any_changed == 'true' }}
138115
BUILD_STATIC_SKETCHES: ${{ steps.changed-files.outputs.static_sketeches_any_changed == 'true' }}
139116
FS_CHANGED: ${{ steps.changed-files.outputs.fs_any_changed == 'true' }}
@@ -233,59 +210,6 @@ jobs:
233210
- name: Build Sketches
234211
run: bash ./.github/scripts/on-push.sh
235212

236-
build-esp-idf-component:
237-
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
238-
needs: gen-chunks
239-
if: |
240-
needs.gen-chunks.outputs.build_all == 'true' ||
241-
needs.gen-chunks.outputs.build_libraries == 'true' ||
242-
needs.gen-chunks.outputs.build_idf == 'true'
243-
runs-on: ubuntu-latest
244-
strategy:
245-
fail-fast: false
246-
matrix:
247-
# The version names here correspond to the versions of espressif/idf Docker image.
248-
# See https://hub.docker.com/r/espressif/idf/tags and
249-
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
250-
# for details.
251-
idf_ver: ["release-v5.3","release-v5.4","release-v5.5"]
252-
idf_target:
253-
[
254-
"esp32",
255-
"esp32s2",
256-
"esp32s3",
257-
"esp32c2",
258-
"esp32c3",
259-
"esp32c6",
260-
"esp32h2",
261-
"esp32p4"
262-
]
263-
container: espressif/idf:${{ matrix.idf_ver }}
264-
steps:
265-
- name: Check out arduino-esp32 as a component
266-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
267-
with:
268-
submodules: recursive
269-
path: components/arduino-esp32
270-
271-
- name: Setup jq
272-
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
273-
274-
- name: Build
275-
env:
276-
IDF_TARGET: ${{ matrix.idf_target }}
277-
shell: bash
278-
run: |
279-
chmod a+x ./components/arduino-esp32/.github/scripts/*
280-
./components/arduino-esp32/.github/scripts/on-push-idf.sh
281-
282-
- name: Upload generated sdkconfig files for debugging
283-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
284-
if: always()
285-
with:
286-
name: sdkconfig-${{ matrix.idf_ver }}-${{ matrix.idf_target }}
287-
path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig
288-
289213
# Save artifacts to gh-pages
290214
save-master-artifacts:
291215
name: Save master artifacts

.github/workflows/tests.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ on:
1616
pull_request:
1717
types: [opened, reopened, closed, synchronize, labeled, unlabeled]
1818
paths:
19+
- ".github/scripts/install*.sh"
1920
- ".github/workflows/tests*"
20-
- ".github/scripts/*.sh"
21-
- "!.github/scripts/check-cmakelists.sh"
22-
- "!.github/scripts/find_*"
23-
- "!.github/scripts/on-*.sh"
24-
- "!.github/scripts/set_push_chunks.sh"
25-
- "!.github/scripts/update-version.sh"
26-
- "!.github/scripts/upload_py_tools.sh"
21+
- ".github/scripts/sketch_utils.sh"
2722
- "tests/**"
2823
- "cores/**"
2924
- "libraries/*/src/**.cpp"
3025
- "libraries/*/src/**.h"
3126
- "libraries/*/src/**.c"
3227
- "package/**"
28+
- "!*.md"
29+
- "!*.properties"
3330
schedule:
3431
- cron: "0 2 * * *"
3532

0 commit comments

Comments
 (0)