mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-14 10:29:52 +08:00
🐛 fix(ci): 修复 driver revision 跨平台错配
- 改为在 dev/release 主程序构建前按当前平台全量生成 driver-agent revision 指纹 - 避免只重算部分驱动时混入其他平台旧 revision,导致最新 dev 应用误判全量 driver mismatch - 为 windows/amd64 始终准备 DuckDB CGO toolchain,保证全量 revision 生成可执行 - 补充 revision 平台相关回归脚本,覆盖 darwin/arm64 与 windows/amd64 生成差异
This commit is contained in:
15
.github/workflows/dev-build.yml
vendored
15
.github/workflows/dev-build.yml
vendored
@@ -274,7 +274,7 @@ jobs:
|
||||
|
||||
- name: Setup MSYS2 Toolchain For DuckDB (Windows AMD64)
|
||||
id: msys2_duckdb
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
continue-on-error: true
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
@@ -284,7 +284,7 @@ jobs:
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
|
||||
- name: Configure DuckDB CGO Toolchain (Windows AMD64)
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
function Find-MingwBin([string[]]$candidates) {
|
||||
@@ -342,7 +342,7 @@ jobs:
|
||||
Write-Host "✅ 已配置 DuckDB cgo 编译器: gcc=$gcc g++=$gxx"
|
||||
|
||||
- name: Verify DuckDB CGO Toolchain (Windows AMD64)
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
& "$env:CC" --version
|
||||
@@ -360,16 +360,11 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
env:
|
||||
CHANGED_DRIVER_AGENTS: ${{ needs.driver_agents.outputs.drivers }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
DEV_VERSION="${{ steps.version.outputs.version }}"
|
||||
if [ -n "$CHANGED_DRIVER_AGENTS" ]; then
|
||||
./tools/generate-driver-agent-revisions.sh --platform "${{ matrix.platform }}" --drivers "$CHANGED_DRIVER_AGENTS"
|
||||
else
|
||||
echo "🧭 No driver-agent changes; keeping committed driver revisions"
|
||||
fi
|
||||
echo "🧭 为 ${{ matrix.platform }} 全量生成 driver-agent revision 指纹,避免跨平台沿用旧 revision"
|
||||
./tools/generate-driver-agent-revisions.sh --platform "${{ matrix.platform }}"
|
||||
if [ -n "${{ matrix.wails_tags }}" ]; then
|
||||
wails build -s -skipbindings -platform ${{ matrix.platform }} -clean -o ${{ matrix.build_name }} -tags "${{ matrix.wails_tags }}" -ldflags "-s -w -X GoNavi-Wails/internal/app.AppVersion=${DEV_VERSION}"
|
||||
else
|
||||
|
||||
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -255,7 +255,7 @@ jobs:
|
||||
|
||||
- name: Setup MSYS2 Toolchain For DuckDB (Windows AMD64)
|
||||
id: msys2_duckdb
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
continue-on-error: true
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
@@ -265,7 +265,7 @@ jobs:
|
||||
mingw-w64-ucrt-x86_64-gcc
|
||||
|
||||
- name: Configure DuckDB CGO Toolchain (Windows AMD64)
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
function Find-MingwBin([string[]]$candidates) {
|
||||
@@ -323,7 +323,7 @@ jobs:
|
||||
Write-Host "✅ 已配置 DuckDB cgo 编译器: gcc=$gcc g++=$gxx"
|
||||
|
||||
- name: Verify DuckDB CGO Toolchain (Windows AMD64)
|
||||
if: ${{ matrix.build_optional_agents && matrix.platform == 'windows/amd64' && contains(format(',{0},', needs.driver_agents.outputs.drivers), ',duckdb,') }}
|
||||
if: ${{ matrix.platform == 'windows/amd64' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
& "$env:CC" --version
|
||||
@@ -331,15 +331,10 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
env:
|
||||
CHANGED_DRIVER_AGENTS: ${{ needs.driver_agents.outputs.drivers }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -n "$CHANGED_DRIVER_AGENTS" ]; then
|
||||
./tools/generate-driver-agent-revisions.sh --platform "${{ matrix.platform }}" --drivers "$CHANGED_DRIVER_AGENTS"
|
||||
else
|
||||
echo "🧭 No driver-agent changes; keeping committed driver revisions"
|
||||
fi
|
||||
echo "🧭 为 ${{ matrix.platform }} 全量生成 driver-agent revision 指纹,避免跨平台沿用旧 revision"
|
||||
./tools/generate-driver-agent-revisions.sh --platform "${{ matrix.platform }}"
|
||||
if [ -n "${{ matrix.wails_tags }}" ]; then
|
||||
wails build -s -skipbindings -platform ${{ matrix.platform }} -clean -o ${{ matrix.build_name }} -tags "${{ matrix.wails_tags }}" -ldflags "-s -w -X GoNavi-Wails/internal/app.AppVersion=${{ github.ref_name }}"
|
||||
else
|
||||
|
||||
64
tools/generate-driver-agent-revisions.test.sh
Normal file
64
tools/generate-driver-agent-revisions.test.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
extract_revision() {
|
||||
local file="$1"
|
||||
local driver="$2"
|
||||
sed -n "s/.*\"${driver}\"[[:space:]]*:[[:space:]]*\"\\([^\"]*\\)\".*/\\1/p" "$file" | head -n 1
|
||||
}
|
||||
|
||||
run_case() {
|
||||
local platform="$1"
|
||||
local drivers="$2"
|
||||
local tmpdir
|
||||
tmpdir="$(mktemp -d "${TMPDIR:-/tmp}/gonavi-generate-driver-revisions.XXXXXX")"
|
||||
trap 'rm -rf "$tmpdir"' RETURN
|
||||
|
||||
rsync -a --exclude .git ./ "$tmpdir/" >/dev/null
|
||||
(
|
||||
cd "$tmpdir"
|
||||
GONAVI_DRIVER_REVISION_JOBS=1 bash ./tools/generate-driver-agent-revisions.sh --platform "$platform" --drivers "$drivers" >/dev/null
|
||||
cat internal/db/driver_agent_revisions_gen.go
|
||||
)
|
||||
}
|
||||
|
||||
darwin_output="$(run_case darwin/arm64 mariadb,duckdb)"
|
||||
windows_output="$(run_case windows/amd64 mariadb,duckdb)"
|
||||
|
||||
darwin_file="$(mktemp "${TMPDIR:-/tmp}/gonavi-darwin-revisions.XXXXXX")"
|
||||
windows_file="$(mktemp "${TMPDIR:-/tmp}/gonavi-windows-revisions.XXXXXX")"
|
||||
cleanup() {
|
||||
rm -f "$darwin_file" "$windows_file"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
printf '%s\n' "$darwin_output" >"$darwin_file"
|
||||
printf '%s\n' "$windows_output" >"$windows_file"
|
||||
|
||||
darwin_mariadb="$(extract_revision "$darwin_file" mariadb)"
|
||||
windows_mariadb="$(extract_revision "$windows_file" mariadb)"
|
||||
if [[ -z "$darwin_mariadb" || -z "$windows_mariadb" ]]; then
|
||||
echo "expected mariadb revision to be generated for both platforms" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$darwin_mariadb" == "$windows_mariadb" ]]; then
|
||||
echo "expected mariadb revision to differ between darwin/arm64 and windows/amd64, got identical value: $darwin_mariadb" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
darwin_duckdb="$(extract_revision "$darwin_file" duckdb)"
|
||||
windows_duckdb="$(extract_revision "$windows_file" duckdb)"
|
||||
if [[ -z "$darwin_duckdb" || -z "$windows_duckdb" ]]; then
|
||||
echo "expected duckdb revision to be generated for both platforms" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$darwin_duckdb" == "$windows_duckdb" ]]; then
|
||||
echo "expected duckdb revision to differ between darwin/arm64 and windows/amd64, got identical value: $darwin_duckdb" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "generate-driver-agent-revisions platform test passed"
|
||||
Reference in New Issue
Block a user