Skip to content

Commit 3e5837c

Browse files
feat: ci and license
1 parent a266e5e commit 3e5837c

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: ThoughtSwap CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
lint-and-format:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.head_ref }} # Checkout the branch for PR auto-commits
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install Dependencies
25+
run: npm install
26+
27+
# Check styling (Prettier) as required by syllabus
28+
- name: Check Formatting
29+
run: npx prettier --check "**/*.{ts,tsx,js,jsx,json,md}"
30+
31+
# Attempt to auto-format on PR if check fails [cite: 150]
32+
- name: Auto-format on Pull Request
33+
if: failure() && github.event_name == 'pull_request'
34+
run: |
35+
npm run lint-staged
36+
37+
- name: Commit formatting changes
38+
if: github.event_name == 'pull_request'
39+
uses: stefanzweifel/git-auto-commit-action@v5
40+
with:
41+
commit_message: 'style: auto-format code with Prettier'
42+
43+
# Run ESLint for client code quality
44+
- name: Lint Client
45+
run: npm run lint --workspace=packages/client
46+
47+
build-and-test:
48+
runs-on: ubuntu-latest
49+
services:
50+
# Provision a database for Prisma server tests
51+
postgres:
52+
image: postgres:15
53+
env:
54+
POSTGRES_USER: user
55+
POSTGRES_PASSWORD: password
56+
POSTGRES_DB: thoughtswap
57+
ports:
58+
- 5432:5432
59+
options: >-
60+
--health-cmd pg_isready
61+
--health-interval 10s
62+
--health-timeout 5s
63+
--health-retries 5
64+
65+
steps:
66+
- name: Checkout Code
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: '20'
73+
cache: 'npm'
74+
75+
- name: Install Dependencies
76+
run: npm install
77+
78+
# Generate Prisma Client and run builds [cite: 129]
79+
- name: Server - Build
80+
env:
81+
DATABASE_URL: postgresql://user:password@localhost:5432/thoughtswap
82+
run: |
83+
cd packages/server
84+
npx prisma generate
85+
npm run build
86+
87+
- name: Client - Build
88+
run: |
89+
cd packages/client
90+
npm run build
91+
92+
# Run basic Reachability Smoke Test [cite: 145, 146]
93+
- name: Run Smoke Test
94+
run: npm run smoke-test --workspace=packages/server

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
},
2424
"keywords": [],
2525
"author": "Victor Del Carpio",
26-
"license": "ISC"
26+
"license": "GPL-3.0-or-later"
2727
}

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"keywords": [],
1414
"author": "",
15-
"license": "ISC",
15+
"license": "GPL-3.0-or-later",
1616
"devDependencies": {
1717
"@types/axios": "^0.9.36",
1818
"@types/cors": "^2.8.19",

0 commit comments

Comments
 (0)