chore: update justfile with SQLite acceptance tests and utility tasks

This commit is contained in:
2026-03-31 21:48:52 -07:00
parent 9980021037
commit e08d72bfe6
+102 -7
View File
@@ -9,8 +9,8 @@ set positional-arguments
# Project name # Project name
PROJECT := "euchre-camp" PROJECT := "euchre-camp"
# Docker registry (CasaOS local registry) # Docker registry
REGISTRY := "euchre-camp" # Update to your registry host if needed REGISTRY := "docker.notsosm.art"
IMAGE_TAG := "latest" IMAGE_TAG := "latest"
# Get git commit hash (short version) # Get git commit hash (short version)
@@ -22,6 +22,8 @@ IMAGE_TAG_COMMIT := `git rev-parse --short HEAD`
# --- Variables --- # --- Variables ---
# Database # Database
DB_CONTAINER := "euchre-camp-postgres" DB_CONTAINER := "euchre-camp-postgres"
DATABASE_PROVIDER := env_var_or_default("DATABASE_PROVIDER", "sqlite")
DATABASE_URL := env_var_or_default("DATABASE_URL", "file:./prisma/dev.db")
# --- Setup & Installation --- # --- Setup & Installation ---
@@ -54,15 +56,23 @@ format:
# --- Testing --- # --- Testing ---
# Run all tests (unit + acceptance) # Run all tests (unit + acceptance with SQLite)
test: test-unit test-acceptance test: test-unit test-acceptance-sqlite
# Run all tests with PostgreSQL (Docker)
test-pg: test-unit test-acceptance-postgres
# Run unit tests (Vitest) # Run unit tests (Vitest)
test-unit: test-unit:
npm run test:run npm run test:run
# Run acceptance tests (Playwright) # Run acceptance tests with SQLite (fast, no Docker needed)
test-acceptance: test-acceptance-sqlite:
@echo "Running acceptance tests with SQLite..."
DATABASE_PROVIDER=sqlite DATABASE_URL=file:./prisma/ci.db BETTER_AUTH_SECRET=test-secret-key npm run test:acceptance
# Run acceptance tests with PostgreSQL (Docker)
test-acceptance-postgres:
@echo "Starting Docker containers for acceptance tests..." @echo "Starting Docker containers for acceptance tests..."
docker compose up -d docker compose up -d
@echo "Waiting for services to be ready..." @echo "Waiting for services to be ready..."
@@ -80,6 +90,13 @@ migrate:
seed: seed:
npm run db:seed npm run db:seed
# Switch database provider
db-switch-sqlite:
npm run db:switch sqlite
db-switch-postgres:
npm run db:switch postgresql
# --- Docker --- # --- Docker ---
# Build the Docker image (standard build) # Build the Docker image (standard build)
@@ -143,9 +160,18 @@ docker-push: docker-build-full
# --- CI/CD Pipeline Simulation --- # --- CI/CD Pipeline Simulation ---
# Run full CI pipeline locally (lint, test, build, push) # Run full CI pipeline locally (lint, test, build, push)
ci: lint typecheck test-unit docker-build # Matches the Gitea Actions workflow
ci: lint typecheck test-unit test-acceptance-sqlite docker-build
@echo "CI Pipeline completed successfully!" @echo "CI Pipeline completed successfully!"
# PR validation (what runs on pull requests)
pr-validate: lint typecheck test-unit test-acceptance-sqlite
@echo "PR validation completed successfully!"
# Run CI with PostgreSQL (for release workflow simulation)
ci-postgres: lint typecheck test-unit test-acceptance-postgres docker-build
@echo "CI Pipeline with PostgreSQL completed successfully!"
# --- Utilities --- # --- Utilities ---
# Show help information # Show help information
@@ -158,3 +184,72 @@ clean:
rm -rf node_modules .next dist rm -rf node_modules .next dist
@echo "Cleaning Docker artifacts..." @echo "Cleaning Docker artifacts..."
docker system prune -f docker system prune -f
# Generate Prisma client
prisma-generate:
npx prisma generate
# Reset development database
db-reset-dev:
npm run db:reset-dev
# Setup development database
db-setup-dev:
npm run db:setup-dev
# Clean production database (remove test records)
db-clean-prod:
npm run db:cleanup-prod
# Check production database for test records
db-check-prod:
npm run db:check-prod
# Create admin user
admin-create:
node scripts/create-admin-via-api.js
# List all users
users-list:
node scripts/list-users.js
# Update admin password
admin-update-password:
node scripts/update-admin-password.js
# Bump version
version-bump-patch:
npm run version:patch
version-bump-minor:
npm run version:minor
version-bump-major:
npm run version:major
# Docker Compose shortcuts
docker-up:
npm run docker:up
docker-down:
npm run docker:down
docker-logs:
npm run docker:logs
# View workflow status
workflow-status:
@echo "Current workflows in .gitea/workflows/:"
ls -la .gitea/workflows/
@echo ""
@echo "PR Workflow: Runs unit + acceptance tests on pull requests"
@echo "Test Workflow: Runs unit tests on all branch pushes"
@echo "Release Workflow: Runs on main branch pushes (version bump + Docker build)"
# Check current database provider
db-status:
@echo "Database Provider: ${DATABASE_PROVIDER}"
@echo "Database URL: ${DATABASE_URL}"
@echo ""
@echo "Current schema.prisma provider:"
grep -A 2 "datasource db" prisma/schema.prisma | head -3