16f6099e46
* ci: skip yarn-install in setup-db when DB cache exists Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: skip entire setup-db job when DB cache exists This saves ~35-40s per workflow run by: 1. Adding DB cache lookup to prepare job (lookup-only mode) 2. Skipping the entire setup-db job when cache exists (avoids postgres container startup) 3. Keeping the yarn-install skip in setup-db.yml as a fallback Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: simplify DB cache key and skip yarn-install on cache hit - Remove commit SHA and PR number from cache key for better reuse - Cache key now only depends on prisma schema/migrations hash - Skip yarn-install in setup-db when DB cache exists (saves ~17s) - Revert changes to pr.yml required job logic Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: move DB cache lookup to prepare step and skip cache-db on hit - Move cache lookup to pr.yml prepare step for early detection - Pass db-cache-hit output to setup-db.yml as input - Skip yarn-install and cache-db action when cache exists - setup-db job still runs and reports success (no required job changes) Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: skip container initialization when DB cache exists - Rename setup-db to setup-db-seed (only runs on cache miss) - Add lightweight setup-db wrapper job that always returns success - When cache exists: setup-db-seed is skipped, setup-db returns success - When cache miss: setup-db-seed runs with postgres, setup-db checks result - This avoids postgres container startup (~17-20s) when cache exists Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: add cache-db-key action for consistent cache key generation - Create cache-db-key action to generate DB cache key in one place - Update cache-db action to use cache-db-key for consistency - Update pr.yml prepare step to use cache-db-key for lookup - This ensures the lookup key always matches the actual cache key Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: remove runner.os from cache-db-key Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: simplify setup-db by removing wrapper job - Remove setup-db wrapper job and rename setup-db-seed back to setup-db - setup-db is now skipped when cache exists (no container startup) - Update required check to allow skipped for setup-db when cache hit Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: revert to two-job pattern for setup-db - setup-db-seed: only runs on cache miss (has postgres container) - setup-db: wrapper that always runs and reports success - This ensures downstream jobs (Tests, Production builds) are not skipped - Reverts required check to simple setup-db.result != 'success' Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * ci: single setup-db job with conditional steps on cache hit - Removed two-job pattern (setup-db-seed + wrapper) - Single setup-db job calls setup-db.yml reusable workflow - Pass DB_CACHE_HIT input from prepare job's db-cache-hit output - Skip yarn-install and cache-db steps when cache hit (~17s savings) - Container still starts (will optimize in follow-up) Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
name: Setup Database
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
DB_CACHE_HIT:
|
|
required: false
|
|
type: string
|
|
default: "false"
|
|
description: "Whether the DB cache was hit (skip yarn-install and cache-db if true)"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CALENDSO_ENCRYPTION_KEY: ${{ secrets.CI_CALENDSO_ENCRYPTION_KEY }}
|
|
DATABASE_URL: ${{ secrets.CI_DATABASE_URL }}
|
|
DATABASE_DIRECT_URL: ${{ secrets.CI_DATABASE_URL }}
|
|
E2E_TEST_CALCOM_QA_EMAIL: ${{ secrets.E2E_TEST_CALCOM_QA_EMAIL }}
|
|
E2E_TEST_CALCOM_QA_PASSWORD: ${{ secrets.E2E_TEST_CALCOM_QA_PASSWORD }}
|
|
E2E_TEST_CALCOM_QA_GCAL_CREDENTIALS: ${{ secrets.E2E_TEST_CALCOM_QA_GCAL_CREDENTIALS }}
|
|
GOOGLE_API_CREDENTIALS: ${{ secrets.CI_GOOGLE_API_CREDENTIALS }}
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
|
|
jobs:
|
|
setup-db:
|
|
name: Setup Database
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
timeout-minutes: 15
|
|
services:
|
|
postgres:
|
|
image: postgres:13
|
|
credentials:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: calendso
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/dangerous-git-checkout
|
|
- uses: ./.github/actions/yarn-install
|
|
if: inputs.DB_CACHE_HIT != 'true'
|
|
- uses: ./.github/actions/cache-db
|
|
if: inputs.DB_CACHE_HIT != 'true'
|