🐛 fix(stats): switch badges to self-hosted svg
Ubuntu System Information / show-system-info (push) Successful in 0s

This commit is contained in:
csh
2026-05-22 15:45:24 +08:00
parent d4fa498a4a
commit 1259495cbb
5 changed files with 385 additions and 230 deletions
+22
View File
@@ -199,6 +199,27 @@ test_stats_workflow_avoids_eval_find() {
grep -q 'LANG_FIND_ARGS=()' "${file}" || fail "stats workflow should build language-specific find arguments via arrays"
}
test_stats_workflow_uses_svg_badges() {
local file workflow_doc
file="${REPO_ROOT}/.gitea/workflows/update_stats_badge.yaml"
workflow_doc="${REPO_ROOT}/WORKFLOW.md"
grep -q 'total-lines.svg' "${file}" || fail "stats workflow should generate total-lines.svg"
grep -q 'total-files.svg' "${file}" || fail "stats workflow should generate total-files.svg"
grep -q 'language-count.svg' "${file}" || fail "stats workflow should generate language-count.svg"
grep -Fq '{language}-lines.svg' "${file}" || fail "stats workflow should describe per-language svg badges"
grep -q '/src/branch/${{ env.BADGE_BRANCH }}/README.md' "${file}" || fail "stats workflow summary should link to stats branch root README"
! rg -q '/src/branch/\$\{\{ env.BADGE_BRANCH \}\}/\$\{\{ env.BADGE_DIR \}\}/README\.md' "${file}" || fail "stats workflow should not place README.md under the badge directory"
! rg -q 'img\.shields\.io/endpoint' "${file}" || fail "stats workflow should not depend on Shields endpoint badges"
! rg -q 'total-lines\.json|total-files\.json|\$\{lang_id\}-lines\.json|\$\{lang_id\}-files\.json' "${file}" || fail "stats workflow should not generate json badge payloads"
! rg -q 'GitHub Actions' "${file}" || fail "stats workflow should not mention GitHub Actions"
grep -q 'Gitea Actions' "${file}" || fail "stats workflow should mention Gitea Actions in generated content"
grep -q 'badges/cpp-lines.svg' "${workflow_doc}" || fail "WORKFLOW.md should show svg badge usage examples"
! rg -q 'img\.shields\.io/endpoint|cpp-lines\.json' "${workflow_doc}" || fail "WORKFLOW.md should not document json endpoint badge usage"
}
test_entrypoint_uses_platform_aware_multiarch_verification() {
local file
@@ -226,6 +247,7 @@ test_register_requires_python_yaml_path
test_setup_requires_upgrade_helper
test_entrypoint_uses_shared_buildx_builder_creation
test_stats_workflow_avoids_eval_find
test_stats_workflow_uses_svg_badges
test_entrypoint_uses_platform_aware_multiarch_verification
echo "template_defaults_test.sh: PASS"