Add a scripture index over the confessional proofs #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |