This commit is contained in:
parent
2381ca5794
commit
7285fd945a
@ -8,6 +8,23 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:17-alpine
|
||||||
|
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -22,6 +39,16 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
|
- name: Push Database - Test
|
||||||
|
run: bun run db:push
|
||||||
|
env:
|
||||||
|
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||||
|
|
||||||
|
- name: Test API
|
||||||
|
run: bun test:api
|
||||||
|
env:
|
||||||
|
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: bun run build
|
run: bun run build
|
||||||
env:
|
env:
|
||||||
|
@ -26,10 +26,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
steps:
|
steps:
|
||||||
- name: docker ps
|
|
||||||
run: docker ps
|
|
||||||
|
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -43,9 +39,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
- name: docker ps
|
|
||||||
run: docker ps
|
|
||||||
|
|
||||||
- name: Push Database - Test
|
- name: Push Database - Test
|
||||||
run: bun run db:push
|
run: bun run db:push
|
||||||
env:
|
env:
|
||||||
@ -54,4 +47,5 @@ jobs:
|
|||||||
- name: Test API
|
- name: Test API
|
||||||
run: bun test:api
|
run: bun test:api
|
||||||
env:
|
env:
|
||||||
|
NODE_ENV: test
|
||||||
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
@ -8,6 +8,13 @@ declare module 'bun' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const startup = () => {
|
export const startup = () => {
|
||||||
|
if (import.meta.env.NODE_ENV === 'test') {
|
||||||
|
if (!import.meta.env.POSTGRES_URL) {
|
||||||
|
console.error('Env Var POSTGRES_URL is missing!')
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
const keys = [
|
const keys = [
|
||||||
'POSTGRES_URL',
|
'POSTGRES_URL',
|
||||||
'CLERK_WEBHOOK_SECRET',
|
'CLERK_WEBHOOK_SECRET',
|
||||||
|
Loading…
Reference in New Issue
Block a user