Skip to content

Commit

Permalink
CI checks working
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanstitt committed Oct 3, 2024
1 parent c9f091c commit 45763cc
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 26 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,17 @@ on:
branches: [main, master]
jobs:
all:
timeout-minutes: 60
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm i
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Unit Test
run: npm run test:unit
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npm run test:e2e
- name: Run docker compose
run: docker compose up postgres mgmnt-app --wait --detach --wait-timeout 60
- name: Run Specs
run: docker compose exec mgmnt-app npm run ci
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
Expand Down
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.idea
*.log
tmp/

.next/
test-results/
*.tern-port
Expand All @@ -15,14 +14,5 @@ yarn-error.log*
.eslintcache
coverage/
playwright-report/
.open-next/
<<<<<<< ours
<<<<<<< Updated upstream
=======
.env
.parcel-cache
>>>>>>> Stashed changes
=======
.env
.parcel-cache
>>>>>>> theirs
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY package.json package-lock.json ./

RUN npm install

COPY .editorconfig next.config.mjs tsconfig.json kysely.config.ts .eslintrc.json .prettierrc.json .
COPY .gitignore .editorconfig next.config.mjs tsconfig.json kysely.config.ts .eslintrc.json .prettierrc.json .

# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
# Uncomment the following line to disable telemetry at run time
Expand Down
14 changes: 14 additions & 0 deletions bin/docker-dev-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# this file is the entrypoint for the Dockerfile.dev
# and is used for local development

set -e

npm install

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

$SCRIPT_DIR/migrate-dev-db

npm run dev
11 changes: 11 additions & 0 deletions bin/migrate-dev-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e

TYPES=src/database/types.ts

npx kysely migrate:up

npx kysely-codegen --camel-case --dialect postgres --out-file $TYPES
npx prettier --write $TYPES
npx eslint --fix $TYPES
24 changes: 22 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@ services:
- POSTGRES_USER=mgmnt
- POSTGRES_PASSWORD=mgmntpass
- POSTGRES_DB=mgmnt_dev
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U mgmnt -d mgmnt_dev']
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
mgmnt-app:
container_name: mgmnt-app
depends_on:
postgres:
condition: service_healthy
restart: true
environment:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: $NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
CLERK_SECRET_KEY: $CLERK_SECRET_KEY
E2E_CLERK_USER_USERNAME: $E2E_CLERK_USER_USERNAME
E2E_CLERK_USER_PASSWORD: $E2E_CLERK_USER_PASSWORD
DATABASE_URL: postgres://mgmnt:mgmntpass@postgres:5432/mgmnt_dev
build:
context: .
dockerfile: ./Dockerfile.dev
environment:
DATABASE_URL: postgres://mgmnt:mgmntpass@postgres:5432/mgmnt_dev
volumes:
- node_modules:/app/node_modules
- ./src:/app/src
Expand All @@ -26,6 +40,12 @@ services:
- mgmnt-app
ports:
- 3000:3000
healthcheck:
test: ['CMD-SHELL', 'curl -s http://localhost:3000/']
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
networks:
mgmnt-app:
volumes:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"build": "next build",
"start": "next start",
"deploy": "tsx bin/deploy.ts",
"ci": "run-p checks test:e2e test:unit",
"lint": "next lint && prettier --check .",
"lint:fix": "next lint --fix && prettier --write .",
"typecheck": "tsc --noEmit",
Expand Down
28 changes: 28 additions & 0 deletions src/database/migrations/1727379622502_study.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { type Kysely, sql } from 'kysely'

export async function up(db: Kysely<unknown>): Promise<void> {
// await db.schema
// .createType('study_status')
// .asEnum([''])

await db.schema
.createTable('study')
.addColumn('id', 'uuid', (col) => col.primaryKey())
.addColumn('researcher_id', 'uuid', (col) => col.notNull())
.addColumn('member_id', 'uuid', (col) => col.notNull())
.addColumn('name', 'text', (col) => col.notNull())
.addColumn('data_sources', 'text', (col) => col.notNull())
.addColumn('output_formats', 'text', (col) => col.notNull())
.addColumn('container_location', 'text', (col) => col.notNull())
.addColumn('irb_protocols', 'text')

.addColumn('approved_at', 'timestamp')
.addColumn('approved_by_member_id', 'uuid')
.addColumn('created_at', 'timestamp', (col) => col.defaultTo(sql`now()`).notNull())
.addColumn('updated_at', 'timestamp', (col) => col.defaultTo(sql`now()`).notNull())
.execute()
}

export async function down(db: Kysely<any>): Promise<void> {
await db.schema.dropTable('study').execute()
}

0 comments on commit 45763cc

Please sign in to comment.