9494 --num-jobs $(getconf _NPROCESSORS_ONLN)
9595 --test-spec "~[Stopwatch]"
9696
97- # NOTE: We don't use the cache for scheduled runs so that they run lint:check-cpp-static-full
98- # on all files.
97+ # NOTE: We don't restore the cache for `schedule` runs so that below,
98+ # `lint:check-cpp-static-full` runs on all files. If we don't do this periodically,
99+ # `lint:check-cpp-static-full` could miss issues in files that haven't changed but depend on
100+ # files which have changed.
99101 - if : " 'schedule' != github.event_name"
100102 name : " Restore lint:check-cpp-static-full cache"
101103 id : " cache-restore-lint-check-cpp-static-full"
@@ -106,9 +108,11 @@ jobs:
106108 .task/checksum/utils-cpp-lint-clang-tidy-*
107109 build/lint-clang-tidy
108110
109- # NOTE: We use a per-OS cache since different OSes may trigger different clang-tidy
110- # violations.
111- key : " main-branch-${{matrix.os}}-lint:check-cpp-static-full"
111+ # NOTE: This key must be kept in-sync with the key prefix in the `actions/cache/save` step
112+ # below (we can't use the output of the current step since `schedule` workflow runs don't
113+ # run this step).
114+ key : " lint:check-cpp-static-full-on-${{matrix.os}}-with\
115+ -${{matrix.use_shared_libs == true && 'shared' || 'static'}}-libs"
112116
113117 # TODO: When enough files are passing clang-tidy, switch to a full pass on schedule only.
114118 # - run: >-
@@ -129,4 +133,14 @@ jobs:
129133 .task/checksum/lint-check-cpp-static-full
130134 .task/checksum/utils-cpp-lint-clang-tidy-*
131135 build/lint-clang-tidy
132- key : " ${{steps.cache-restore-lint-check-cpp-static-full.outputs.cache-primary-key}}"
136+
137+ # NOTE: This key prefix (without the hash) must be kept in-sync with the
138+ # `actions/cache/restore` step above.
139+ key : >-
140+ lint:check-cpp-static-full-on-${{matrix.os}}-with-${{
141+ matrix.use_shared_libs == true && 'shared' || 'static'
142+ }}-libs-${{hashFiles(
143+ '.task/checksum/lint-check-cpp-static-full',
144+ '.task/checksum/utils-cpp-lint-clang-tidy-*',
145+ 'build/lint-clang-tidy/**/*'
146+ )}}
0 commit comments