The recent upgrade to PostgreSQL 18 in CI (commit 27515d4) caused the
Setup Database job to fail because the runner's host pg_dump (v16) refuses
to dump a Postgres 18 server.
Replace tj-actions/pg-dump and tj-actions/pg-restore with docker run
commands using the postgres:18 image, ensuring the client version always
matches the server. This aligns with the fix already applied in the
internal cal repo.
48 lines
1.7 KiB
YAML
48 lines
1.7 KiB
YAML
name: Cache database between jobs
|
|
description: "Cache or restore if necessary"
|
|
inputs:
|
|
DATABASE_URL:
|
|
required: false
|
|
default: "postgresql://postgres:postgres@localhost:5432/calendso"
|
|
path:
|
|
required: false
|
|
default: "backups/backup.sql"
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Generate cache key
|
|
id: cache-key
|
|
uses: ./.github/actions/cache-db-key
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
- name: Cache database
|
|
id: cache-db
|
|
uses: actions/cache@v4
|
|
env:
|
|
DATABASE_URL: ${{ inputs.DATABASE_URL }}
|
|
DATABASE_DIRECT_URL: ${{ inputs.DATABASE_URL }}
|
|
E2E_TEST_CALCOM_QA_EMAIL: ${{ inputs.E2E_TEST_CALCOM_QA_EMAIL }}
|
|
E2E_TEST_CALCOM_QA_PASSWORD: ${{ inputs.E2E_TEST_CALCOM_QA_PASSWORD }}
|
|
E2E_TEST_CALCOM_QA_GCAL_CREDENTIALS: ${{ inputs.E2E_TEST_CALCOM_QA_GCAL_CREDENTIALS }}
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
key: ${{ steps.cache-key.outputs.key }}
|
|
- run: yarn db-seed
|
|
if: steps.cache-db.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
- name: Postgres Dump Backup
|
|
if: steps.cache-db.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p $(dirname "${{ inputs.path }}")
|
|
docker run --rm --network host \
|
|
-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} \
|
|
postgres:18 pg_dump "${{ inputs.DATABASE_URL }}" -O -f ${{ inputs.path }}
|
|
shell: bash
|
|
- name: Postgres Backup Restore
|
|
if: steps.cache-db.outputs.cache-hit == 'true'
|
|
run: |
|
|
docker run --rm -i --network host \
|
|
-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} \
|
|
postgres:18 psql "${{ inputs.DATABASE_URL }}" -f ${{ inputs.path }}
|
|
shell: bash
|