Skip to content

Commit

Permalink
setup action
Browse files Browse the repository at this point in the history
  • Loading branch information
owens1127 committed Oct 3, 2024
1 parent e17276a commit a33453d
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 24 deletions.
12 changes: 12 additions & 0 deletions .github/actions/bun/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Bun setup"
description: "Sets up bun and installs dependencies"

runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.27

- shell: bash
run: bun install --frozen-lockfile
7 changes: 0 additions & 7 deletions .github/actions/format/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ description: "Lint the project using Prettier"
runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.27

- shell: bash
run: bun install --frozen-lockfile

- shell: bash
run: bun format
7 changes: 0 additions & 7 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ description: "Lint the project using ESLint"
runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.27

- shell: bash
run: bun install --frozen-lockfile

- shell: bash
run: |
bun lint
Expand Down
7 changes: 0 additions & 7 deletions .github/actions/typecheck/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,5 @@ description: "Type-check the project using TSC"
runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.27

- shell: bash
run: bun install --frozen-lockfile

- shell: bash
run: bun typecheck
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Closes [story](<!--Copy Trello card link here-->)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] CI/CD changes (changing github actions or deployment scripts)
- [ ] Database migration
- [ ] Environment variable change
- [ ] New package(s)
- [ ] New dependencies
- [ ] Global style changes
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/apply-migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Apply Database Migrations

on:
push:
# branches:
# - main

jobs:
migrate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bun

- name: Apply Migrations
env:
DATABASE_PRISMA_URL: ${{ secrets.DATABASE_PRISMA_URL }}
run: bun db:migrate:prod
3 changes: 3 additions & 0 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bun
- uses: ./.github/actions/typecheck

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bun
- uses: ./.github/actions/format

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bun
- uses: ./.github/actions/lint
4 changes: 2 additions & 2 deletions apps/db/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ POSTGRES_PASSWORD="password"
POSTGRES_DATABASE="good-dog"
POSTGRES_PORT=5432

DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DATABASE}"
DATABASE_PRISMA_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DATABASE}"


# Windows Version:
Expand All @@ -15,4 +15,4 @@ DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POS
# POSTGRES_DATABASE="good-dog"
# POSTGRES_PORT=5432

# DATABASE_URL="postgresql://user:password@localhost:5432/good-dog"
# DATABASE_PRISMA_URL="postgresql://user:password@localhost:5432/good-dog"
2 changes: 2 additions & 0 deletions apps/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"studio": "prisma studio",
"generate": "prisma generate",
"migrate": "prisma migrate dev",
"migrate:reset": "prisma migrate reset",
"migrate:prod": "prisma migrate deploy",
"env": "cp .env.example .env"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion apps/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ generator client {

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
url = env("DATABASE_PRISMA_URL")
}

model User {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"db:push": "turbo run -F @good-dog/db push",
"db:generate": "turbo run -F @good-dog/db generate",
"db:migrate": "turbo run -F @good-dog/db migrate",
"db:migrate:reset": "turbo run -F @good-dog/db migrate:reset",
"db:migrate:prod": "turbo run -F @good-dog/db migrate:prod",
"db:studio": "turbo run -F @good-dog/db studio",
"__DEVELOPMENT_______": "",
"dev": "turbo run dev",
Expand Down
8 changes: 8 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
"cache": false,
"interactive": true
},
"migrate:reset": {
"cache": false,
"interactive": true
},
"migrate:prod": {
"cache": false,
"interactive": true
},
"studio": {
"cache": false,
"interactive": true
Expand Down

0 comments on commit a33453d

Please sign in to comment.