forked from sighingnow/jekyll-gitbook
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (81 loc) · 3.74 KB
/
Copy pathbuild.yml
File metadata and controls
96 lines (81 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build
# GitHub Pages builds and deploys this site itself; this workflow only verifies
# that it still builds and that the generated output holds together. A Liquid
# error in assets/search_plus_index.json, or markup that breaks the version
# toggle, otherwise reaches production unnoticed.
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Install PDF text tools
run: sudo apt-get update && sudo apt-get install -y poppler-utils
- name: Check authoritative text fixtures and variants
run: |
python3 script/build-westminster-fixtures.py --check
python3 script/check-variant-markup.py
# _scripture/ is generated from the proof callouts. Editing a proof without
# regenerating would leave the index quietly citing the old passage.
- name: Check the scripture index matches the proofs
run: python3 script/build-scripture-index.py --check
- name: Build
run: bundle exec jekyll build --strict_front_matter --trace
env:
JEKYLL_ENV: production
- name: Check generated output
run: |
set -euo pipefail
# The search index is generated by a dense Liquid template; a silent
# failure there produces valid HTML but a broken index.
python3 -c "
import json, sys
with open('_site/assets/search_plus_index.json') as f:
idx = json.load(f)
print(f'search index: {len(idx)} entries')
if len(idx) < 800:
sys.exit(f'search index too small ({len(idx)}); section splitting likely broke')
garbled = [k for k, v in idx.items()
if any(bad in v['body'].lower() for bad in
('unexcusable;without', 'unto to', 'hath has',
'ofour', 'ourown', 'third epistle to timothy'))]
if garbled:
sys.exit(f'search index contains crawler-text corruption: {garbled[:3]}')
missing_fields = [k for k, v in idx.items()
if not {'document', 'collection', 'proofs'} <= set(v)]
if missing_fields:
sys.exit(f'search index entries missing filter/proof fields: {missing_fields[:3]}')
"
# Every document, plus the pages that are easy to break.
for path in index.html 404.html sitemap.xml robots.txt \
search assets/search.html assets/search_plus_index.json \
pages/apostles-creed pages/nicene-creed pages/athanasian-creed \
pages/wcf pages/wsc pages/wlc \
pages/belgic pages/heidelberg pages/canons-of-dort \
pages/fg pages/bd pages/dpw \
scripture scripture/romans scripture/psalms scripture/jude; do
target="_site/$path"
[ -d "$target" ] && target="$target/index.html"
[ -s "$target" ] || { echo "missing or empty: $target"; exit 1; }
done
echo "all expected pages present"
# Internal links must stay on the canonical domain.
if grep -rn 'href="https://normanormata\.github\.io' _site/ ; then
echo "found links to the github.io mirror instead of the canonical domain"
exit 1
fi
echo "no links to the github.io mirror"
- name: Check semantics and accessible names
run: python3 script/check-generated-html.py _site
- name: Check internal links and fragments
run: python3 script/check-links.py _site