Add testing ci pipeline #1
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
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
tests:
|
||||||
|
uses: ./.gitea/workflows/test.yaml
|
||||||
build:
|
build:
|
||||||
|
needs: [tests]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
@ -1,8 +1,6 @@
|
|||||||
name: Test
|
name: Test
|
||||||
run-name: ${{ gitea.actor }}
|
run-name: ${{ gitea.actor }}
|
||||||
on:
|
on: [workflow_call]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -38,11 +36,12 @@ jobs:
|
|||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
- name: Push Database - Test
|
- name: Push Database - Test
|
||||||
run: bun run db:push
|
run: bun db:push:force
|
||||||
env:
|
env:
|
||||||
POSTGRES_URL: postgres://postgres:postgres@10.0.0.145:5432/postgres
|
POSTGRES_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||||
|
|
||||||
- name: Test API
|
- name: Test API
|
||||||
run: bun test:api
|
run: bun test:api
|
||||||
env:
|
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 = () => {
|
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',
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"db:generate": "bun --filter '@boring.tools/database' db:generate",
|
"db:generate": "bun --filter '@boring.tools/database' db:generate",
|
||||||
"db:migrate": "bun --filter '@boring.tools/database' db:migrate",
|
"db:migrate": "bun --filter '@boring.tools/database' db:migrate",
|
||||||
"db:push": "bun --filter '@boring.tools/database' db:push",
|
"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",
|
"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: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",
|
"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",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"db:push": "drizzle-kit push",
|
"db:push": "drizzle-kit push",
|
||||||
|
"db:push:force": "drizzle-kit push --config=drizzle.ci.config.ts",
|
||||||
"db:studio": "drizzle-kit studio",
|
"db:studio": "drizzle-kit studio",
|
||||||
"db:generate": "drizzle-kit generate",
|
"db:generate": "drizzle-kit generate",
|
||||||
"db:migrate": "drizzle-kit migrate"
|
"db:migrate": "drizzle-kit migrate"
|
||||||
|
Loading…
Reference in New Issue
Block a user