Skip to content

Commit cd23dca

Browse files
committed
ci: add Github Actions test pipeline
1 parent 4694c6b commit cd23dca

File tree

10 files changed

+1133
-37
lines changed

10 files changed

+1133
-37
lines changed

.env.test

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:16
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: blog_api_test
20+
ports:
21+
- 5432:5432
22+
options: >-
23+
--health-cmd="pg_isready -U postgres"
24+
--health-interval=10s
25+
--health-timeout=5s
26+
--health-retries=5
27+
28+
env:
29+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/blog_api_test
30+
NODE_ENV: test
31+
ACCESS_TOKEN_SECRET: test-access-secret
32+
REFRESH_TOKEN_SECRET: test-refresh-secret
33+
34+
steps:
35+
- name: Checkout repo
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Node
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 20
42+
43+
- name: Enable pnpm
44+
run: corepack enable
45+
46+
- name: Install dependencies
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Run DB migrations
50+
run: pnpm db:migrate
51+
52+
- name: Run tests
53+
run: pnpm test

.gitignore

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1-
node_modules
1+
# dependencies
2+
node_modules/
3+
4+
# env files
25
.env
3-
/dist
6+
.env.test
7+
.env.local
8+
9+
# build output
10+
dist/
11+
12+
# logs
13+
*.log
14+
15+
# misc
16+
.DS_Store
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE "refresh_tokens" ADD COLUMN "family_id" uuid NOT NULL;--> statement-breakpoint
2+
ALTER TABLE "refresh_tokens" ADD COLUMN "ip_address" text;--> statement-breakpoint
3+
ALTER TABLE "refresh_tokens" ADD COLUMN "user_agent" text;--> statement-breakpoint
4+
CREATE INDEX "refresh_tokens_family_idx" ON "refresh_tokens" USING btree ("family_id");

0 commit comments

Comments
 (0)