Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 72 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,76 @@ jobs:

echo "README.md Hugo version references are consistent"

# ----------------------------------------------------------------------------
# Run the bibliography JSON-LD test suite against a test-environment Hugo
# build that mounts tests/fixtures/bibliography/ alongside the real content.
# This job must pass before changes can be merged or deployed.
#
test:
needs: [check, validate-docs]
if: always() && (github.event_name == 'push' || github.event_name == 'pull_request' || needs.check.outputs.cacheHit != 'true') && (needs.validate-docs.result == 'success' || needs.validate-docs.result == 'skipped') && (needs.check.result == 'success' || needs.check.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0

- name: Cache Zotero Bibliography
id: cache-bib
uses: actions/cache@v5
with:
path: |
static/data/bibliography.json
static/data/bibItems
content/en/history/bibliography
key: bib-${{ needs.check.outputs.zoteroVersion }}

- name: Install Bibliography
if: steps.cache-bib.outputs.cache-hit != 'true'
run: |
echo "Retrieve bibliography"
cd scripts
chmod +x ./update_bibliography.sh
chmod +x ./bibSplit.pl
./update_bibliography.sh

- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'

- name: Install Node dependencies
run: npm ci

- name: Build test site
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
TZ: America/New_York
run: hugo --environment testing --destination tests/public_test

- name: Install pytest
run: pip install pytest pyyaml pytest-cov

- name: Run content-integrity tests
run: pytest tests/test_content_integrity.py -v --cov-report=term-missing

- name: Run JSON-LD tests
run: pytest tests/test_bibliography_jsonld.py -v

# ----------------------------------------------------------------------------
# Build the website. This job is conditional, we will always run it on a
# push or if on a scheduled run the cache was determined to be out of date.
#
build:
needs: [check, validate-docs]
if: always() && (github.event_name == 'push' || github.event_name == 'pull_request' || needs.check.outputs.cacheHit != 'true') && (needs.validate-docs.result == 'success' || needs.validate-docs.result == 'skipped') && (needs.check.result == 'success' || needs.check.result == 'skipped')
needs: [check, validate-docs, test]
if: always() && (github.event_name == 'push' || github.event_name == 'pull_request' || needs.check.outputs.cacheHit != 'true') && (needs.validate-docs.result == 'success' || needs.validate-docs.result == 'skipped') && (needs.check.result == 'success' || needs.check.result == 'skipped') && (needs.test.result == 'success')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -183,6 +246,12 @@ jobs:
TZ: America/New_York
run: hugo --cleanDestinationDir -e $HUGO_ENVIRONMENT

- name: Install pytest
run: pip install pytest pytest-cov

- name: Run build-integrity tests
run: pytest tests/test_hugo_build.py -v

- name: Upload artifact
uses: actions/upload-pages-artifact@v5.0.0
with:
Expand All @@ -194,7 +263,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
needs: [build, test]

steps:
- name: Deploy to GitHub Pages
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _site
.sass-cache
.jekyll-metadata
public/
tests/public_test/
node_modules/
_gen/
.hugo_build.lock
Expand Down
3 changes: 0 additions & 3 deletions config/_default/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ ui:
# Sidebar generation is slow otherwise
sidebar_cache_limit: 100

# We have almost 200 attributes; don't truncate the sidebar to max 50 contents.
sidebar_menu_truncate: 0

# Set to true to disable breadcrumb navigation.
breadcrumb_disable: false

Expand Down
50 changes: 50 additions & 0 deletions config/testing/hugo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Hugo testing environment configuration
#
# Used exclusively when running the bibliography JSON-LD test suite:
#
# hugo --environment testing --destination tests/public_test
#
# This environment mounts the test fixtures from tests/fixtures/bibliography/
# alongside the real bibliography content, so the JSON-LD template is exercised
# against controlled data without those pages ever appearing in a production build.
#
# The module.mounts block must re-declare all standard project-level mounts
# because adding any mount replaces Hugo's defaults for the project.
# Theme (Docsy) mounts defined within that module are unaffected.

baseURL: "http://localhost/"

publishDir: tests/public_test

# Broken refs in unrelated content files must not block the test build.
refLinksErrorLevel: WARNING

# Explicit mounts (see module section below) require this to be re-stated
# so that English content URLs do not gain an /en/ prefix.
defaultContentLanguageInSubdir: false

module:
mounts:
# ── Standard project mounts (preserve defaults) ──────────────────────────
# Mount content/en/ directly as the English language content root so that
# URLs are generated without an /en/ prefix (matching production behavior).
- source: content/en
target: content
lang: en
- source: static
target: static
- source: layouts
target: layouts
- source: data
target: data
- source: assets
target: assets
- source: i18n
target: i18n
- source: archetypes
target: archetypes
# ── Test fixtures ─────────────────────────────────────────────────────────
# Mount alongside the real bibliography content for the English language.
- source: tests/fixtures/bibliography
target: content/history/bibliography
lang: en
1 change: 1 addition & 0 deletions content/en/history/bibliography/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ heading: Interlisp Bibliography
type: bibliography
cascade:
type: bibliography
toc_hide: true
weight: 5
aliases:
- /bibliography/
Expand Down
27 changes: 27 additions & 0 deletions layouts/_partials/bibliography-date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- /*
bibliography-date.html
Resolves a bibliography page's publication date.

The front-matter `date` param is a plain YYYY-MM-DD string produced by
bibSplit.pl. Hugo's built-in .Date can be a full datetime parsed from git
history; this partial prefers the explicit param when it is well-formed.

Accepts: page context (.)
Returns: dict
dateISO – YYYY-MM-DD string; "0001-01-01" when no date is known
hasDate – true when dateISO is not the zero value
dateLabel – .Params.readabledate when present, otherwise dateISO
*/ -}}
{{- $dateTime := .Date -}}
{{- with .Params.date -}}
{{- $iso := trim . " " -}}
{{- if and (ne $iso "") (findRE `^\d{4}-\d{2}-\d{2}$` $iso) -}}
{{- $dateTime = time $iso -}}
{{- end -}}
{{- end -}}
{{- $dateISO := $dateTime.Format "2006-01-02" -}}
{{- return dict
"dateISO" $dateISO
"hasDate" (ne $dateISO "0001-01-01")
"dateLabel" (or .Params.readabledate $dateISO)
-}}
Loading