Website rebrand part 2 #42
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: Code Quality & SEO Audit | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| # Cache dependencies for faster builds | |
| - uses: actions/cache@v4 | |
| id: bun-cache | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('website/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - uses: actions/cache@v4 | |
| id: node-modules-cache | |
| with: | |
| path: website/node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('website/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-modules- | |
| - name: Install Dependencies & Run Code Quality | |
| working-directory: website | |
| run: | | |
| bun install --frozen-lockfile | |
| bun run format:check | |
| seo-audit: | |
| name: SEO Audit | |
| runs-on: ubuntu-latest | |
| # Only run if code-quality job succeeds | |
| needs: code-quality | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| # Cache dependencies for faster builds | |
| - uses: actions/cache@v4 | |
| id: bun-cache | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('website/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - uses: actions/cache@v4 | |
| id: node-modules-cache | |
| with: | |
| path: website/node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('website/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-modules- | |
| # Install Chromium for Puppeteer (required by Unlighthouse) | |
| # This action sets CHROMIUM_PATH environment variable automatically | |
| - name: Setup Chromium | |
| uses: browser-actions/setup-chromium@v1 | |
| with: | |
| chromium-version: latest | |
| # 1. Build and Start Server | |
| # NOTE: Astro outputs to 'dist' directory by default | |
| # Set SITE_BASE_URL to localhost for CI so all links point to localhost instead of production | |
| - name: Install Dependencies & Build | |
| working-directory: website | |
| env: | |
| SITE_BASE_URL: "http://localhost:3000" | |
| run: | | |
| bun install --frozen-lockfile | |
| bun run build | |
| # 2. Start Static Server (Astro outputs to 'dist' directory) | |
| - name: Start Static Server | |
| working-directory: website | |
| run: | | |
| npx --yes serve@latest dist -p 3000 & | |
| npx wait-on http://localhost:3000 --timeout 60000 || (echo "Server failed to start" && exit 1) | |
| # 3. FAIL FAST: Broken Link Checker | |
| # Only check links on localhost:3000, skip external links (e.g., https://www.quantus.com) | |
| - name: Check for Broken Links | |
| run: | | |
| npx --yes linkinator http://localhost:3000 --recurse --skip "^(?!http://localhost:3000)" | |
| # 4. DEEP AUDIT: Unlighthouse | |
| # Scans all pages for both desktop and mobile devices | |
| # Fails if SEO score is below 100 (configured in unlighthouse.config.ts) | |
| # The '--build-static' flag generates the HTML report files. | |
| # PUPPETEER_SKIP_CHROMIUM_DOWNLOAD tells Puppeteer to use the system Chromium from setup-chromium | |
| # CHROMIUM_PATH is automatically set by the setup-chromium action | |
| - name: Run Unlighthouse Mobile Audit | |
| working-directory: website | |
| env: | |
| PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" | |
| PUPPETEER_EXECUTABLE_PATH: ${{ env.CHROMIUM_PATH }} | |
| run: | | |
| npx unlighthouse-ci --build-static --mobile --output-path ./.unlighthouse/mobile | |
| - name: Run Unlighthouse Desktop Audit | |
| working-directory: website | |
| env: | |
| PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" | |
| PUPPETEER_EXECUTABLE_PATH: ${{ env.CHROMIUM_PATH }} | |
| run: | | |
| npx unlighthouse-ci --build-static --desktop --output-path ./.unlighthouse/desktop | |
| # 5. UPLOAD ARTIFACT | |
| # This takes the generated report and saves it as a zip file. | |
| # Note: Unlighthouse runs in website/ directory, so output is at website/.unlighthouse | |
| # Includes both mobile and desktop reports | |
| - name: Create SEO Report Zip | |
| if: always() | |
| run: | | |
| cd website | |
| zip -r seo-report.zip .unlighthouse/ || echo "Failed to create zip, but continuing..." | |
| ls -lh seo-report.zip || echo "Zip file not created" | |
| echo "Report includes:" | |
| ls -la .unlighthouse/ 2>/dev/null || echo "No .unlighthouse directory" | |
| - name: Upload SEO Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() # Upload even if previous step failed | |
| with: | |
| name: seo-report | |
| path: website/seo-report.zip | |
| if-no-files-found: warn # Warn instead of error if no files found | |
| retention-days: 7 # Auto-delete after 7 days to save space |