database expansion prior to creating on server - also error cleanup, some logging - DONE now for testing hehehe
Some checks are pending
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Has started running

This commit is contained in:
2025-11-20 20:31:40 -08:00
parent 43b44902ca
commit f6094df456
25 changed files with 4586 additions and 1456 deletions

View File

@@ -1,5 +1,7 @@
# FILE: .gitea/workflows/deploy.yml
#
# deploy to production which is an ubuntu co-lo server with nginx + postgres
#
# note to AI - the order in this file matters - also, minor changes to this file can have big impacts and is easy to break
name: Deploy to Web Server flyer-crawler.projectium.com
@@ -16,12 +18,6 @@ jobs:
# These must be configured as secrets in your Gitea repository settings.
env:
# Public keys needed for the React build process.
VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }}
VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }}
# Supabase token for non-interactive CLI authentication.
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
# The project ID for linking the Supabase CLI.
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
steps:
- name: Checkout Code
@@ -63,8 +59,32 @@ jobs:
- name: Lint TypeScript Code
run: npm run lint # Run the linter to check for code quality issues.
- name: Setup Test Database
run: |
echo "--- Creating test database and user ---"
# Execute the setup script as the 'postgres' superuser.
# This creates the 'flyer-crawler-test' database and 'test_runner' role.
sudo -u postgres psql -f sql/test_setup.sql
- name: Run Unit Tests
run: npm test # Run the test suite to ensure code correctness.
# We override the production DB variables for this step only.
# The 'global-setup.ts' will use these to connect to the test database,
# create the schema, and seed data before tests run.
env:
DB_HOST: localhost
DB_PORT: 5432
DB_USER: test_runner
DB_PASSWORD: a_secure_test_password
DB_DATABASE: flyer-crawler-test
run: npm test # Run the test suite against the temporary test database.
# also Run the test suite to ensure code correctness.
- name: Teardown Test Database
# This step runs regardless of whether the tests passed or failed.
if: always()
run: |
echo "--- Dropping test database and user ---"
sudo -u postgres psql -f sql/test_teardown.sql
- name: Archive Code Coverage Report
# This action saves the generated HTML coverage report as a downloadable artifact.
@@ -73,21 +93,6 @@ jobs:
name: code-coverage-report
path: coverage/
# --- Backend Deployment ---
- name: Deploy Supabase Edge Functions
# Pass the access token as an environment variable directly to this step
# This ensures the Supabase CLI can authenticate.
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
run: |
echo "Deploying Edge Functions to Supabase project: ${{ env.SUPABASE_PROJECT_ID }}"
# The SUPABASE_ACCESS_TOKEN env var handles login automatically.
# The --project-ref flag links the CLI to your project.
npm exec -- supabase functions deploy system-check --project-ref ${{ env.SUPABASE_PROJECT_ID }}
npm exec -- supabase functions deploy delete-user --project-ref ${{ env.SUPABASE_PROJECT_ID }}
npm exec -- supabase functions deploy seed-database --project-ref ${{ env.SUPABASE_PROJECT_ID }}
npm exec -- supabase functions deploy process-flyer --project-ref ${{ env.SUPABASE_PROJECT_ID }}
# --- Frontend Deployment ---
- name: Build React Application
# We set the environment variable directly in the command line for this step.