mirror of https://github.com/buster-so/buster.git
123 lines
4.9 KiB
YAML
123 lines
4.9 KiB
YAML
name: Web App E2E Testing
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: blacksmith-16vcpu-ubuntu-2204
|
|
environment: testing
|
|
|
|
# Service containers
|
|
services:
|
|
# Redis needed by API
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
# API service built from Dockerfile
|
|
api:
|
|
image: local-api-test:latest # Use the locally built image
|
|
ports:
|
|
- 3001:3001
|
|
options: >-
|
|
--health-cmd "curl -f http://localhost:3001/health || exit 1"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
# Core Supabase/DB/Redis vars - use service names or host IP
|
|
# Runner host IP is often 172.17.0.1, Supabase runs directly on host via setup action
|
|
DATABASE_URL: postgres://postgres:postgres@172.17.0.1:54322/postgres
|
|
POOLER_URL: postgres://postgres:postgres@172.17.0.1:54322/postgres
|
|
REDIS_URL: redis://redis:6379 # Connect to redis service container
|
|
JWT_SECRET: 'super-secret-jwt-token-with-at-least-32-characters-long' # Use default local value
|
|
SUPABASE_URL: http://172.17.0.1:54321 # Default local URL on host
|
|
SUPABASE_SERVICE_ROLE_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MjM0MzA5Nn0.EGgMpd9zvvHPCOq4DJRLwzJ1iS3GV4AEyzguXGcbEIY' # Use default local value
|
|
|
|
# Non-sensitive / Default values
|
|
ENVIRONMENT: development
|
|
BUSTER_URL: http://localhost:3000 # This likely refers to the web app URL, keep as localhost
|
|
BUSTER_WH_TOKEN: buster-wh-token
|
|
LOG_LEVEL: debug
|
|
PORT: 3001 # API server port within container
|
|
RUST_LOG: debug
|
|
|
|
# Sensitive values from Secrets
|
|
OPENAI_API_KEY: ${{ secrets.GH_ACTIONS_OPENAI_API_KEY }}
|
|
RESEND_API_KEY: ${{ secrets.GH_ACTIONS_RESEND_API_KEY }}
|
|
COHERE_API_KEY: ${{ secrets.GH_ACTIONS_COHERE_API_KEY }}
|
|
LLM_API_KEY: ${{ secrets.GH_ACTIONS_LLM_API_KEY }}
|
|
LLM_BASE_URL: ${{ secrets.GH_ACTIONS_LLM_BASE_URL }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js (Blacksmith Cache)
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Mount NPM Cache (Sticky Disk)
|
|
uses: useblacksmith/stickydisk@v1
|
|
with:
|
|
key: ${{ github.repository }}-npm-cache # Unique key per repository
|
|
path: ~/.npm
|
|
|
|
- name: Mount node_modules (Sticky Disk)
|
|
uses: useblacksmith/stickydisk@v1
|
|
with:
|
|
key: ${{ github.repository }}-node-modules # Unique key per repository
|
|
path: ./web/node_modules # Mount directly into the web directory's node_modules
|
|
|
|
# --- Setup Supabase Environment ---
|
|
- name: Setup Test Environment # Runs Supabase, migrations, seeding on host
|
|
uses: ./.github/actions/setup-test-environment
|
|
|
|
# --- Build API Docker Image with Blacksmith Caching ---
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and Load API Docker Image
|
|
uses: useblacksmith/build-push-action@v1
|
|
with:
|
|
context: ./api
|
|
file: ./api/Dockerfile
|
|
push: false # Do not push, load locally for service container
|
|
load: true # Load the image into the runner's Docker daemon
|
|
tags: local-api-test:latest # Tag for the service definition
|
|
|
|
- name: Run Frontend E2E Tests
|
|
working-directory: ./web
|
|
run: |
|
|
echo "Running web E2E tests..."
|
|
# Add your actual test command here, e.g.:
|
|
npm install # Or yarn install, pnpm install
|
|
npm run build # If needed
|
|
npm run test:e2e
|
|
env:
|
|
# Point to the API service container
|
|
NEXT_PUBLIC_API_URL: http://api:3001
|
|
NEXT_PUBLIC_URL: http://localhost:3000 # Assuming default URL for the app itself
|
|
# Use Supabase details - pointing to Supabase running on the HOST (127.0.0.1)
|
|
NEXT_PUBLIC_SUPABASE_URL: http://127.0.0.1:54321 # Default local URL on host
|
|
NEXT_PUBLIC_SUPABASE_ANON_KEY: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODIzNDMwOTZ9.7UIsMFfHYKxH7bUJCRfxd6lr7CSXGF7UxtZQO10FMMo' # Use default local value
|
|
NEXT_PUBLIC_WEB_SOCKET_URL: ws://api:3001 # Point WS to API service container
|
|
|
|
# Pass any other required NEXT_PUBLIC_ variables
|
|
|
|
- name: Stop Supabase # Use the cleanup action
|
|
uses: ./.github/actions/stop-supabase
|
|
if: always() # Ensure Supabase is stopped even if tests fail
|