Add build cache to CI workflow

NOTE: This requires an update to your build container. See
e132563a5a

This normalizes file modtimes with git-restore-mtime, and caches
the build directory. Subsequent runs will only rebuild the files
that have changed.
This commit is contained in:
Luke Street 2025-08-14 19:05:46 -06:00
parent 5e2fa2a574
commit b4be7cfa39

View File

@ -22,15 +22,30 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0
submodules: recursive submodules: recursive
# Set Git config # Set Git config
- name: Git config - name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" 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 # Copy the original files to the workspace
- name: Prepare - 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 # Build the project
- name: Build - name: Build