workflow: remake caching to use @actions/cache and cache only main as baseline
This commit is contained in:
+28
-21
@@ -4,6 +4,9 @@
|
||||
name: 'Build system'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
@@ -30,10 +33,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get describe
|
||||
id: vars
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITEA_OUTPUT
|
||||
run: |
|
||||
echo "sha=$(git rev-parse HEAD)" >> $GITEA_OUTPUT
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITEA_OUTPUT
|
||||
echo "describe=$(git describe --tags --always 2>/dev/null || git rev-parse --short HEAD)" >> $GITEA_OUTPUT
|
||||
|
||||
- name: Get toolchain hash
|
||||
id: toolchain-hash
|
||||
@@ -109,17 +116,17 @@ jobs:
|
||||
key: kolibri-toolchain-${{ steps.toolchain-hash.outputs.hash }}
|
||||
|
||||
- name: Restore build cache
|
||||
run: |
|
||||
CACHE_DIR="/build-cache/${{ steps.toolchain-hash.outputs.hash }}"
|
||||
if [ -d "$CACHE_DIR/.tup" ]; then
|
||||
cp -a "$CACHE_DIR/.tup" .tup
|
||||
cp -a "$CACHE_DIR/build-en_US" build-en_US 2>/dev/null || true
|
||||
cp -a "$CACHE_DIR/build-ru_RU" build-ru_RU 2>/dev/null || true
|
||||
cp -a "$CACHE_DIR/build-es_ES" build-es_ES 2>/dev/null || true
|
||||
echo "Restored build cache from $CACHE_DIR"
|
||||
else
|
||||
echo "No build cache found — first build"
|
||||
fi
|
||||
id: cache-build
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
.tup
|
||||
build-en_US
|
||||
build-ru_RU
|
||||
build-es_ES
|
||||
key: kolibri-build-main-${{ steps.toolchain-hash.outputs.hash }}-${{ steps.vars.outputs.sha }}
|
||||
restore-keys: |
|
||||
kolibri-build-main-${{ steps.toolchain-hash.outputs.hash }}-
|
||||
|
||||
- name: Sync tup DB with filesystem ctime
|
||||
run: |
|
||||
@@ -225,12 +232,12 @@ jobs:
|
||||
path: build-es_ES/data/kolibri.raw
|
||||
|
||||
- name: Save build cache
|
||||
run: |
|
||||
CACHE_DIR="/build-cache/${{ steps.toolchain-hash.outputs.hash }}"
|
||||
rm -rf "$CACHE_DIR"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
cp -a .tup "$CACHE_DIR/.tup"
|
||||
cp -a build-en_US "$CACHE_DIR/build-en_US"
|
||||
cp -a build-ru_RU "$CACHE_DIR/build-ru_RU"
|
||||
cp -a build-es_ES "$CACHE_DIR/build-es_ES"
|
||||
echo "Saved build cache to $CACHE_DIR ($(du -sh "$CACHE_DIR" | cut -f1))"
|
||||
if: gitea.ref == 'refs/heads/main' && steps.cache-build.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
.tup
|
||||
build-en_US
|
||||
build-ru_RU
|
||||
build-es_ES
|
||||
key: kolibri-build-main-${{ steps.toolchain-hash.outputs.hash }}-${{ steps.vars.outputs.sha }}
|
||||
|
||||
Reference in New Issue
Block a user