b43601b4fd
- 新增 scripts/ci/provision-{mac,windows}.sh:幂等预置,按 Flutter 版本
stamp 短路,pipeline 首跑自动 precache + 预热缓存,运行时不再下载 engine
- scripts/ci/_env.sh:抽出共用镜像 env,compile 脚本统一 source
- deploy.yml:build-macos needs build-linux-web,同一 mac runner 串行
执行,避免排队超时;各 build job 加 Provision 前置步骤
- 删除 .gitea/workflows/ci.yml
- backup.yml:暂停定时备份(保留 workflow_dispatch 手动触发)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
63 lines
2.1 KiB
Bash
63 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# provision-mac.sh — idempotent provisioning for the macOS host runner.
|
|
#
|
|
# Pre-warms everything the build jobs (compile.sh / compile-macos.sh) would
|
|
# otherwise download at runtime: Flutter macOS+web engine artifacts, pub
|
|
# packages, Go modules, npm deps. Safe to run on every pipeline run — it
|
|
# short-circuits via a stamp file keyed to the installed Flutter version, so
|
|
# once provisioned it returns in milliseconds and downloads nothing.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(dirname "$0")"
|
|
# shellcheck source=scripts/ci/_env.sh
|
|
. "${SCRIPT_DIR}/_env.sh"
|
|
|
|
STAMP_DIR="${HOME}/.cache/jiu-ci"
|
|
STAMP="${STAMP_DIR}/provisioned-mac"
|
|
CUR="${STAMP_DIR}/.flutter-version-mac.cur"
|
|
mkdir -p "$STAMP_DIR"
|
|
|
|
# --- detection: skip if already provisioned for this Flutter version ---
|
|
if ! command -v flutter >/dev/null 2>&1; then
|
|
echo "ERROR: flutter not found on PATH. Install Flutter on this runner first." >&2
|
|
exit 1
|
|
fi
|
|
flutter --version --machine > "$CUR" 2>/dev/null || flutter --version > "$CUR" 2>&1 || true
|
|
|
|
if [ -s "$STAMP" ] && cmp -s "$STAMP" "$CUR"; then
|
|
echo "==> provision-mac: already provisioned (Flutter unchanged), skipping."
|
|
exit 0
|
|
fi
|
|
|
|
echo "==> provision-mac: not provisioned (or Flutter changed) — running."
|
|
|
|
# --- toolchain presence (do not auto-install system-level tools) ---
|
|
for tool in go node npm; do
|
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
echo "ERROR: '$tool' not found on PATH. Install it on this runner first." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# --- warm Flutter platform engines (the macOS SDK download seen in CI) ---
|
|
echo "==> precache Flutter engines (macos, web)"
|
|
flutter precache --macos --web --universal
|
|
|
|
# --- warm dependency caches ---
|
|
echo "==> flutter pub get (client)"
|
|
(cd "${SCRIPT_DIR}/../../client" && flutter pub get)
|
|
|
|
echo "==> go mod download (backend)"
|
|
(cd "${SCRIPT_DIR}/../../backend" && go mod download)
|
|
|
|
echo "==> npm ci (web)"
|
|
(cd "${SCRIPT_DIR}/../../web" && npm ci --prefer-offline)
|
|
|
|
# --- mark provisioned ---
|
|
cp "$CUR" "$STAMP"
|
|
echo "==> provision-mac: done."
|
|
echo "--- versions ---"
|
|
flutter --version | head -1
|
|
go version
|
|
node --version
|