mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 07:24:55 +08:00
100 lines
2.9 KiB
Bash
100 lines
2.9 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "${repo_root}"
|
|
|
|
fail() {
|
|
printf 'doc status check failed: %s\n' "$*" >&2
|
|
exit 1
|
|
}
|
|
|
|
require_file() {
|
|
local file="$1"
|
|
[[ -f "${file}" ]] || fail "missing file: ${file}"
|
|
}
|
|
|
|
require_contains() {
|
|
local file="$1"
|
|
local needle="$2"
|
|
grep -Fq -- "${needle}" "${file}" || fail "${file} missing required text: ${needle}"
|
|
}
|
|
|
|
require_regex() {
|
|
local file="$1"
|
|
local pattern="$2"
|
|
grep -Eiq -- "${pattern}" "${file}" || fail "${file} missing required pattern: ${pattern}"
|
|
}
|
|
|
|
required_docs=(
|
|
"CURRENT_STATUS.md"
|
|
"USERGUIDE.md"
|
|
"PROJECT_PLAN.md"
|
|
"docs/architecture/assetbundle.md"
|
|
"docs/guides/development.md"
|
|
"docs/reference/rpc-backend-api.md"
|
|
"docs/reports/CURRENT_GAPS.md"
|
|
"docs/reports/GO_STATUS.md"
|
|
"docs/reports/PARSER_FREEZE.md"
|
|
"internal/api/testdata/contract/README.md"
|
|
)
|
|
|
|
for file in "${required_docs[@]}"; do
|
|
require_file "${file}"
|
|
done
|
|
|
|
placeholder_readmes=(
|
|
"api/README.md"
|
|
"api/proto/README.md"
|
|
"internal/config/README.md"
|
|
"internal/downloader/README.md"
|
|
"internal/extractor/README.md"
|
|
"internal/manifest/README.md"
|
|
"internal/storage/README.md"
|
|
"pkg/README.md"
|
|
"pkg/cas/README.md"
|
|
"pkg/translator/README.md"
|
|
"pkg/types/README.md"
|
|
"web/README.md"
|
|
"web/admin/README.md"
|
|
"web/shared/README.md"
|
|
)
|
|
|
|
for file in "${placeholder_readmes[@]}"; do
|
|
require_file "${file}"
|
|
require_regex "${file}" "not implemented"
|
|
require_contains "${file}" "docs/reports/GO_STATUS.md"
|
|
done
|
|
|
|
parser_freeze_docs=(
|
|
"CURRENT_STATUS.md"
|
|
"PROJECT_PLAN.md"
|
|
"docs/architecture/assetbundle.md"
|
|
"docs/guides/development.md"
|
|
"docs/reports/CURRENT_GAPS.md"
|
|
)
|
|
|
|
for file in "${parser_freeze_docs[@]}"; do
|
|
require_contains "${file}" "docs/reports/PARSER_FREEZE.md"
|
|
done
|
|
|
|
require_contains "USERGUIDE.md" "scope=resource_bootstrap_only"
|
|
require_contains "USERGUIDE.md" "package_update_manifest=false"
|
|
require_contains "docs/reports/GO_STATUS.md" "resource bootstrap + CDN path"
|
|
require_contains "docs/reports/GO_STATUS.md" "internal/api/testdata/contract/"
|
|
require_contains "CURRENT_STATUS.md" "cmd/bat-api"
|
|
require_contains "CURRENT_STATUS.md" "internal/api/testdata/contract/"
|
|
require_contains "docs/reports/CURRENT_GAPS.md" "非完整官方游戏 API"
|
|
require_contains "docs/reports/CURRENT_GAPS.md" "daemon.clean-stable"
|
|
require_contains "docs/reference/rpc-backend-api.md" "daemon.restart"
|
|
require_contains "docs/reference/rpc-backend-api.md" "daemon.clean-stable"
|
|
require_contains "docs/reference/rpc-backend-api.md" "localized_release_status"
|
|
|
|
require_contains "Makefile" "check-docs:"
|
|
require_contains ".gitea/workflows/bat.yml" "make check-docs"
|
|
require_contains ".gitea/workflows/bat.yml" "make test-go-api"
|
|
require_contains ".gitea/workflows/bat.yml" "go vet ./internal/api/... ./internal/backendrpc/... ./cmd/bat-api/..."
|
|
require_contains ".gitea/workflows/bat.yml" "go build -o /tmp/bat-api ./cmd/bat-api"
|
|
|
|
printf 'doc status check ok\n'
|