Skip to content

Commit e965ca2

Browse files
authored
Merge pull request #25 from mark-mdev/cap-deploy
ci(test): add PR workflow, Jest setup, and env examples
2 parents 019813e + 49a08f0 commit e965ca2

13 files changed

Lines changed: 159 additions & 155 deletions

File tree

.github/workflows/pr-tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: PR Tests
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: read
7+
8+
concurrency:
9+
group: pr-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
node-tests:
14+
name: Node.js tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: "npm"
25+
cache-dependency-path: apps/backend/package-lock.json
26+
27+
- name: Install deps
28+
run: npm ci
29+
working-directory: apps/backend
30+
31+
- name: Run tests
32+
run: npm test -- --ci
33+
working-directory: apps/backend
34+
35+
python-tests:
36+
name: Python tests (lemmas)
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Check out code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: "3.11"
46+
47+
- name: Install Python deps
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install -r apps/lemmas/requirements.txt
51+
pip install pytest
52+
python -m spacy download de_core_news_md
53+
54+
- name: Run pytest
55+
run: pytest -q apps/lemmas

apps/backend/.env.defaults

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REDIS_HOST=redis
2+
REDIS_PORT=6379
3+
DATABASE_URL=postgresql://lingput:cmpinputpswd@postgres:5432/lingput?schema=public
4+
APP_PORT=4000
5+
LEMMA_SERVICE_URL=http://lemma:8000

apps/backend/.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Application
2+
APP_PORT=4000
3+
4+
# Database
5+
DATABASE_URL=postgresql://USER:PASSWORD@postgres:5432/lingput?schema=public
6+
7+
# Redis
8+
REDIS_HOST=redis
9+
REDIS_PORT=6379
10+
11+
# External services
12+
SUPABASE_URL=https://your-project.supabase.co
13+
SUPABASE_SERVICE_API_KEY=your-service-role-key
14+
OPENAI_API_KEY=your-openai-api-key
15+
LEMMA_SERVICE_URL=http://lemma:8000
16+
17+
# Auth
18+
JWT_SECRET=change-me
19+
20+

apps/backend/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
preset: "ts-jest",
3+
setupFiles: ["<rootDir>/test-setup.ts"],
34
testMatch: ["**/*.test.ts"],
45
moduleNameMapper: {
56
"^@/(.*)$": "<rootDir>/src/$1",

apps/backend/package-lock.json

Lines changed: 27 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
"dev": "nodemon --config nodemon.json",
88
"worker": "ts-node -r tsconfig-paths/register src/worker.ts",
99
"worker:dev": "nodemon --exec ts-node -r tsconfig-paths/register src/worker.ts",
10-
"test": "jest",
11-
"seed:word-ranking": "ts-node prisma/seed-word-ranking.ts"
12-
},
13-
"prisma": {
14-
"seed": "node prisma/seed.js"
10+
"test": "jest"
1511
},
1612
"author": "",
1713
"license": "ISC",
@@ -28,6 +24,7 @@
2824
"cookie-parser": "^1.4.7",
2925
"cors": "^2.8.5",
3026
"dotenv": "^16.4.7",
27+
"dotenv-flow": "^4.1.0",
3128
"express": "^4.21.2",
3229
"express-rate-limit": "^7.5.0",
3330
"fluent-ffmpeg": "^2.1.3",

0 commit comments

Comments
 (0)