Good ordering: measure first, then cache. Two details that bite with the cache advice. Include the runtime version in the key (for example the Python or Node version next to the lock-file hash), otherwise a version bump can restore wheels or native modules built for the old one. And with cache-to type=gha,mode=max the layer cache can eat the 10 GB repo limit quickly, which evicts the dependency caches you just set up, so scoping Docker caches per image or branch may help. Also worth knowing: workflows triggered from pull requests can read and write caches, so keeping the deploy job off any cache that untrusted PR code can populate is a cheap hardening step. Do you have a rule of thumb for when a test matrix shard stops paying for itself because of setup overhead?