@@ -69,32 +69,31 @@ jobs:
6969 runs-on : [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
7070 outputs :
7171 matrix : ${{ steps.set-matrix.outputs.matrix }}
72+ seeders : ${{ steps.set-seeders.outputs.seeders }}
7273 timestamp : ${{ steps.set-timestamp.outputs.timestamp }}
7374 branchname : ${{ steps.set-branch.outputs.branchname }}
7475 steps :
75- - uses : actions/checkout@v4
76+ - uses : actions/checkout@v6
7677
7778 - name : Cache Python pip
78- uses : actions/cache@v4
79+ uses : actions/cache@v5
7980 with :
8081 path : ~/.cache/pip
8182 key : ${{ runner.os }}-pip-${{ hashFiles('**./Tools/setup/requirements.txt') }}
8283 restore-keys : |
8384 ${{ runner.os }}-pip-
8485
85- - name : Update python packaging to avoid canonicalize_version() error
86- run : |
87- pip3 install -U packaging
88-
8986 - name : Install Python Dependencies
90- uses : py-actions/py-dependency-install@v4
91- with :
92- path : " ./Tools/setup/requirements.txt"
87+ run : pip3 install -U packaging -r ./Tools/setup/requirements.txt
9388
9489 - id : set-matrix
9590 name : Generate Build Matrix
9691 run : echo "matrix=$(./Tools/ci/generate_board_targets_json.py --group)" >> $GITHUB_OUTPUT
9792
93+ - id : set-seeders
94+ name : Generate Seeder Matrix
95+ run : echo "seeders=$(./Tools/ci/generate_board_targets_json.py --group --seeders)" >> $GITHUB_OUTPUT
96+
9897 - id : set-timestamp
9998 name : Save Current Timestamp
10099 run : echo "timestamp=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
@@ -116,11 +115,52 @@ jobs:
116115 echo "${{ steps.set-branch.outputs.branchname }}"
117116 echo "$(./Tools/ci/generate_board_targets_json.py --group --verbose)"
118117
118+ # ===========================================================================
119+ # CACHE SEEDER JOBS
120+ # ===========================================================================
121+ # Build one representative target per chip family to warm the ccache.
122+ # Matrix jobs fall back to these caches via restore-keys when no
123+ # group-specific cache exists yet. If any seeder fails, the build matrix
124+ # does not start, catching common build errors early.
125+ # ===========================================================================
126+
127+ seed :
128+ name : Seed [${{ matrix.chip_family }}]
129+ needs : group_targets
130+ runs-on : [runs-on,"runner=8cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
131+ strategy :
132+ matrix : ${{ fromJson(needs.group_targets.outputs.seeders) }}
133+ fail-fast : false
134+ container :
135+ image : ${{ matrix.container }}
136+ credentials :
137+ username : ${{ github.actor }}
138+ password : ${{ secrets.GITHUB_TOKEN }}
139+ steps :
140+ - uses : runs-on/action@v2
141+ - uses : actions/checkout@v6
142+ with :
143+ fetch-depth : 1
144+ - name : Configure Git Safe Directory
145+ run : git config --system --add safe.directory '*'
146+ - uses : ./.github/actions/setup-ccache
147+ id : ccache
148+ with :
149+ cache-key-prefix : ccache-${{ matrix.chip_family }}-${{ matrix.runner }}-seeder
150+ max-size : 400M
151+ - name : Build seed target
152+ run : make ${{ matrix.target }}
153+ - uses : ./.github/actions/save-ccache
154+ if : always()
155+ with :
156+ cache-primary-key : ${{ steps.ccache.outputs.cache-primary-key }}
157+
119158 setup :
120159 name : Build [${{ matrix.runner }}][${{ matrix.group }}]
121160 # runs-on: ubuntu-latest
122- runs-on : [runs-on,"runner=8cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",spot=false]
123- needs : group_targets
161+ runs-on : [runs-on,"runner=4cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
162+ needs : [group_targets, seed]
163+ if : " !failure() && !cancelled()"
124164 strategy :
125165 matrix : ${{ fromJson(needs.group_targets.outputs.matrix) }}
126166 fail-fast : false
@@ -131,41 +171,35 @@ jobs:
131171 password : ${{ secrets.GITHUB_TOKEN }}
132172 steps :
133173 - uses : runs-on/action@v2
134- - uses : actions/checkout@v4
174+ - uses : actions/checkout@v6
135175 with :
136176 fetch-depth : 0
137-
138- - name : Git ownership workaround
177+ - name : Configure Git Safe Directory
139178 run : git config --system --add safe.directory '*'
140179
141- # ccache key breakdown:
142- # ccache-<system os>-<system arch>-<builder group>-
143- # ccache-<linux>-<arm64>-<aarch64-0>-
144- # ccache-<linux>-<x64>-<nuttx-0>-
145- - name : Cache Restore from Key
146- id : cc_restore
147- uses : actions/cache/restore@v4
180+ - name : Cache - Restore ccache
181+ id : ccache-restore
182+ uses : actions/cache/restore@v5
148183 with :
149184 path : ~/.ccache
150- key : ${{ format('ccache-{0}-{1}-{2}', runner.os, matrix.runner, matrix.group) }}
185+ key : ccache- ${{ matrix.chip_family }}-${{ matrix.runner }}-${{ matrix.group }}-${{ github.ref_name }}-${{ github.sha }}
151186 restore-keys : |
152- ccache-${{ runner.os }}-${{ matrix.runner }}-${{ matrix.group }}-
153- ccache-${{ runner.os }}-${{ matrix.runner }}-
154- ccache-${{ runner.os }}-${{ matrix.runner }}-
155- ccache-${{ runner.os }}-
156- ccache-
187+ ccache-${{ matrix.chip_family }}-${{ matrix.runner }}-${{ matrix.group }}-${{ github.ref_name }}-
188+ ccache-${{ matrix.chip_family }}-${{ matrix.runner }}-${{ matrix.group }}-${{ github.base_ref || 'main' }}-
189+ ccache-${{ matrix.chip_family }}-${{ matrix.runner }}-${{ matrix.group }}-
190+ ccache-${{ matrix.chip_family }}-${{ matrix.runner }}-
157191
158- - name : Cache Config and Stats
192+ - name : Cache - Configure ccache
159193 run : |
160- mkdir -p ~/.ccache
161- echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
162- echo "compression = true" >> ~/.ccache/ccache.conf
163- echo "compression_level = 6" >> ~/.ccache/ccache.conf
164- echo "max_size = 120M " >> ~/.ccache/ccache.conf
165- echo "hash_dir = false" >> ~/.ccache/ccache.conf
166- echo "compiler_check = content" >> ~/.ccache/ccache.conf
167- ccache -s
168- ccache -z
194+ mkdir -p ~/.ccache
195+ echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
196+ echo "compression = true" >> ~/.ccache/ccache.conf
197+ echo "compression_level = 6" >> ~/.ccache/ccache.conf
198+ echo "max_size = ${{ matrix.cache_size }} " >> ~/.ccache/ccache.conf
199+ echo "hash_dir = false" >> ~/.ccache/ccache.conf
200+ echo "compiler_check = content" >> ~/.ccache/ccache.conf
201+ ccache -s
202+ ccache -z
169203
170204 - name : Building Artifacts for [${{ matrix.targets }}]
171205 run : |
@@ -176,23 +210,15 @@ jobs:
176210 ./Tools/ci/package_build_artifacts.sh
177211
178212 - name : Upload Build Artifacts
179- uses : actions/upload-artifact@v4
213+ uses : actions/upload-artifact@v7
180214 with :
181215 name : px4_${{matrix.group}}_build_artifacts
182216 path : artifacts/
183217
184- - name : Cache Post Build Stats
185- if : always()
186- run : |
187- ccache -s
188- ccache -z
189-
190- - name : Cache Save
191- if : always()
192- uses : actions/cache/save@v4
218+ - uses : ./.github/actions/save-ccache
219+ if : success()
193220 with :
194- path : ~/.ccache
195- key : ${{ steps.cc_restore.outputs.cache-primary-key }}
221+ cache-primary-key : ${{ steps.ccache-restore.outputs.cache-primary-key }}
196222
197223 # ===========================================================================
198224 # ARTIFACT UPLOAD JOB
@@ -211,7 +237,7 @@ jobs:
211237 uploadlocation : ${{ steps.upload-location.outputs.uploadlocation }}
212238 steps :
213239 - name : Download Artifacts
214- uses : actions/download-artifact@v4
240+ uses : actions/download-artifact@v8
215241 with :
216242 path : artifacts/
217243 merge-multiple : true
0 commit comments