2323 - " libraries/**/*.cpp"
2424 - " libraries/**/*.c"
2525 - " libraries/**/*.h"
26- - " libraries/**/*.ino"
27- - " libraries/**/ci.json"
2826 - " idf_component_examples/**"
2927 - " idf_component.yml"
3028 - " Kconfig.projbuild"
3331 - " .github/scripts/check-cmakelists.sh"
3432 - " .github/scripts/on-push-idf.sh"
3533 - " .github/scripts/sketch_utils.sh"
34+ - " .github/scripts/get_affected.py"
3635 - " variants/esp32/**"
3736 - " variants/esp32c2/**"
3837 - " variants/esp32c3/**"
38+ - " variants/esp32c5/**"
3939 - " variants/esp32c6/**"
4040 - " variants/esp32h2/**"
4141 - " variants/esp32p4/**"
6868 outputs :
6969 idf_ver : ${{ steps.set-matrix.outputs.idf_ver }}
7070 idf_target : ${{ steps.set-matrix.outputs.idf_target }}
71+ should_build : ${{ steps.affected-examples.outputs.should_build }}
7172 steps :
73+ - name : Install universal-ctags
74+ uses : awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # v1.5.3
75+ with :
76+ packages : libicu74 libjansson4 libxml2 libyaml-0-2 universal-ctags
77+ version : 1
78+ execute_install_scripts : true
79+
80+ - name : Checkout repository
81+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
82+ with :
83+ fetch-depth : 2
84+
85+ - name : Get changed files
86+ id : changed-files
87+ uses : tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
88+
89+ - name : Get affected examples
90+ id : affected-examples
91+ env :
92+ IS_PR : ${{ github.event_name == 'pull_request' }}
93+ run : |
94+ (which ctags-universal || which ctags) || (echo "Error: Neither ctags-universal nor ctags found in PATH" && exit 1)
95+ python3 ./.github/scripts/get_affected.py --debug --component ${{ steps.changed-files.outputs.all_changed_files }} > affected_examples.txt
96+
97+ - name : Upload affected examples
98+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
99+ with :
100+ name : affected_examples
101+ path : affected_examples.txt
102+ if-no-files-found : error
103+
104+ - name : Upload debug artifacts
105+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
106+ with :
107+ name : get_affected_debug
108+ path : |
109+ ctags_defs_by_qname.json
110+ ctags_header_to_qnames.json
111+ ctags_tags.jsonl
112+ dependencies.json
113+ dependencies_reverse.json
114+ if-no-files-found : warn
115+
72116 - name : Get IDF Version and Targets
73117 id : set-matrix
74118 run : |
@@ -100,6 +144,7 @@ jobs:
100144 name : Build IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
101145 runs-on : ubuntu-latest
102146 needs : set-matrix
147+ if : ${{ needs.set-matrix.outputs.should_build == '1' }}
103148 strategy :
104149 fail-fast : false
105150 matrix :
@@ -121,13 +166,18 @@ jobs:
121166 - name : Setup jq
122167 uses : dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
123168
169+ - name : Download affected examples
170+ uses : actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
171+ with :
172+ name : affected_examples
173+
124174 - name : Build
125175 env :
126176 IDF_TARGET : ${{ matrix.idf_target }}
127177 shell : bash
128178 run : |
129179 chmod a+x ./components/arduino-esp32/.github/scripts/*
130- ./components/arduino-esp32/.github/scripts/on-push-idf.sh
180+ ./components/arduino-esp32/.github/scripts/on-push-idf.sh affected_examples.txt
131181
132182 - name : Upload generated sdkconfig files for debugging
133183 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
0 commit comments