Skip to content

Commit b11b2c3

Browse files
committed
ci: add GitHub Actions workflow for lint, typecheck, and tests
Add a CI workflow that runs on pull requests and pushes to main: - lint: ESLint with max 0 warnings - typecheck: TypeScript compilation via tsc - test: Jest test suite with PostgreSQL 16 and Redis 7 service containers This ensures code quality checks run automatically on every PR, preventing regressions from being merged without validation.
1 parent dcdc2fc commit b11b2c3

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 24
22+
cache: pnpm
23+
- run: pnpm install --frozen-lockfile
24+
- run: pnpm run lint
25+
26+
typecheck:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: pnpm/action-setup@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 24
34+
cache: pnpm
35+
- run: pnpm install --frozen-lockfile
36+
- run: pnpm run build
37+
38+
test:
39+
runs-on: ubuntu-latest
40+
services:
41+
postgres:
42+
image: postgres:16
43+
env:
44+
POSTGRES_USER: postgres
45+
POSTGRES_PASSWORD: "12345"
46+
POSTGRES_DB: api_test
47+
ports:
48+
- 5432:5432
49+
options: >-
50+
--health-cmd pg_isready
51+
--health-interval 10s
52+
--health-timeout 5s
53+
--health-retries 5
54+
redis:
55+
image: redis:7
56+
ports:
57+
- 6379:6379
58+
options: >-
59+
--health-cmd "redis-cli ping"
60+
--health-interval 10s
61+
--health-timeout 5s
62+
--health-retries 5
63+
env:
64+
NODE_ENV: test
65+
TYPEORM_HOST: localhost
66+
TYPEORM_USERNAME: postgres
67+
TYPEORM_PASSWORD: "12345"
68+
TYPEORM_DATABASE: api_test
69+
REDIS_HOST: localhost
70+
REDIS_PORT: 6379
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: pnpm/action-setup@v4
74+
- uses: actions/setup-node@v4
75+
with:
76+
node-version: 24
77+
cache: pnpm
78+
- run: pnpm install --frozen-lockfile
79+
- run: pnpm run test

0 commit comments

Comments
 (0)