ci: check other env vars on testing
Some checks failed
Test / build (push) Failing after 33s

This commit is contained in:
Lars Hampe 2024-10-01 18:35:35 +02:00
parent 2381ca5794
commit 7285fd945a
3 changed files with 35 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -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',