Skip to content

v1.0.5: test release (draft, for upgrade testing) #116

v1.0.5: test release (draft, for upgrade testing)

v1.0.5: test release (draft, for upgrade testing) #116

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
run: cd frontend && npm ci && npm run build
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Version consistency check
# 防止发版时漏 bump 某个 Cargo.toml —— v1.0.1 就踩过这个坑:
# binary/server 已经是 1.0.1,但 crates/core 还停在 0.12.2,
# 导致升级引擎(在 core 里用 env!("CARGO_PKG_VERSION"))拿到的
# "当前版本"一直是 0.12.x,升级后版本号反而倒退。
#
# 规则:产品版本(binary/core/server 三处 Cargo.toml + Cargo.lock 里
# 对应的三个包)必须完全一致。base capability 层(protocol/
# tail-engine/search-engine)版本独立,不在此检查范围。
run: |
set -euo pipefail
expected=$(grep -m1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "expected product version: $expected"
fail=0
for f in crates/core/Cargo.toml crates/server/Cargo.toml; do
v=$(grep -m1 '^version = ' "$f" | sed 's/version = "\(.*\)"/\1/')
if [ "$v" != "$expected" ]; then
echo "❌ $f version is '$v', expected '$expected'"
fail=1
fi
done
# Cargo.lock: each of tailr / tailr-core / tailr-server must match.
for pkg in tailr tailr-core tailr-server; do
v=$(awk -v p="$pkg" '
/^name = / { matched = ($0 == "name = \"" p "\"") }
/^version = / && matched { print $0; exit }
' Cargo.lock | sed 's/version = "\(.*\)"/\1/')
if [ "$v" != "$expected" ]; then
echo "❌ Cargo.lock package '$pkg' version is '$v', expected '$expected'"
fail=1
fi
done
if [ "$fail" -ne 0 ]; then
echo ""
echo "Version mismatch detected. Bump the offending Cargo.toml so it"
echo "matches the binary version ($expected), then re-run 'cargo update -p <pkg>'"
echo "if needed to sync Cargo.lock."
exit 1
fi
echo "✅ product version consistent across binary/core/server ($expected)"
- name: Check
run: cargo check --workspace
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Test
run: cargo test --workspace
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: cd frontend && npm ci
- name: i18n key check
# 防止加 key 后 JSON 没同步 / 两语言不一致。dev server 的 HMR 对
# JSON 改动不可靠,运行时难以发现,所以静态检查兜底。
run: cd frontend && npm run check:i18n
- name: Type check
run: cd frontend && npx vue-tsc --noEmit
- name: Build
run: cd frontend && npm run build