Skip to content

feat(magento): say when a run is waiting for a worker (#818) #977

feat(magento): say when a run is waiting for a worker (#818)

feat(magento): say when a run is waiting for a worker (#818) #977

Workflow file for this run

name: Documentation site (OVH)
on:
push:
branches: [main, master]
paths:
- 'hugo-docs/**'
- 'documentation/user/**'
- '.github/workflows/docs-ovh.yml'
pull_request:
paths:
- 'hugo-docs/**'
- 'documentation/user/**'
- '.github/workflows/docs-ovh.yml'
workflow_dispatch:
# One deployment at a time: SFTP has no atomic swap, two concurrent syncs would
# interleave files.
concurrency:
group: docs-ovh
cancel-in-progress: false
permissions:
contents: read
env:
# Shared hosting quota: 100 MB. The job fails beyond it, rather than uploading
# half a site and leaving a broken one online.
SITE_QUOTA_KB: 100000
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.159.2'
extended: true
# The theme ships mermaid, katex and asciinema — 4.4 MB copied into the
# output even when unused. We strip them, but only for as long as no page
# calls them: this guard fails the day that stops being true.
- name: Guard — no page uses the pruned libraries
run: |
# Both mounted trees (the guide and the blog), both shortcode delimiters, and the
# fenced ```mermaid block hugo-book renders with the same library (#369, D-20).
if grep -rlE '\{\{[<%] *(mermaid|katex|math|asciinema)|^```mermaid' documentation/user documentation/blog --include='*.md'; then
echo "::error::A page uses a shortcode whose library is pruned at deploy time."
echo "Remove the shortcode, or remove the pruning in the \"Prune\" step."
exit 1
fi
- name: Guard — the import would refuse to overwrite a hand-written fix
# WA005: three fixes written into layouts/index.html and lost, without a sound.
# The guard lives in import-design.py; this step only checks the guard itself,
# since the import is never played in CI — there is no canvas here.
run: python3 hugo-docs/import-design.py --self-test
- name: Guard — the page served is the one from the canvas
# WA005 point 2, writable since the canvas landed in the repository: replay the import
# and fail on the slightest difference. A fix written into layouts/ and not into the
# canvas goes red here, with its diff — before the regeneration, not after.
run: |
cd hugo-docs
cp layouts/index.html /tmp/committed-en.html
cp layouts/index.fr.html /tmp/committed-fr.html
python3 import-design.py variant-b-narrative.dc.html layouts/index.html --force
python3 import-design.py variant-b-narrative-fr.dc.html layouts/index.fr.html --force
diff -u /tmp/committed-en.html layouts/index.html
diff -u /tmp/committed-fr.html layouts/index.fr.html
- name: Build
working-directory: hugo-docs
env:
HUGO_ENVIRONMENT: production
run: hugo --minify --gc
- name: Prune unused theme libraries
working-directory: hugo-docs/public
run: |
rm -rf mermaid.min.js katex asciinema
echo "After pruning:" && du -sh .
- name: Guard — the site fits within the quota
working-directory: hugo-docs/public
run: |
SIZE_KB=$(du -sk . | cut -f1)
echo "Site: ${SIZE_KB} Ko (quota ${SITE_QUOTA_KB} Ko)"
if [ "$SIZE_KB" -gt "$SITE_QUOTA_KB" ]; then
echo "::error::The site is over the hosting quota (${SIZE_KB} KB > ${SITE_QUOTA_KB} KB)."
exit 1
fi
- name: Upload build
uses: actions/upload-artifact@v7
with:
name: docs-site
path: hugo-docs/public
retention-days: 7
deploy:
runs-on: ubuntu-latest
needs: build
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'))
environment:
name: durable.rocks
url: https://durable.rocks/
steps:
- name: Download build
uses: actions/download-artifact@v8
with:
name: docs-site
path: site
- name: Deploy over SFTP
env:
SFTP_HOST: ${{ secrets.OVH_FTP_SERVER }}
SFTP_USER: ${{ secrets.OVH_FTP_USERNAME }}
SSHPASS: ${{ secrets.OVH_FTP_PASSWORD }}
# Web root of the OVH shared hosting.
SERVER_DIR: ${{ vars.OVH_FTP_ROOT || './www/' }}
KNOWN_HOSTS: ${{ secrets.OVH_SSH_KNOWN_HOSTS }}
run: |
sudo apt-get update -qq && sudo apt-get install -y -qq lftp sshpass
mkdir -p ~/.ssh && chmod 700 ~/.ssh
# No keyscan fallback: sshpass would hand the password to whichever host answered.
if [ -z "$KNOWN_HOSTS" ]; then
echo "::error::OVH_SSH_KNOWN_HOSTS is not set on the durable.rocks environment — refusing to send the password to an unverified host."
exit 1
fi
printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts
echo "Cible : $SFTP_USER@$SFTP_HOST:$SERVER_DIR"
# lftp delegates SFTP to ssh, which does not accept a password on stdin: sshpass
# supplies it from $SSHPASS. The password passed to -u is ignored.
lftp -u "$SFTP_USER",ignored "sftp://$SFTP_HOST" -e "
set sftp:connect-program 'sshpass -e ssh -a -x -o StrictHostKeyChecking=yes';
mirror --reverse --delete --verbose ./site/ '$SERVER_DIR';
bye"