94 lines
2.6 KiB
YAML
94 lines
2.6 KiB
YAML
name: landing-page-ci
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- .github/workflows/landing-page-ci.yml
|
|
- .github/workflows/landing-page.yml
|
|
- apps/landing-page/**
|
|
- package.json
|
|
- pnpm-lock.yaml
|
|
- pnpm-workspace.yaml
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/landing-page-ci.yml
|
|
- .github/workflows/landing-page.yml
|
|
- apps/landing-page/**
|
|
- package.json
|
|
- pnpm-lock.yaml
|
|
- pnpm-workspace.yaml
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: landing-page-ci-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate:
|
|
name: Validate landing page
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6.0.2
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v5
|
|
with:
|
|
version: 10.33.2
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Typecheck landing page
|
|
run: pnpm --filter @open-design/landing-page typecheck
|
|
|
|
- name: Build landing page
|
|
run: pnpm --filter @open-design/landing-page build
|
|
|
|
- name: Verify zero external JavaScript
|
|
run: |
|
|
node <<'NODE'
|
|
const { readFileSync } = require('node:fs');
|
|
const html = readFileSync('apps/landing-page/out/index.html', 'utf8');
|
|
const forbidden = [
|
|
/<script\b[^>]*\bsrc=/i,
|
|
/type=["']module["']/i,
|
|
/\/_astro\/[^"'<>\s]+\.js/i,
|
|
];
|
|
for (const pattern of forbidden) {
|
|
if (pattern.test(html)) {
|
|
console.error(`Unexpected client JavaScript matched ${pattern}`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
NODE
|
|
|
|
- name: Verify Cloudflare image resizing URLs
|
|
run: |
|
|
node <<'NODE'
|
|
const { readFileSync } = require('node:fs');
|
|
const html = readFileSync('apps/landing-page/out/index.html', 'utf8');
|
|
const resizedUrls = html.match(/https:\/\/static\.open-design\.ai\/cdn-cgi\/image\//g) ?? [];
|
|
if (resizedUrls.length < 16) {
|
|
console.error(`Expected at least 16 Cloudflare resized image URLs, found ${resizedUrls.length}`);
|
|
process.exit(1);
|
|
}
|
|
if (/(?:src|content)=["']\/assets\/[A-Za-z0-9_.-]+\.png/.test(html)) {
|
|
console.error('Found local /assets/*.png image reference in generated landing HTML.');
|
|
process.exit(1);
|
|
}
|
|
NODE
|