Skip to content

fix: auth flash

fix: auth flash #698

Workflow file for this run

name: Test
on:
workflow_dispatch:
inputs:
backend_tag:
description: 'Backend image tag'
push:
branches:
- main
pull_request:
branches:
- main
jobs:
frontend:
name: Frontend Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup and Build
uses: ./.github/actions/setup-and-build
with:
node-version: '22'
pnpm-version: '10'
fetch-depth: '1'
- name: Fetch backend schema
run: |
set -euo pipefail
mkdir -p ../backend/src
curl -L \
-H "Accept: application/vnd.github.object" \
-H "Authorization: Bearer ${{ secrets.BACKEND_READ_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/investlab-app/backend/contents/src/schema.yml?ref=develop \
| jq -r .content | base64 -d > ../backend/src/schema.yml
- name: Generate OpenAPI types
run: pnpm openapi-ts
- name: Check type changes
run: |
if ! git diff --exit-code src/client/; then
echo "Generated types have changed; please commit updated types."
exit 1
fi
- name: Run lint checks
run: pnpm lint
- name: Check code formatting
run: pnpm format:check
- name: Run type checks
run: pnpm tsc --noEmit
- name: Run unit tests with coverage
run: pnpm test --coverage
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: coverage-report
path: coverage/
retention-days: 30
e2e:
name: E2E Tests
timeout-minutes: 60
runs-on: ubuntu-22.04
needs: frontend
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup backend services
uses: ./.github/actions/setup-backend
with:
backend-tag: ${{ github.event.inputs.backend_tag || 'latest' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
django-secret-key: ${{ secrets.DJANGO_SECRET_KEY }}
clerk-jwt-key: ${{ secrets.CLERK_JWT_KEY }}
clerk-secret-key: ${{ secrets.CLERK_SECRET_KEY }}
clerk-issuer: ${{ secrets.CLERK_ISSUER }}
polygon-secret-key: ${{ secrets.POLYGON_SECRET_KEY }}
alpaca-public-key: ${{ secrets.ALPACA_PUBLIC_KEY }}
alpaca-secret-key: ${{ secrets.ALPACA_SECRET_KEY }}
admin-email: ${{ secrets.ADMIN_EMAIL }}
from-email: ${{ secrets.FROM_EMAIL }}
email-backend: ${{ secrets.EMAIL_BACKEND }}
email-file-path: ${{ secrets.EMAIL_FILE_PATH }}
vapid-private-key: ${{ secrets.VAPID_PRIVATE_KEY }}
vapid-public-key: ${{ secrets.VAPID_PUBLIC_KEY }}
redis-host: ${{ secrets.REDIS_HOST }}
redis-port: ${{ secrets.REDIS_PORT }}
redis-password: ${{ secrets.REDIS_PASSWORD }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-api-url: ${{ secrets.OPENAI_API_URL }}
openai-translating-model: ${{ secrets.OPENAI_TRANSLATING_MODEL }}
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}
e2e-clerk-user-id: ${{ secrets.E2E_CLERK_USER_ID }}
- name: Setup and build frontend
uses: ./.github/actions/setup-and-build
with:
node-version: '22'
pnpm-version: '10'
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers and/or OS dependencies
shell: bash
run: |
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" == "true" ]; then
echo "Browser cache hit. Ensuring OS dependencies are installed for cached browsers."
pnpm exec playwright install-deps
else
echo "Browser cache miss. Installing Playwright browsers and their OS dependencies."
pnpm exec playwright install --with-deps
fi
- name: Run Playwright end-to-end tests
run: pnpm test:e2e
env:
VITE_CLERK_PUBLISHABLE_KEY: ${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }}
VITE_BACKEND_URL: http://localhost:8000
VITE_PUBLIC_POSTHOG_KEY: ${{ secrets.VITE_PUBLIC_POSTHOG_KEY }}
VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.VITE_PUBLIC_POSTHOG_HOST }}
VITE_LANDING_IMGS_BASE_URL: ${{ secrets.VITE_LANDING_IMGS_BASE_URL }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_FRONTEND_API_URL: ${{ secrets.CLERK_FRONTEND_API_URL }}
E2E_CLERK_USER_PASSWORD: ${{ secrets.E2E_CLERK_USER_PASSWORD }}
E2E_CLERK_USER_EMAIL: ${{ secrets.E2E_CLERK_USER_EMAIL }}
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30