Skip to content

fix(site)+feat(tomlplusplus): 文档站点死链修复;build.mcpp 中可 import tomlplusplus #505

fix(site)+feat(tomlplusplus): 文档站点死链修复;build.mcpp 中可 import tomlplusplus

fix(site)+feat(tomlplusplus): 文档站点死链修复;build.mcpp 中可 import tomlplusplus #505

Workflow file for this run

name: site-check
# Builds the site on a pull request without publishing it. `validate.yml`
# proves the packages compile; this proves they still render — a descriptor
# that parses fine can still collide with another package's URL, and the
# plugin reads fields no compiler checks.
#
# Deliberately offline: a pull request should not spend the API rate limit,
# and the result should depend only on what is in the repository.
on:
pull_request:
paths:
- 'pkgs/**'
- '.xpkgindex.json'
- '.xpkgindex/**'
- 'docs/**'
- 'tools/site/**'
- '.github/workflows/site-check.yml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # --strict checks the replayed history against the tree
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install xpkgindex
# TEMPORARY: pinned to openxlings/xpkgindex#10 (guide link fallback +
# translated guides keep their language) for joint testing. Revert to
# the default branch once it is merged — deploy-site.yml already uses it.
run: pip install git+https://github.com/openxlings/xpkgindex.git@fix/guide-link-fallback
- name: Build the site
# --strict turns the growth reconciliation warning into an error: if
# the replayed history disagrees with the tree, the curve on the site
# would be wrong, and that is worth failing a pull request over.
run: xpkgindex generate . --output /tmp/site --offline --strict | tee /tmp/build.log
- name: No warnings
# A duplicate slug or an unparsable descriptor already fails above.
# Everything else the build is unhappy about arrives as a warning, and
# a warning nobody reads is a warning that becomes permanent.
run: |
if grep -q 'warning:' /tmp/build.log; then
echo "::error::the site build reported warnings"
grep 'warning:' /tmp/build.log
exit 1
fi
- name: The pages a reader lands on exist
run: |
set -e
for f in index.html index.json stats/index.html contributors/index.html \
about/index.html docs/quick-start/index.html \
zh/index.html zh-Hant/index.html; do
test -s "/tmp/site/$f" || { echo "::error::missing $f"; exit 1; }
done
- name: Every internal link resolves
# A guide links repository files, the templates link pages, the plugin
# links packages; a dead one fails here whichever layer produced it.
# This is what let /zh/docs/contributing/descriptor-examples.md ship as
# a 404.
run: python3 tools/site/check_links.py /tmp/site
- uses: actions/upload-artifact@v4
if: always()
with:
name: site
path: /tmp/site
retention-days: 7