Skip to content

Commit bebfe82

Browse files
narrowizardclaude
andcommitted
ci: Add dedicated test workflow for API tests
Add test.yml workflow to run all API tests (unit, integration, e2e) on push and pull_request to main branch. - Includes PostgreSQL 17 service container - Builds dashboard and settings-form as prerequisites - Runs test:u, test:i, and test:e2e sequentially - Uploads coverage reports to Codecov 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> fix: Add --skipLibCheck to build scripts to fix TypeScript 5.7 compatibility TypeScript 5.7.3 (used in root) has stricter parsing that breaks with Mantine 7.17.8 type definitions. Adding --skipLibCheck flag to tsc commands skips node_modules type checking while still validating project source code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> ci: Remove unnecessary dashboard/settings-form build from test workflow API tests don't import or depend on dashboard or settings-form packages. Building them only adds overhead and exposes unrelated TypeScript/Mantine compatibility issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4e4d05e commit bebfe82

File tree

3 files changed

+103
-2
lines changed

3 files changed

+103
-2
lines changed

.github/workflows/test.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Tests
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.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
api-tests:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
18+
services:
19+
postgres:
20+
image: postgres:17
21+
env:
22+
POSTGRES_USER: devtable
23+
POSTGRES_PASSWORD: devtable
24+
POSTGRES_DB: devtable_test
25+
options: >-
26+
--health-cmd pg_isready
27+
--health-interval 10s
28+
--health-timeout 5s
29+
--health-retries 5
30+
ports:
31+
- 5432:5432
32+
33+
redis:
34+
image: redis:7
35+
options: >-
36+
--health-cmd "redis-cli ping"
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 5
40+
ports:
41+
- 6379:6379
42+
43+
env:
44+
DB_HOST: localhost
45+
DB_PORT: 5432
46+
DB_USERNAME: devtable
47+
DB_PASSWORD: devtable
48+
DB_DATABASE: devtable_test
49+
INTEGRATION_TEST_PG_URL: postgresql://devtable:devtable@localhost:5432/devtable_test_integration
50+
END_2_END_TEST_PG_URL: postgresql://devtable:devtable@localhost:5432/devtable_test_e2e
51+
REDIS_URL: redis://localhost:6379
52+
SECRET_KEY: test-secret-key-for-ci
53+
NODE_ENV: test
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Use Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: '20'
64+
cache: 'yarn'
65+
66+
- name: Cache Nx
67+
uses: actions/cache@v4
68+
with:
69+
path: .nx
70+
key: ${{ runner.os }}-nx-${{ hashFiles('**/yarn.lock') }}
71+
restore-keys: |
72+
${{ runner.os }}-nx-
73+
74+
- name: Install dependencies
75+
run: yarn install --frozen-lockfile
76+
77+
- name: Create test databases
78+
run: |
79+
PGPASSWORD=devtable psql -h localhost -U devtable -d devtable_test -c "CREATE DATABASE devtable_test_integration;"
80+
PGPASSWORD=devtable psql -h localhost -U devtable -d devtable_test -c "CREATE DATABASE devtable_test_e2e;"
81+
82+
- uses: nrwl/nx-set-shas@v3
83+
84+
- name: Run API unit tests
85+
working-directory: ./api
86+
run: yarn test:u
87+
88+
- name: Run API integration tests
89+
working-directory: ./api
90+
run: yarn test:i
91+
92+
- name: Run API e2e tests
93+
working-directory: ./api
94+
run: yarn test:e2e
95+
96+
- name: Upload coverage reports
97+
uses: codecov/codecov-action@v4
98+
with:
99+
files: ./api/coverage/*/lcov.info
100+
flags: api
101+
fail_ci_if_error: false

dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737
},
3838
"scripts": {
39-
"dev-build": "tsc && vite build --watch",
39+
"dev-build": "tsc --skipLibCheck && vite build --watch",
4040
"preview": "vite preview",
4141
"test": "vitest",
4242
"test:ui": "vitest --ui",

settings-form/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}
4141
},
4242
"scripts": {
43-
"dev-build": "tsc && vite build --watch",
43+
"dev-build": "tsc --skipLibCheck && vite build --watch",
4444
"preview": "vite preview"
4545
},
4646
"dependencies": {

0 commit comments

Comments
 (0)