Skip to content

CI — Extended DB Matrix #207

CI — Extended DB Matrix

CI — Extended DB Matrix #207

name: CI — Extended DB Matrix
on:
workflow_dispatch:
workflow_call:
inputs:
run_e2e_postgres:
required: false
default: true
type: boolean
run_e2e_mysql:
required: false
default: true
type: boolean
run_db_contract_postgres:
required: false
default: true
type: boolean
run_db_contract_mysql:
required: false
default: true
type: boolean
schedule:
# Nightly (UTC)
- cron: "0 4 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-postgres:
if: ${{ github.event_name != 'workflow_call' || inputs.run_e2e_postgres }}
name: Core E2E (Postgres)
runs-on: ubuntu-22.04
timeout-minutes: 120
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: happier
POSTGRES_USER: happier
POSTGRES_PASSWORD: happier
ports:
- 5432/tcp
options: >-
--health-cmd="pg_isready -U happier -d happier"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@1.22.22 --activate
- name: Install system dependencies
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends tmux
tmux -V
- name: Install Sapling
run: |
bash scripts/ci/install_sapling_ubuntu22.sh
- name: Verify Sapling CLI
run: sl --version
- name: Install dependencies
env:
YARN_PRODUCTION: "false"
npm_config_production: "false"
uses: ./.github/actions/install-yarn-dependencies
with:
args: --frozen-lockfile --ignore-engines
- name: Run core e2e suite (Postgres)
env:
CI: "1"
HAPPIER_E2E_SAVE_ARTIFACTS: "0"
HAPPIER_E2E_DB_PROVIDER: postgres
DATABASE_URL: postgresql://happier:happier@127.0.0.1:${{ job.services.postgres.ports[5432] }}/happier?sslmode=disable
run: yarn test:e2e
- name: Upload e2e artifacts (on failure)
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: extended-e2e-postgres-artifacts
path: .project/logs/e2e
e2e-mysql:
if: ${{ github.event_name != 'workflow_call' || inputs.run_e2e_mysql }}
name: Core E2E (MySQL)
runs-on: ubuntu-22.04
timeout-minutes: 120
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: happier
MYSQL_DATABASE: happier
ports:
- 3306/tcp
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}"
--health-interval=10s
--health-timeout=5s
--health-retries=15
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@1.22.22 --activate
- name: Install system dependencies
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends tmux
tmux -V
- name: Install Sapling
run: |
bash scripts/ci/install_sapling_ubuntu22.sh
- name: Verify Sapling CLI
run: sl --version
- name: Install dependencies
env:
YARN_PRODUCTION: "false"
npm_config_production: "false"
uses: ./.github/actions/install-yarn-dependencies
with:
args: --frozen-lockfile --ignore-engines
- name: Run core e2e suite (MySQL)
env:
CI: "1"
HAPPIER_E2E_SAVE_ARTIFACTS: "0"
HAPPIER_E2E_DB_PROVIDER: mysql
DATABASE_URL: mysql://root:happier@127.0.0.1:${{ job.services.mysql.ports[3306] }}/happier
run: yarn test:e2e
- name: Upload e2e artifacts (on failure)
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: extended-e2e-mysql-artifacts
path: .project/logs/e2e
db-contract-postgres:
if: ${{ github.event_name != 'workflow_call' || inputs.run_db_contract_postgres }}
name: DB Contract (Postgres)
runs-on: ubuntu-latest
timeout-minutes: 120
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: happier
POSTGRES_USER: happier
POSTGRES_PASSWORD: happier
ports:
- 5432/tcp
options: >-
--health-cmd="pg_isready -U happier -d happier"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@1.22.22 --activate
- name: Install dependencies
env:
YARN_PRODUCTION: "false"
npm_config_production: "false"
uses: ./.github/actions/install-yarn-dependencies
with:
args: --frozen-lockfile --ignore-engines
- name: Migrate (Postgres)
env:
DATABASE_URL: postgresql://happier:happier@127.0.0.1:${{ job.services.postgres.ports[5432] }}/happier?sslmode=disable
run: yarn --cwd apps/server -s prisma migrate deploy
- name: Run db contract suite (Postgres)
env:
HAPPIER_DB_PROVIDER: postgres
DATABASE_URL: postgresql://happier:happier@127.0.0.1:${{ job.services.postgres.ports[5432] }}/happier?sslmode=disable
run: yarn --cwd apps/server test:db-contract
db-contract-mysql:
if: ${{ github.event_name != 'workflow_call' || inputs.run_db_contract_mysql }}
name: DB Contract (MySQL)
runs-on: ubuntu-latest
timeout-minutes: 120
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: happier
MYSQL_DATABASE: happier
ports:
- 3306/tcp
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -u root -p${MYSQL_ROOT_PASSWORD}"
--health-interval=10s
--health-timeout=5s
--health-retries=15
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@1.22.22 --activate
- name: Install dependencies
env:
YARN_PRODUCTION: "false"
npm_config_production: "false"
uses: ./.github/actions/install-yarn-dependencies
with:
args: --frozen-lockfile --ignore-engines
- name: Migrate (MySQL)
env:
DATABASE_URL: mysql://root:happier@127.0.0.1:${{ job.services.mysql.ports[3306] }}/happier
run: yarn --cwd apps/server -s migrate:mysql:deploy
- name: Run db contract suite (MySQL)
env:
HAPPIER_DB_PROVIDER: mysql
DATABASE_URL: mysql://root:happier@127.0.0.1:${{ job.services.mysql.ports[3306] }}/happier
run: yarn --cwd apps/server test:db-contract