forked from KolibriOS/kolibrios
workflow-fuse (#2)
Reviewed-on: #2 Co-authored-by: Burer <burer@kolibrios.org> Co-committed-by: Burer <burer@kolibrios.org>
This commit was merged in pull request #2.
This commit is contained in:
+47
-18
@@ -4,6 +4,9 @@
|
||||
name: 'Build system'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
@@ -34,7 +37,10 @@ jobs:
|
||||
|
||||
- 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
|
||||
@@ -97,10 +103,10 @@ jobs:
|
||||
mv clink /home/autobuild/tools/win32/bin/clink
|
||||
|
||||
- name: Prepare cache folder
|
||||
run: |
|
||||
rm /home/autobuild
|
||||
mv /root/autobuild /home/autobuild
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
rm -rf /home/autobuild
|
||||
mv /root/autobuild /home/autobuild
|
||||
|
||||
- name: Save toolchain
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
@@ -109,10 +115,27 @@ jobs:
|
||||
path: /home/autobuild
|
||||
key: kolibri-toolchain-${{ steps.toolchain-hash.outputs.hash }}
|
||||
|
||||
- name: Restore build cache
|
||||
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: |
|
||||
if [ -f .tup/db ]; then
|
||||
python3 .gitea/workflows/sync-tup-ctime.py
|
||||
fi
|
||||
|
||||
- name: Configure tup
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}
|
||||
|
||||
export ROOT=${{ gitea.workspace }}
|
||||
echo "CONFIG_KPACK_CMD= && kpack --nologo %o" | tee en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_KERPACK_CMD= && kerpack %o" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
@@ -120,25 +143,22 @@ jobs:
|
||||
echo "CONFIG_NO_MSVC=full" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
echo "CONFIG_INSERT_REVISION_ID=1" | tee -a en_US.config ru_RU.config es_ES.config
|
||||
|
||||
tup -v
|
||||
tup init
|
||||
if [ ! -d .tup ]; then
|
||||
tup init
|
||||
fi
|
||||
|
||||
# Configure en_US
|
||||
echo "CONFIG_LANG=en_US" >> en_US.config
|
||||
echo "CONFIG_BUILD_TYPE=en_US" >> en_US.config
|
||||
tup variant en_US.config
|
||||
[ -d build-en_US ] || tup variant en_US.config
|
||||
|
||||
# Configure ru_RU
|
||||
echo "CONFIG_LANG=ru_RU" >> ru_RU.config
|
||||
echo "CONFIG_BUILD_TYPE=ru_RU" >> ru_RU.config
|
||||
tup variant ru_RU.config
|
||||
|
||||
# Configure es_ES
|
||||
[ -d build-ru_RU ] || tup variant ru_RU.config
|
||||
|
||||
echo "CONFIG_LANG=es_ES" >> es_ES.config
|
||||
echo "CONFIG_BUILD_TYPE=es_ES" >> es_ES.config
|
||||
tup variant es_ES.config
|
||||
[ -d build-es_ES ] || tup variant es_ES.config
|
||||
|
||||
# -------------------------- Build en_US ------------------------- #
|
||||
- name: (en_US) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
@@ -163,7 +183,6 @@ jobs:
|
||||
name: kolibrios-en_US-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-en_US/data/kolibri.raw
|
||||
|
||||
# -------------------------- Build ru_RU ------------------------- #
|
||||
- name: (ru_RU) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
@@ -188,7 +207,6 @@ jobs:
|
||||
name: kolibrios-ru_RU-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-ru_RU/data/kolibri.raw
|
||||
|
||||
# -------------------------- Build es_ES ------------------------- #
|
||||
- name: (es_ES) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
@@ -212,3 +230,14 @@ jobs:
|
||||
with:
|
||||
name: kolibrios-es_ES-${{ steps.vars.outputs.sha_short }}.raw
|
||||
path: build-es_ES/data/kolibri.raw
|
||||
|
||||
- name: Save build cache
|
||||
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 }}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
# Sync tup's mtime/mtime_ns in .tup/db with the actual filesystem ctime.
|
||||
#
|
||||
# On Linux, tup uses st_ctim (ctime) for change detection, not st_mtim.
|
||||
# After restoring build cache with cp -a, files get new ctimes while the
|
||||
# database still has old values. This script updates the database to match.
|
||||
#
|
||||
# Usage: python3 sync-tup-ctime.py [path/to/.tup/db]
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
db_path = sys.argv[1] if len(sys.argv) > 1 else ".tup/db"
|
||||
if not os.path.isfile(db_path):
|
||||
sys.exit(f"Database not found: {db_path}")
|
||||
|
||||
db = sqlite3.connect(db_path)
|
||||
nodes = {
|
||||
node_id: (parent_id, name)
|
||||
for node_id, parent_id, name in db.execute(
|
||||
"select id, dir, name from node where type in (0, 2)"
|
||||
)
|
||||
}
|
||||
paths, updated, skipped = {}, 0, 0
|
||||
|
||||
for node_id, dir_id, name, old_sec, old_ns in db.execute(
|
||||
"select id, dir, name, mtime, mtime_ns from node where type in (0, 2, 4)"
|
||||
):
|
||||
if dir_id not in paths:
|
||||
parts, cur = [], dir_id
|
||||
while cur in nodes:
|
||||
cur, part = nodes[cur]
|
||||
parts.append(part)
|
||||
paths[dir_id] = "/".join(reversed(parts))
|
||||
path = os.path.join(paths[dir_id], name) if paths[dir_id] else name
|
||||
try:
|
||||
stat = os.stat(path)
|
||||
except OSError:
|
||||
skipped += 1
|
||||
continue
|
||||
sec = int(stat.st_ctime)
|
||||
ns = stat.st_ctime_ns - sec * 1_000_000_000
|
||||
if sec == old_sec and ns == old_ns:
|
||||
continue
|
||||
db.execute("update node set mtime=?, mtime_ns=? where id=?", (sec, ns, node_id))
|
||||
updated += 1
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
print(f"Updated ctime for {updated} nodes, skipped {skipped} missing files")
|
||||
Reference in New Issue
Block a user