100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
# -----------------------------------------------------------------------------
|
|
# cameleer-website — CI (build + test + lint + Lighthouse)
|
|
#
|
|
# Runs automatically on every push and every PR against main. Does NOT deploy —
|
|
# see deploy.yml for that. This workflow exists so every commit gets the full
|
|
# quality gate before it can reach production.
|
|
#
|
|
# Runner: self-hosted arm64 Gitea runner (act_runner).
|
|
# Adjust `runs-on` labels if your runner is registered under different tags.
|
|
# Architecture note: arm64 build, amd64 deploy is fine — Astro's output is
|
|
# plain static HTML/CSS/JS with no arch-specific bits.
|
|
# -----------------------------------------------------------------------------
|
|
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
env:
|
|
PUBLIC_AUTH_SIGNIN_URL: ${{ secrets.PUBLIC_AUTH_SIGNIN_URL }}
|
|
PUBLIC_AUTH_SIGNUP_URL: ${{ secrets.PUBLIC_AUTH_SIGNUP_URL }}
|
|
PUBLIC_SALES_EMAIL: ${{ secrets.PUBLIC_SALES_EMAIL }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
# Lighthouse CI needs a Chrome/Chromium binary at runtime. Google Chrome
|
|
# has no Linux/arm64 build, so install distro Chromium and export its
|
|
# path. Handles both `chromium` (Debian) and `chromium-browser` (older
|
|
# Ubuntu) package names, and works whether sudo is present or absent
|
|
# (e.g. runner running as root).
|
|
- name: Install Chromium for Lighthouse CI
|
|
shell: bash
|
|
run: |
|
|
set -e
|
|
if command -v sudo >/dev/null 2>&1; then SUDO=sudo; else SUDO=; fi
|
|
|
|
resolve_chromium() {
|
|
command -v chromium 2>/dev/null \
|
|
|| command -v chromium-browser 2>/dev/null \
|
|
|| true
|
|
}
|
|
|
|
CHROME_BIN="$(resolve_chromium)"
|
|
if [ -z "$CHROME_BIN" ]; then
|
|
$SUDO apt-get update -qq
|
|
$SUDO apt-get install -y --no-install-recommends \
|
|
chromium chromium-driver \
|
|
|| $SUDO apt-get install -y --no-install-recommends \
|
|
chromium-browser chromium-chromedriver
|
|
CHROME_BIN="$(resolve_chromium)"
|
|
fi
|
|
|
|
if [ -z "$CHROME_BIN" ]; then
|
|
echo "Failed to install a Chromium binary — Lighthouse CI cannot run."
|
|
exit 1
|
|
fi
|
|
|
|
echo "CHROME_PATH=$CHROME_BIN" >> "$GITHUB_ENV"
|
|
"$CHROME_BIN" --version || true
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run unit tests
|
|
run: npm test
|
|
|
|
- name: Build site
|
|
run: npm run build
|
|
|
|
- name: Guard — no TBD markers may ship in built HTML
|
|
run: |
|
|
if grep -rlE '(TBD):' dist 2>/dev/null | grep -E '\.(html|svg)$'; then
|
|
echo "Built output contains unfilled <TBD:...>) markers."
|
|
echo "Fill in imprint.astro and privacy.astro operator fields before merging to main."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Validate HTML
|
|
run: npm run lint:html
|
|
|
|
- name: Check internal links
|
|
run: npm run lint:links
|
|
|
|
- name: Lighthouse CI
|
|
env:
|
|
CHROME_PATH: ${{ env.CHROME_PATH }}
|
|
run: npx lhci autorun
|