Add testing ci pipeline (#1)
Reviewed-on: #1 Co-authored-by: Lars Hampe <hello@hashdot.co> Co-committed-by: Lars Hampe <hello@hashdot.co>
This commit is contained in:
parent
025900ccc6
commit
d2ee997ac7
11
.gitea/workflows/branches.yaml
Normal file
11
.gitea/workflows/branches.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
name: Build and Push Docker Image
|
||||
run-name: ${{ gitea.actor }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "!main"
|
||||
- "**/*"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ./.gitea/workflows/test.yaml
|
@ -6,7 +6,10 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ./.gitea/workflows/test.yaml
|
||||
build:
|
||||
needs: [tests]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
@ -1,8 +1,6 @@
|
||||
name: Test
|
||||
run-name: ${{ gitea.actor }}
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
on: [workflow_call]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -38,11 +36,12 @@ jobs:
|
||||
run: bun install
|
||||
|
||||
- name: Push Database - Test
|
||||
run: bun run db:push
|
||||
run: bun db:push:force
|
||||
env:
|
||||
POSTGRES_URL: postgres://postgres:postgres@10.0.0.145:5432/postgres
|
||||
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||
|
||||
- name: Test API
|
||||
run: bun test:api
|
||||
env:
|
||||
POSTGRES_URL: postgres://postgres:postgres@10.0.0.145:5432/postgres
|
||||
NODE_ENV: test
|
||||
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
@ -8,6 +8,13 @@ declare module 'bun' {
|
||||
}
|
||||
|
||||
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 = [
|
||||
'POSTGRES_URL',
|
||||
'CLERK_WEBHOOK_SECRET',
|
||||
|
@ -10,6 +10,7 @@
|
||||
"db:generate": "bun --filter '@boring.tools/database' db:generate",
|
||||
"db:migrate": "bun --filter '@boring.tools/database' db:migrate",
|
||||
"db:push": "bun --filter '@boring.tools/database' db:push",
|
||||
"db:push:force": "bun --filter '@boring.tools/database' db:push:force",
|
||||
"test:api": "bun --filter '@boring.tools/api' test",
|
||||
"docker:website:build": "docker build -t git.hashdot.co/boring.tools/boring.tools/website -f ci/docker/website/Dockerfile .",
|
||||
"docker:website:push": "docker push git.hashdot.co/boring.tools/boring.tools/website",
|
||||
|
11
packages/database/drizzle.ci.config.ts
Normal file
11
packages/database/drizzle.ci.config.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { defineConfig } from 'drizzle-kit'
|
||||
export default defineConfig({
|
||||
schema: './src/schema/index.ts',
|
||||
out: './src/migrations',
|
||||
dialect: 'postgresql',
|
||||
dbCredentials: {
|
||||
url: process.env.POSTGRES_URL as string,
|
||||
},
|
||||
verbose: false,
|
||||
strict: false,
|
||||
})
|
@ -4,6 +4,7 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"db:push": "drizzle-kit push",
|
||||
"db:push:force": "drizzle-kit push --config=drizzle.ci.config.ts",
|
||||
"db:studio": "drizzle-kit studio",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:migrate": "drizzle-kit migrate"
|
||||
|
Loading…
Reference in New Issue
Block a user