mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-08 15:43:42 +08:00
- detect-changed-driver-agents.test.sh: package-driver-release-assets.py 和 validate-driver-release-assets.py 改动的预期结果由「触发全部驱动重建」 改为「不触发任何驱动重建」,与脚本清单调整后的行为保持一致 - should-force-global-driver-builds.test.sh: 同上两个打包/校验脚本改动的 预期结果由 true 改为 false - 补充中文注释说明发布链路脚本不参与驱动二进制构建的原因 - 本地已安装 bash 5 验证两个测试文件全部通过
97 lines
3.2 KiB
Bash
Executable File
97 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
tmpdir="$(mktemp -d "${TMPDIR:-/tmp}/gonavi-force-global-driver-builds.XXXXXX")"
|
|
cleanup() {
|
|
rm -rf "$tmpdir"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
git init -q "$tmpdir"
|
|
mkdir -p "$tmpdir/tools" "$tmpdir/.github/workflows" "$tmpdir/internal/db"
|
|
cp tools/should-force-global-driver-builds.sh "$tmpdir/tools/should-force-global-driver-builds.sh"
|
|
cat >"$tmpdir/.github/workflows/dev-build.yml" <<'YAMLEOF'
|
|
name: Dev Build
|
|
YAMLEOF
|
|
cat >"$tmpdir/tools/package-driver-release-assets.py" <<'PYEOF'
|
|
print("package")
|
|
PYEOF
|
|
cat >"$tmpdir/tools/validate-driver-release-assets.py" <<'PYEOF'
|
|
print("validate")
|
|
PYEOF
|
|
cat >"$tmpdir/internal/db/duckdb_impl.go" <<'GOEOF'
|
|
package db
|
|
GOEOF
|
|
|
|
base_ref=""
|
|
cd "$tmpdir"
|
|
git add .
|
|
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m initial
|
|
base_ref="$(git rev-parse HEAD)"
|
|
|
|
(
|
|
cd "$tmpdir"
|
|
printf '\n# workflow change\n' >> .github/workflows/dev-build.yml
|
|
git add .github/workflows/dev-build.yml
|
|
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m 'workflow change'
|
|
actual="$(bash ./tools/should-force-global-driver-builds.sh --base "$base_ref" --head HEAD)"
|
|
if [[ "$actual" != "true" ]]; then
|
|
echo "expected workflow change to force global driver builds, got: ${actual:-<empty>}" >&2
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
(
|
|
cd "$tmpdir"
|
|
git reset --hard -q "$base_ref"
|
|
printf '\nprint("changed")\n' >> tools/package-driver-release-assets.py
|
|
git add tools/package-driver-release-assets.py
|
|
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m 'packaging change'
|
|
actual="$(bash ./tools/should-force-global-driver-builds.sh --base "$base_ref" --head HEAD)"
|
|
if [[ "$actual" != "false" ]]; then
|
|
echo "expected packaging-only change not to force global driver builds, got: ${actual:-<empty>}" >&2
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
(
|
|
cd "$tmpdir"
|
|
git reset --hard -q "$base_ref"
|
|
printf '\nprint("changed")\n' >> tools/validate-driver-release-assets.py
|
|
git add tools/validate-driver-release-assets.py
|
|
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m 'release asset validation change'
|
|
actual="$(bash ./tools/should-force-global-driver-builds.sh --base "$base_ref" --head HEAD)"
|
|
if [[ "$actual" != "false" ]]; then
|
|
echo "expected release asset validation-only change not to force global driver builds, got: ${actual:-<empty>}" >&2
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
(
|
|
cd "$tmpdir"
|
|
git reset --hard -q "$base_ref"
|
|
printf '\n// source-only change\n' >> internal/db/duckdb_impl.go
|
|
git add internal/db/duckdb_impl.go
|
|
git -c user.name=GoNavi -c user.email=gonavi@example.test commit -q -m 'duckdb source change'
|
|
actual="$(bash ./tools/should-force-global-driver-builds.sh --base "$base_ref" --head HEAD)"
|
|
if [[ "$actual" != "false" ]]; then
|
|
echo "expected source-only driver change not to force global driver builds, got: ${actual:-<empty>}" >&2
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
(
|
|
cd "$tmpdir"
|
|
actual="$(bash ./tools/should-force-global-driver-builds.sh --base all --head HEAD)"
|
|
if [[ "$actual" != "true" ]]; then
|
|
echo "expected base=all to force global driver builds, got: ${actual:-<empty>}" >&2
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
echo "should-force-global-driver-builds test passed"
|