ci: Refactor timelord action to use git-warp-time fallback

Updates the timelord action to fall back to git-warp-time when the cache
is completely empty, enabling timestamp restoration even on fresh builds.
When git-warp-time is used, performs an unshallow fetch to get full history,
while subsequent runs use normal fetches. Simplifies the interface by making
inputs optional with sensible defaults.

Adds binary caching for timelord-cli and git-warp-time tools to avoid
repeated installations, and updates paths to use /usr/share/rust/.cargo/bin/
for the catthehacker runner image used by the dind profile (may need updating
if/when switching to standard image).

The main timelord restore now happens inside the Dockerfile itself, as Docker
intentionally wipes all file mtimes on COPY/ADD operations.
This commit is contained in:
Tom Foster 2025-09-08 04:32:23 +01:00
commit 7950e2cc7f
3 changed files with 106 additions and 34 deletions

View file

@ -150,10 +150,18 @@ jobs:
echo "Commit timestamp: $timestamp"
- uses: ./.forgejo/actions/timelord
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
with:
key: timelord-v0
path: .
id: timelord
- name: Copy timelord cache to workspace
shell: bash
run: |
mkdir -p ./timelord
if [ -d "${{ steps.timelord.outputs.database-path }}" ]; then
cp -r "${{ steps.timelord.outputs.database-path }}"/* ./timelord/
echo "Copied timelord cache to workspace"
else
echo "No timelord cache to copy"
fi
- name: Cache Rust registry
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
@ -217,6 +225,7 @@ jobs:
GIT_COMMIT_HASH_SHORT=${{ env.COMMIT_SHORT_SHA }}
GIT_REMOTE_URL=${{github.event.repository.html_url }}
GIT_REMOTE_COMMIT_URL=${{github.event.head_commit.url }}
CARGO_INCREMENTAL=${{ env.BUILDKIT_ENDPOINT != '' && '1' || '0' }}
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}