Skip to content
Closed
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
101 changes: 101 additions & 0 deletions .github/workflows/hosted-math.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Hosted mathematics

on:
pull_request:
paths:
- '.github/workflows/hosted-math.yml'
- 'verification/hosted_math/**'

permissions:
contents: read

concurrency:
group: hosted-math-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
capture:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
CAPTURE_REVISION: 'f372f0a8dd76d7ef993680d5537f9e18ee10bbef'
PROBE_PAGE: 'science/flagged-query-law.md'
steps:
- name: Check out validation code and its source history
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '22'
- name: Install pinned rendering packages
run: |
npm install --prefix "$RUNNER_TEMP/math-runtime" --no-audit --no-fund playwright@1.56.1 mathjax-full@3.2.1
node "$RUNNER_TEMP/math-runtime/node_modules/playwright/cli.js" install chromium
- name: Probe one source page at both widths
run: |
export NODE_PATH="$RUNNER_TEMP/math-runtime/node_modules"
node verification/hosted_math/probe_hosted_math.cjs \
--root "$GITHUB_WORKSPACE" --repository "$GITHUB_REPOSITORY" \
--revision "$CAPTURE_REVISION" --page "$PROBE_PAGE" \
--output "$RUNNER_TEMP/hosted-probe"
- name: Compare every hosted mathematical expression
shell: bash
run: |
export NODE_PATH="$RUNNER_TEMP/math-runtime/node_modules"
capture=(
node verification/hosted_math/capture_hosted_math.cjs
--root "$GITHUB_WORKSPACE"
--repository "$GITHUB_REPOSITORY"
--revision "$CAPTURE_REVISION"
)
if "${capture[@]}" --output "$RUNNER_TEMP/hosted-full"; then
exit 0
fi
report="$RUNNER_TEMP/hosted-full/hosted-report.json"
if test -f "$report" && grep -q 'transport_failure: Error: HTTP 50[234]' "$report"; then
mv "$RUNNER_TEMP/hosted-full" "$RUNNER_TEMP/hosted-first"
"${capture[@]}" --resume-from "$RUNNER_TEMP/hosted-first" --output "$RUNNER_TEMP/hosted-full"
else
exit 1
fi
- name: Record the source-specific report summary
if: always()
env:
CAPTURE_DIRECTORY: ${{ runner.temp }}/hosted-full
run: |
python - <<'PY'
import json
import os
from pathlib import Path

report_file = Path(os.environ["CAPTURE_DIRECTORY"]) / "hosted-report.json"
if report_file.is_file():
report = json.loads(report_file.read_text())
print(json.dumps({
"revision": report.get("revision"),
"tree": report.get("tree"),
"status": report.get("status"),
"required_pages": report.get("required_pages"),
"viewports": [
{key: row.get(key) for key in ("width", "height", "status", "structural_matches")}
for row in report.get("viewports", [])
],
"failures": report.get("failures"),
}))
PY
- name: Retain the reports and visual evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: hosted-math-${{ env.CAPTURE_REVISION }}
path: |
${{ runner.temp }}/hosted-probe
${{ runner.temp }}/hosted-full
${{ runner.temp }}/hosted-first
if-no-files-found: error
retention-days: 14
Loading
Loading