Repository navigation
The photographs and the videos, and the privacy policy that declares the player #54
Workflow file for this run
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: pr-checks | |
| on: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build the site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
| - name: Read the Hugo version | |
| run: echo "HUGO_VERSION=$(tr -d '[:space:]' < .hugo-version)" >> "$GITHUB_ENV" | |
| - name: Restore the generated images | |
| # A cold build resizes more than 400 images, about 90 seconds of CPU | |
| # for output that is the same every time. Hugo names each generated | |
| # file after a hash of the source image and the processing options, | |
| # so a cached file is used only when both match and a stale entry is | |
| # never served. The key follows the image sources; when one changes, | |
| # restore-keys brings the previous cache and only the new image is | |
| # resized. | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: resources/_gen | |
| key: hugo-gen-${{ hashFiles('themes/pybcn_theme/assets/images/**') }} | |
| restore-keys: | | |
| hugo-gen- | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 # v3.2.1 | |
| with: | |
| hugo-version: ${{ env.HUGO_VERSION }} | |
| extended: true | |
| - name: Build | |
| run: hugo --minify | |
| content: | |
| name: Check the content | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| # pillow: bin/check-content reads every person photo to warn about | |
| # one with no colour. Without it the check runs and says it skipped | |
| # that. | |
| run: pip install pyyaml pillow | |
| - name: Check front matter and cross-references | |
| run: bin/check-content | |
| - name: Check content for dangerous raw HTML | |
| run: bin/check-html-safety | |
| - name: Check the text normalizer | |
| run: python3 bin/canon.py --selftest | |
| - name: Check the archive extraction fixtures | |
| # Reads only tests/extraction/, so it needs no Meetup export. It proves | |
| # the check still rejects a run that changed an accent, which is the | |
| # one defect no normalizer can forgive. | |
| run: bin/check-extraction --selftest | |
| links: | |
| name: Check the links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Read the Hugo version | |
| run: echo "HUGO_VERSION=$(tr -d '[:space:]' < .hugo-version)" >> "$GITHUB_ENV" | |
| - name: Restore the generated images | |
| # A cold build resizes more than 400 images, about 90 seconds of CPU | |
| # for output that is the same every time. Hugo names each generated | |
| # file after a hash of the source image and the processing options, | |
| # so a cached file is used only when both match and a stale entry is | |
| # never served. The key follows the image sources; when one changes, | |
| # restore-keys brings the previous cache and only the new image is | |
| # resized. | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: resources/_gen | |
| key: hugo-gen-${{ hashFiles('themes/pybcn_theme/assets/images/**') }} | |
| restore-keys: | | |
| hugo-gen- | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 # v3.2.1 | |
| with: | |
| hugo-version: ${{ env.HUGO_VERSION }} | |
| extended: true | |
| - name: Build | |
| # A root-relative baseURL turns every internal link into "/path/", so | |
| # lychee resolves it inside this build and not on the live site. | |
| # -D builds the drafts: the canary fixture that bin/check-rendered | |
| # reads is three draft pages. The deploy workflow builds without -D, | |
| # so the fixture never reaches the live site. | |
| run: hugo --minify -D -d public --baseURL / | |
| - name: Check the built pages for dangerous markup | |
| # Reads what Hugo wrote, so a template defect is caught here even | |
| # when every content file is clean. Standard library only: the | |
| # runner's python3 is enough. | |
| run: bin/check-rendered public | |
| - name: Check links | |
| uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0 | |
| with: | |
| # --root-dir: where "/path/" links resolve. Without it lychee flags | |
| # every absolute link in a local file as an error. | |
| # --exclude-path: the frozen 2016-2019 snapshots under archives/ | |
| # keep their dead links on purpose. | |
| # --exclude: hosts that answer bots with 400, 403, or 999, and | |
| # canary.invalid, the host the canary fixture names as text. | |
| # lychee reads URLs out of text nodes too, and .invalid never | |
| # resolves. | |
| args: >- | |
| --no-progress | |
| --exclude-all-private | |
| --max-concurrency 4 | |
| --root-dir "$GITHUB_WORKSPACE/public" | |
| --exclude-path 'public/archives/' | |
| --exclude 'twitter\.com' | |
| --exclude '^https?://(www\.)?x\.com/' | |
| --exclude 'linkedin\.com' | |
| --exclude 'pybcn\.slack\.com' | |
| --exclude 'canary\.invalid' | |
| 'public/**/*.html' | |
| # External sites rate-limit. Keep the report in the job summary and | |
| # do not turn the check red. | |
| fail: false |