mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
## Summary - **Fix CI build failure**: Auth0Client crashes during Next.js prerendering when env vars aren't set. Returns a no-op stub (`getSession → null`) when domain is missing — semantically correct for static generation - **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and react-syntax-highlighter were eagerly imported in monaco-diff-viewer but only rendered when user expands "Generated Tests". Extracted into a dynamic component - **Parallelize repo detail query**: `getRepositoryById` ran the activity count sequentially after the repo lookup. Since `repoId` is already available, all three queries now run in parallel ## Test plan - [ ] CI `build` check passes (was failing since #2598) - [ ] Trace page still renders generated tests correctly when expanded - [ ] Repository detail page loads correctly with activity status
170 lines
5 KiB
YAML
170 lines
5 KiB
YAML
name: cf-webapp Quality Gates
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "js/cf-webapp/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
pull-requests: write
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check-changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should-run: ${{ steps.filter.outputs.webapp }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: dorny/paths-filter@v4
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
webapp:
|
|
- 'js/cf-webapp/**'
|
|
|
|
skip:
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.should-run != 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "No cf-webapp changes, skipping."
|
|
|
|
benchmark:
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.should-run == 'true'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "20"
|
|
registry-url: https://npm.pkg.github.com
|
|
scope: "@codeflash-ai"
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- name: Restore WASM artifacts cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
js/cf-webapp/public/web-tree-sitter.wasm
|
|
js/cf-webapp/public/tree-sitter-python.wasm
|
|
js/cf-webapp/public/.tree-sitter-python-version
|
|
key: wasm-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}
|
|
|
|
- name: Install dependencies
|
|
working-directory: js
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build common package
|
|
working-directory: js
|
|
run: pnpm --filter @codeflash-ai/common build
|
|
|
|
- name: Generate Prisma client for cf-webapp
|
|
working-directory: js/cf-webapp
|
|
run: pnpm prisma generate
|
|
|
|
- name: Restore Next.js build cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: js/cf-webapp/.next/cache
|
|
key: nextjs-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}-${{ hashFiles('js/cf-webapp/src/**') }}
|
|
restore-keys: |
|
|
nextjs-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}-
|
|
nextjs-${{ runner.os }}-
|
|
|
|
- name: Type-check
|
|
id: typecheck
|
|
working-directory: js/cf-webapp
|
|
run: pnpm tsc --noEmit
|
|
continue-on-error: true
|
|
|
|
- name: Tests
|
|
id: tests
|
|
working-directory: js/cf-webapp
|
|
run: pnpm vitest run --reporter=verbose 2>&1 | tee test-output.txt
|
|
continue-on-error: true
|
|
|
|
- name: Build
|
|
id: build
|
|
working-directory: js/cf-webapp
|
|
run: pnpm next build 2>&1 | tee build-output.txt
|
|
continue-on-error: true
|
|
|
|
- name: Extract results
|
|
id: results
|
|
working-directory: js/cf-webapp
|
|
run: |
|
|
# Type-check status
|
|
if [ "${{ steps.typecheck.outcome }}" = "success" ]; then
|
|
echo "typecheck_status=✅ Pass" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "typecheck_status=❌ Fail" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
# Test summary
|
|
if [ "${{ steps.tests.outcome }}" = "success" ]; then
|
|
TESTS_SUMMARY=$(grep -E "Tests\s+[0-9]+" test-output.txt | tail -1 || echo "passed")
|
|
echo "tests_status=✅ ${TESTS_SUMMARY}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "tests_status=❌ Tests failed" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
# Build status
|
|
if [ "${{ steps.build.outcome }}" = "success" ]; then
|
|
echo "build_status=✅ Success" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "build_status=❌ Fail" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
# Extract route sizes from build output
|
|
ROUTES=$(sed -n '/Route.*Size.*First Load/,/^$/p' build-output.txt | head -30 || echo "No route data")
|
|
{
|
|
echo "routes<<ROUTES_EOF"
|
|
echo "$ROUTES"
|
|
echo "ROUTES_EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Post PR comment
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr comment ${{ github.event.pull_request.number }} \
|
|
--repo ${{ github.repository }} \
|
|
--body "$(cat <<'COMMENT_EOF'
|
|
## cf-webapp Quality Report
|
|
|
|
| Check | Result |
|
|
|-------|--------|
|
|
| Type-check | ${{ steps.results.outputs.typecheck_status }} |
|
|
| Tests | ${{ steps.results.outputs.tests_status }} |
|
|
| Build | ${{ steps.results.outputs.build_status }} |
|
|
|
|
<details>
|
|
<summary>Route Sizes</summary>
|
|
|
|
```
|
|
${{ steps.results.outputs.routes }}
|
|
```
|
|
</details>
|
|
COMMENT_EOF
|
|
)"
|
|
|
|
- name: Fail if any check failed
|
|
if: steps.typecheck.outcome == 'failure' || steps.tests.outcome == 'failure' || steps.build.outcome == 'failure'
|
|
run: exit 1
|