Skip to content

Fix Google OAuth hanging issue with clean Supabase SSR implementation #25

Fix Google OAuth hanging issue with clean Supabase SSR implementation

Fix Google OAuth hanging issue with clean Supabase SSR implementation #25

name: ⚡ PR Quick Feedback
on:
pull_request:
branches: [ main, develop ]
types: [opened, synchronize, reopened]
workflow_dispatch: # Allow manual triggering for testing
inputs:
reason:
description: 'Reason for manual trigger'
required: false
default: 'Manual testing of quick feedback workflow'
# Cancel previous runs when new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
checks: write
env:
NODE_VERSION: '18'
jobs:
# Fast quality check for immediate feedback
quick-check:
name: ⚡ Quick Quality Check
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
with:
# Fetch enough history for changed files detection
fetch-depth: 0
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🔍 Lint changed files only
run: |
# Get changed files
CHANGED_FILES=$(git diff --name-only origin/main...HEAD -- '*.ts' '*.tsx' '*.js' '*.jsx' | xargs)
if [ ! -z "$CHANGED_FILES" ]; then
echo "Linting changed files: $CHANGED_FILES"
npx eslint $CHANGED_FILES
else
echo "No JS/TS files changed"
fi
- name: 🔍 Type check
run: npm run type-check
- name: 🏗️ Build check
run: npm run build
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
# Quick unit tests on critical files
unit-test-changed:
name: 🧪 Unit Tests (Changed Files)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: quick-check
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🧪 Run tests for changed files
run: |
# Get changed source files and their potential test files
CHANGED_FILES=$(git diff --name-only origin/main...HEAD -- '*.ts' '*.tsx' | grep -E '\.(ts|tsx)$' | grep -v '\.d\.ts$' || true)
if [ ! -z "$CHANGED_FILES" ]; then
echo "Source files changed: $CHANGED_FILES"
# Find related test files
TEST_PATTERN=""
for file in $CHANGED_FILES; do
# Convert source file to test file patterns
base_name=$(basename "$file" | sed 's/\.[^.]*$//')
dir_name=$(dirname "$file")
# Add various test file patterns
TEST_PATTERN="$TEST_PATTERN --testPathPattern=$base_name"
done
echo "Running tests with pattern: $TEST_PATTERN"
npm run test:unit -- $TEST_PATTERN --coverage=false --verbose || true
else
echo "No source files changed, running core tests"
npm run test:unit -- --testPathPattern="(utils|lib)" --coverage=false
fi
# Basic E2E smoke test
smoke-test:
name: 🧪 Smoke Test
runs-on: ubuntu-latest
timeout-minutes: 12
needs: quick-check
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🎭 Install Playwright browsers (Chromium only)
run: npx playwright install chromium
- name: 🏗️ Build application
run: npm run build
env:
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
- name: 🚀 Start application
run: npm start &
env:
PORT: 3000
- name: ⏳ Wait for server
run: npx wait-on http://localhost:3000 --timeout 30000
- name: 🧪 Run smoke tests
run: npx playwright test --project="Desktop Chrome" e2e/example.spec.ts || npx playwright test --project="Desktop Chrome" --grep="homepage|basic"
env:
CI: true
- name: 📊 Upload smoke test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: smoke-test-results
path: |
test-results/
playwright-report/
retention-days: 3
# PR summary with results
pr-summary:
name: 📋 PR Summary
runs-on: ubuntu-latest
if: always()
needs: [quick-check, unit-test-changed, smoke-test]
steps:
- name: 📊 Create PR status summary
uses: actions/github-script@v7
with:
script: |
const results = {
'Quick Check': '${{ needs.quick-check.result }}',
'Unit Tests': '${{ needs.unit-test-changed.result }}',
'Smoke Test': '${{ needs.smoke-test.result }}'
};
let summary = '## 🚀 PR Quick Check Results\n\n';
summary += '| Check | Status |\n';
summary += '|-------|--------|\n';
for (const [check, status] of Object.entries(results)) {
const emoji = status === 'success' ? '✅' :
status === 'failure' ? '❌' :
status === 'cancelled' ? '⏸️' : '⏳';
summary += `| ${check} | ${emoji} ${status} |\n`;
}
summary += '\n';
if (Object.values(results).includes('failure')) {
summary += '⚠️ **Some checks failed.** Please review the logs and fix any issues.\n\n';
} else if (Object.values(results).every(r => r === 'success')) {
summary += '🎉 **All quick checks passed!** Your PR is ready for full CI pipeline.\n\n';
} else {
summary += '⏳ **Some checks are still running or were skipped.**\n\n';
}
summary += '_This is a quick check for immediate feedback. Full testing will run in the main CI pipeline._';
// Only comment on actual PRs, not manual runs
if (context.issue.number) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});
console.log('✅ Posted summary to PR #' + context.issue.number);
} else {
console.log('ℹ️ Manual workflow run - skipping PR comment');
console.log('📊 Summary:\n' + summary);
}