Fix CI: Gitea Actions cache keys never actually changed
CI / Publish to npm registry (push) Canceled after 0s
CI / Build wasm engine (push) Canceled after 5m11s

Confirmed via Gitea's own documentation (about.gitea.com's actions-cache
tutorial): Gitea Actions doesn't support the built-in hashFiles()
expression function GitHub Actions provides - it silently evaluates to
an empty string rather than erroring, so all three cache keys
(emsdk-${{hashFiles(...)}}, etc.) were actually just the constant
strings "emsdk-", "deps-wasm32-", "libwinevbs-wasm32-" on every run,
regardless of whether scripts/versions.sh or patches/ actually changed -
this is why caching "didn't work properly": correctness-wise it's worse
than no caching, since a stale cache from before a version/patch bump
would keep being reused indefinitely instead of invalidating.

Replaced with a plain sha256sum-based step that hashes the same inputs
by hand and exposes them via GITHUB_OUTPUT - no dependency on Gitea
gaining hashFiles() support, and verified locally to produce distinct,
non-empty hashes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-22 18:27:07 +02:00
co-authored by Claude Sonnet 5
parent d7b95dbac8
commit 4f4c2b6b91
+32 -6
View File
@@ -16,23 +16,36 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y bison cmake curl python3 sudo apt-get install -y bison cmake curl python3
# Gitea Actions doesn't support the built-in hashFiles() expression
# function (unlike GitHub Actions) - it silently evaluates to an empty
# string, which turned every cache key below into the same constant
# string regardless of what actually changed, so a cache entry from
# before a dependency-version or patch change would still be reused
# forever. Hash the same inputs by hand instead.
- name: Compute cache keys
id: cache-keys
run: |
echo "emsdk=$(sha256sum scripts/versions.sh | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "deps-wasm32=$(cat scripts/versions.sh $(find patches -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "libwinevbs=$(cat scripts/versions.sh $(find patches/libwinevbs -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Cache emsdk - name: Cache emsdk
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: emsdk path: emsdk
key: emsdk-${{ hashFiles('scripts/versions.sh') }} key: emsdk-${{ steps.cache-keys.outputs.emsdk }}
- name: Cache wasm32 dependency builds - name: Cache wasm32 dependency builds
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: build/deps-wasm32 path: build/deps-wasm32
key: deps-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/**') }} key: deps-wasm32-${{ steps.cache-keys.outputs.deps-wasm32 }}
- name: Cache libwinevbs build - name: Cache libwinevbs build
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: vendor/libwinevbs/build path: vendor/libwinevbs/build
key: libwinevbs-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/libwinevbs/**') }} key: libwinevbs-wasm32-${{ steps.cache-keys.outputs.libwinevbs }}
- name: Setup (fetch + patch vendor sources) - name: Setup (fetch + patch vendor sources)
run: ./scripts/setup.sh run: ./scripts/setup.sh
@@ -77,23 +90,36 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y bison cmake curl python3 sudo apt-get install -y bison cmake curl python3
# Gitea Actions doesn't support the built-in hashFiles() expression
# function (unlike GitHub Actions) - it silently evaluates to an empty
# string, which turned every cache key below into the same constant
# string regardless of what actually changed, so a cache entry from
# before a dependency-version or patch change would still be reused
# forever. Hash the same inputs by hand instead.
- name: Compute cache keys
id: cache-keys
run: |
echo "emsdk=$(sha256sum scripts/versions.sh | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "deps-wasm32=$(cat scripts/versions.sh $(find patches -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "libwinevbs=$(cat scripts/versions.sh $(find patches/libwinevbs -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Cache emsdk - name: Cache emsdk
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: emsdk path: emsdk
key: emsdk-${{ hashFiles('scripts/versions.sh') }} key: emsdk-${{ steps.cache-keys.outputs.emsdk }}
- name: Cache wasm32 dependency builds - name: Cache wasm32 dependency builds
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: build/deps-wasm32 path: build/deps-wasm32
key: deps-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/**') }} key: deps-wasm32-${{ steps.cache-keys.outputs.deps-wasm32 }}
- name: Cache libwinevbs build - name: Cache libwinevbs build
uses: https://github.com/actions/cache@v4 uses: https://github.com/actions/cache@v4
with: with:
path: vendor/libwinevbs/build path: vendor/libwinevbs/build
key: libwinevbs-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/libwinevbs/**') }} key: libwinevbs-wasm32-${{ steps.cache-keys.outputs.libwinevbs }}
- name: Setup (fetch + patch vendor sources) - name: Setup (fetch + patch vendor sources)
run: ./scripts/setup.sh run: ./scripts/setup.sh