diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml new file mode 100644 index 0000000..587c2db --- /dev/null +++ b/.github/workflows/lhci.yml @@ -0,0 +1,39 @@ +name: UI Audit & Quality Assurance Gates + +on: + push: + branches: [ main, dev ] + pull_request: + branches: [ main, dev ] + +jobs: + lighthouse-audit: + name: Run Performance & Accessibility Gateways + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code Repository + uses: actions/checkout@v4 + + - name: Setup Node.js Runtime Environment + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Application Dependencies + run: npm ci + + # Compile production build assets + - name: Compile Production Application Build + run: npm run build + env: + NEXT_PUBLIC_DISABLE_ANALYTICS: true + + # Orchestrate background server lifecycle and run Lighthouse CI + - name: Run Lighthouse Audit Assertions Matrix + run: | + npx start-server-and-test \ + 'npm run start' \ + http://127.0.0.1:3000 \ + 'npx @lhci/cli@0.13.x autorun' \ No newline at end of file diff --git a/lighthouserc.js b/lighthouserc.js new file mode 100644 index 0000000..cea3f90 --- /dev/null +++ b/lighthouserc.js @@ -0,0 +1,21 @@ +module.exports = { + ci: { + collect: { + // Build directory location where the production app compiles + staticDistDir: './out', + numberOfRuns: 3, + }, + assert: { + // Enforce zero tolerance for regression dropping below target parameters + assertions: { + 'categories:performance': ['error', { minScore: 0.85 }], + 'categories:accessibility': ['error', { minScore: 0.95 }], + 'categories:best-practices': ['error', { minScore: 0.90 }], + 'categories:seo': ['off'], // Can be tuned to 'warn' or 'error' if needed later + }, + }, + upload: { + target: 'temporary-public-storage', // Saves HTML trace artifact summaries for review on failure + }, + }, +}; \ No newline at end of file