mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-28 11:16:37 +08:00
77e3fdd1f6
After deploying the binary against a fresh data dir and exercising every
major REST endpoint by hand, codify the verification as a re-runnable
script.
scripts/smoke-test.sh:
- Spins up bin/mediastation-go against a tempdir.
- Generates 3 sample clips (movie, tv, anime) + an external SRT.
- Walks 26 assertions: health → auth → libraries → scan → ffprobe →
season parser → search → range stream → HLS playlist → external
subtitle → history → favourites → playlists → RBAC (alice 403) →
NFO export → recycle bin → SPA fallback → graceful shutdown.
- Tears the server down via SIGTERM and reports pass/fail counts.
- Exits non-zero on any failure so CI can use it as a deployment gate.
Local verification on this branch: PASS=26 FAIL=0.
Wiring:
- Makefile: new 'smoke' target, depends on 'build'.
- .github/workflows/ci.yml: third job 'smoke' that depends on backend
+ frontend, installs ffmpeg, builds both halves, then runs the
script. The CI pipeline now blocks merges that break end-to-end
deployability.
57 lines
1.1 KiB
Makefile
57 lines
1.1 KiB
Makefile
.PHONY: all build build-server build-web dev dev-web run docker docker-stop clean install-web tidy test vet smoke
|
|
|
|
# ---- 默认目标 ----
|
|
all: build
|
|
|
|
# ---- 全量构建(前端 + 后端) ----
|
|
build: build-web build-server
|
|
|
|
# ---- 后端构建 ----
|
|
# 使用纯 Go SQLite,可以 CGO_ENABLED=0 直接交叉编译。
|
|
build-server:
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o bin/mediastation-go ./cmd/server
|
|
|
|
# ---- 前端构建 ----
|
|
build-web:
|
|
cd web && npm install --silent && npm run build
|
|
|
|
# ---- 开发模式 ----
|
|
dev:
|
|
MEDIASTATION_APP_DEBUG=true go run ./cmd/server
|
|
|
|
dev-web:
|
|
cd web && npm run dev
|
|
|
|
# ---- 一键运行 ----
|
|
run: build
|
|
./bin/mediastation-go
|
|
|
|
# ---- Docker ----
|
|
docker:
|
|
docker compose up --build -d
|
|
|
|
docker-stop:
|
|
docker compose down
|
|
|
|
# ---- 工具命令 ----
|
|
install-web:
|
|
cd web && npm install
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
# ---- 端到端冒烟测试 ----
|
|
# Spins up the binary against a temp dir, exercises every REST surface,
|
|
# tears it back down. Fails the build on any regression.
|
|
smoke: build
|
|
./scripts/smoke-test.sh
|
|
|
|
clean:
|
|
rm -rf bin/ web/dist/ web/node_modules/
|