ci: build the dev images in parallel with the checks and gate only the push [CI]
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/push/dev-image Pipeline failed

This commit is contained in:
justme committed 2026-10-19 13:58:21 +08:00
1 parent b33e50696d
commit 1ccbb847b5
6 files changed
+99 -8

No files matched your search

+5 -1
View File
@@ -9,6 +9,7 @@ export NPM_CONFIG_CACHE="${NPM_CONFIG_CACHE:-/home/justme/.npm}"
web="$root/web"
dirs=(node_modules display/node_modules admin/node_modules)
mkdir -p "$cache"
exec 9> "$cache/.lock"
key="$(cat "$web/package-lock.json" "$web/package.json" "$web/display/package.json" "$web/admin/package.json" | sha256sum | cut -c1-16)"
@@ -36,6 +37,8 @@ save() {
(cd "$cache" && ls -1t | grep -v '\.tmp\.' | tail -n +4 | xargs -r rm -rf)
}
# 并行的 workflow(web-build 和开发镜像里的前端构建)会同时读写这份缓存:恢复和保存期间持锁
flock -w 600 9 || { echo "could not get the node_modules cache lock" >&2; exit 1; }
if restore; then
echo "restored node_modules from the cache ($key)"
else
@@ -44,6 +47,7 @@ else
npm ci --prefix "$web" --prefer-offline
save || echo "could not save the node_modules cache" >&2
fi
flock -u 9
# 展示端和管理端并行构建,再检查 CSS
pids=()
@@ -52,4 +56,4 @@ pids=()
failed=0
for pid in "${pids[@]}"; do wait "$pid" || failed=1; done
[[ "$failed" == 0 ]] || { echo "web build failed" >&2; exit 1; }
npm run lint:css --prefix "$web"
[[ -n "${WEB_SKIP_LINT:-}" ]] || npm run lint:css --prefix "$web"