2022-10-25 13:06:03 -07:00
|
|
|
name: Test Postgres and MySQL schemas
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
|
|
|
workflow_dispatch:
|
2023-09-05 01:58:15 -07:00
|
|
|
pull_request:
|
|
|
|
paths:
|
2023-12-20 06:14:31 -08:00
|
|
|
- packages/cli/src/databases/**
|
2022-10-25 13:06:03 -07:00
|
|
|
|
2023-11-10 06:26:42 -08:00
|
|
|
concurrency:
|
2023-12-12 01:32:13 -08:00
|
|
|
group: db-${{ github.event.pull_request.number || github.ref }}
|
2023-11-10 06:26:42 -08:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-10-25 13:06:03 -07:00
|
|
|
jobs:
|
2023-09-28 07:53:05 -07:00
|
|
|
build:
|
|
|
|
name: Install & Build
|
2022-10-25 13:06:03 -07:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-28 07:53:05 -07:00
|
|
|
steps:
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2024-02-02 00:47:58 -08:00
|
|
|
- run: corepack enable
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/setup-node@v4.0.1
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
node-version: 18.x
|
|
|
|
cache: 'pnpm'
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Build Backend
|
2023-11-17 01:07:19 -08:00
|
|
|
run: pnpm build:backend
|
2022-10-25 13:06:03 -07:00
|
|
|
|
2023-09-28 07:53:05 -07:00
|
|
|
- name: Cache build artifacts
|
2024-01-26 02:26:30 -08:00
|
|
|
uses: actions/cache/save@v4.0.0
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
path: ./packages/**/dist
|
|
|
|
key: ${{ github.sha }}:db-tests
|
2022-10-25 13:06:03 -07:00
|
|
|
|
2024-03-14 05:45:16 -07:00
|
|
|
sqlite-pooled:
|
|
|
|
name: SQLite Pooled
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
|
|
DB_TYPE: sqlite
|
|
|
|
DB_SQLITE_POOL_SIZE: 4
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4.1.1
|
|
|
|
- run: corepack enable
|
|
|
|
- uses: actions/setup-node@v4.0.1
|
|
|
|
with:
|
|
|
|
node-version: 18.x
|
|
|
|
cache: 'pnpm'
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Restore cached build artifacts
|
|
|
|
uses: actions/cache/restore@v4.0.0
|
|
|
|
with:
|
|
|
|
path: ./packages/**/dist
|
|
|
|
key: ${{ github.sha }}:db-tests
|
|
|
|
|
|
|
|
- name: Test SQLite Pooled
|
|
|
|
working-directory: packages/cli
|
|
|
|
run: pnpm jest --coverage
|
|
|
|
|
2023-09-28 07:53:05 -07:00
|
|
|
mysql:
|
|
|
|
name: MySQL
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
timeout-minutes: 20
|
2022-10-25 13:06:03 -07:00
|
|
|
env:
|
|
|
|
DB_MYSQLDB_PASSWORD: password
|
|
|
|
steps:
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2024-02-02 00:47:58 -08:00
|
|
|
- run: corepack enable
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/setup-node@v4.0.1
|
2022-10-25 13:06:03 -07:00
|
|
|
with:
|
2023-06-02 06:23:28 -07:00
|
|
|
node-version: 18.x
|
2022-11-09 08:32:05 -08:00
|
|
|
cache: 'pnpm'
|
2023-09-28 07:53:05 -07:00
|
|
|
- run: pnpm install --frozen-lockfile
|
2022-10-25 13:06:03 -07:00
|
|
|
|
2023-09-28 07:53:05 -07:00
|
|
|
- name: Restore cached build artifacts
|
2024-01-26 02:26:30 -08:00
|
|
|
uses: actions/cache/restore@v4.0.0
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
path: ./packages/**/dist
|
|
|
|
key: ${{ github.sha }}:db-tests
|
2022-10-25 13:06:03 -07:00
|
|
|
|
2023-09-28 07:53:05 -07:00
|
|
|
- name: Start MySQL
|
2024-04-18 07:35:19 -07:00
|
|
|
uses: isbang/compose-action@v2.0.0
|
2022-10-25 13:06:03 -07:00
|
|
|
with:
|
|
|
|
compose-file: ./.github/docker-compose.yml
|
2023-09-28 07:53:05 -07:00
|
|
|
services: |
|
|
|
|
mysql
|
2022-10-25 13:06:03 -07:00
|
|
|
|
|
|
|
- name: Test MySQL
|
|
|
|
working-directory: packages/cli
|
2023-12-20 06:14:31 -08:00
|
|
|
run: pnpm test:mysql
|
2023-09-28 07:53:05 -07:00
|
|
|
|
|
|
|
postgres:
|
|
|
|
name: Postgres
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
|
|
DB_POSTGRESDB_PASSWORD: password
|
|
|
|
steps:
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2024-02-02 00:47:58 -08:00
|
|
|
- run: corepack enable
|
2024-01-26 02:26:30 -08:00
|
|
|
- uses: actions/setup-node@v4.0.1
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
node-version: 18.x
|
|
|
|
cache: 'pnpm'
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Restore cached build artifacts
|
2024-01-26 02:26:30 -08:00
|
|
|
uses: actions/cache/restore@v4.0.0
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
path: ./packages/**/dist
|
|
|
|
key: ${{ github.sha }}:db-tests
|
|
|
|
|
|
|
|
- name: Start Postgres
|
2024-04-18 07:35:19 -07:00
|
|
|
uses: isbang/compose-action@v2.0.0
|
2023-09-28 07:53:05 -07:00
|
|
|
with:
|
|
|
|
compose-file: ./.github/docker-compose.yml
|
|
|
|
services: |
|
|
|
|
postgres
|
2022-10-25 13:06:03 -07:00
|
|
|
|
|
|
|
- name: Test Postgres
|
|
|
|
working-directory: packages/cli
|
2023-12-20 06:14:31 -08:00
|
|
|
run: pnpm test:postgres
|
2023-03-30 06:09:13 -07:00
|
|
|
|
2023-09-28 07:53:05 -07:00
|
|
|
notify-on-failure:
|
|
|
|
name: Notify Slack on failure
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [mysql, postgres]
|
|
|
|
steps:
|
|
|
|
- name: Notify Slack on failure
|
2022-11-17 09:52:03 -08:00
|
|
|
uses: act10ns/slack@v2.0.0
|
2023-09-26 09:00:00 -07:00
|
|
|
if: failure() && github.ref == 'refs/heads/master'
|
2022-11-17 09:52:03 -08:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
2023-11-13 04:35:21 -08:00
|
|
|
channel: '#alerts-build'
|
2022-11-17 09:52:03 -08:00
|
|
|
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
2022-12-20 05:13:24 -08:00
|
|
|
message: Postgres or MySQL tests failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|