From b4be7cfa391c54a0f23e24f0646651a3999b206f Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 14 Aug 2025 19:05:46 -0600 Subject: [PATCH] Add build cache to CI workflow NOTE: This requires an update to your build container. See https://github.com/encounter/dtk-template-build/commit/e132563a5a88c58b933022f435cfd5a784d7069b This normalizes file modtimes with git-restore-mtime, and caches the build directory. Subsequent runs will only rebuild the files that have changed. --- .github.example/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github.example/workflows/build.yml b/.github.example/workflows/build.yml index e713413..8593298 100644 --- a/.github.example/workflows/build.yml +++ b/.github.example/workflows/build.yml @@ -22,15 +22,30 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive # Set Git config - name: Git config run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + # Normalize file mod times + - name: Restore timestamps + run: uv run https://raw.githubusercontent.com/MestreLion/git-tools/refs/tags/v2022.12/git-restore-mtime + # Copy the original files to the workspace - name: Prepare - run: cp -R /orig . + run: cp -a /orig . + + # Restore cached files + - name: Cache build + uses: actions/cache@v4 + with: + path: | + build + .ninja_deps + .ninja_log + key: ${{ runner.os }}-${{ matrix.version }} # Build the project - name: Build