buster/.github/workflows/cli-testing.yml

82 lines
2.9 KiB
YAML

name: CLI Testing
on:
pull_request:
branches:
- main
paths:
- 'cli/**' # Trigger on changes in the cli directory
- '.github/workflows/cli-testing.yml' # Also run if the workflow file itself changes
- '.github/actions/setup-test-environment/action.yml' # Rerun if common setup changes
- '.github/actions/stop-supabase/action.yml'
jobs:
test:
runs-on: blacksmith-16vcpu-ubuntu-2204 # Using a powerful runner as requested
# Service container for Redis (needed by the setup action)
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
# Node.js setup removed - not needed for cargo test
- name: Install Supabase CLI
run: npm install --global supabase@latest
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
# Consider a different cache key if CLI dependencies are separate
# with:
# key: ${{ runner.os }}-cargo-cli-${{ hashFiles('**/cli/Cargo.lock') }}
- name: Install Diesel CLI
run: cargo install diesel_cli --no-default-features --features postgres
- name: Setup Test Environment
id: setup_env # Give an ID to reference outputs
uses: ./.github/actions/setup-test-environment
- name: Run CLI Tests
working-directory: ./cli # Tests run from the cli directory
run: cargo test --workspace # Run tests for all packages in the cli workspace
env:
# Pass necessary env vars from setup action outputs
DATABASE_URL: ${{ steps.setup_env.outputs.database-url }}
REDIS_URL: redis://localhost:6379 # Connect to the Redis service container
JWT_SECRET: ${{ steps.setup_env.outputs.jwt-secret }}
SUPABASE_URL: ${{ steps.setup_env.outputs.supabase-url }}
SUPABASE_SERVICE_ROLE_KEY: ${{ steps.setup_env.outputs.supabase-service-role-key }}
RUST_LOG: debug # Or adjust as needed
# Add any other environment variables your CLI tests might require
# Sensitive values from Secrets (if needed by CLI tests)
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 }}
- name: Stop Supabase # Use the cleanup action
uses: ./.github/actions/stop-supabase
if: always() # Ensure Supabase is stopped even if tests fail