diff --git a/.github/workflows/clp-core-build-macos.yaml b/.github/workflows/clp-core-build-macos.yaml index e1408eac65..aece00ed2d 100644 --- a/.github/workflows/clp-core-build-macos.yaml +++ b/.github/workflows/clp-core-build-macos.yaml @@ -89,8 +89,37 @@ jobs: --num-jobs $(getconf _NPROCESSORS_ONLN) --test-spec "~[Stopwatch]" + # NOTE: We don't use the cache for scheduled runs so that they run lint:check-cpp-static-full + # on all files. + - if: "'schedule' != github.event_name" + name: "Restore lint:check-cpp-static-full cache" + id: "cache-restore-lint-check-cpp-static-full" + uses: "actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684" + with: + path: | + .task/checksum/lint-check-cpp-static-full + .task/checksum/utils-cpp-lint-clang-tidy-* + build/lint-clang-tidy + + # NOTE: We use a per-OS cache since different OSes may trigger different clang-tidy + # violations. + key: "main-branch-${{matrix.os}}-lint:check-cpp-static-full" + # TODO: When enough files are passing clang-tidy, switch to a full pass on schedule only. # - run: >- # task lint:check-cpp-${{(github.event_name == 'schedule') && 'full' || 'diff'}} - run: "task lint:check-cpp-full" shell: "bash" + + # Cache the source file checksums and the generated files (logs) for the + # lint:check-cpp-static-full task, but only if it runs successfully on the main branch. + # NOTE: If we don't cache the generated files, the task will re-run to generate them. + - if: "'pull_request' != github.event_name && 'refs/heads/main' == github.ref" + name: "Update lint:check-cpp-static-full cache" + uses: "actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684" + with: + path: | + .task/checksum/lint-check-cpp-static-full + .task/checksum/utils-cpp-lint-clang-tidy-* + build/lint-clang-tidy + key: "${{steps.cache-restore-lint-check-cpp-static-full.outputs.cache-primary-key}}" diff --git a/.github/workflows/clp-core-build.yaml b/.github/workflows/clp-core-build.yaml index 5c95ae7ef9..1ab1766694 100644 --- a/.github/workflows/clp-core-build.yaml +++ b/.github/workflows/clp-core-build.yaml @@ -327,6 +327,22 @@ jobs: run: "chown $(id -u):$(id -g) -R ." shell: "bash" + # NOTE: We don't use the cache for scheduled runs so that they run lint:check-cpp-static-full + # on all files. + - if: "'schedule' != github.event_name" + name: "Restore lint:check-cpp-static-full cache" + id: "cache-restore-lint-check-cpp-static-full" + uses: "actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684" + with: + path: | + .task/checksum/lint-check-cpp-static-full + .task/checksum/utils-cpp-lint-clang-tidy-* + build/lint-clang-tidy + + # NOTE: We use a per-OS cache since different OSes may trigger different clang-tidy + # violations. + key: "main-branch-ubuntu-jammy-lint:check-cpp-static-full" + - uses: "./.github/actions/run-on-image" env: OS_NAME: "ubuntu-jammy" @@ -339,3 +355,16 @@ jobs: # run_command: >- # task lint:check-cpp-${{(github.event_name == 'schedule') && 'full' || 'diff'}} run_command: "task lint:check-cpp-full" + + # Cache the source file checksums and the generated files (logs) for the + # lint:check-cpp-static-full task, but only if it runs successfully on the main branch. + # NOTE: If we don't cache the generated files, the task will re-run to generate them. + - if: "'pull_request' != github.event_name && 'refs/heads/main' == github.ref" + name: "Update lint:check-cpp-static-full cache" + uses: "actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684" + with: + path: | + .task/checksum/lint-check-cpp-static-full + .task/checksum/utils-cpp-lint-clang-tidy-* + build/lint-clang-tidy + key: "${{steps.cache-restore-lint-check-cpp-static-full.outputs.cache-primary-key}}"