Skip to content

Commit 14bbddf

Browse files
Copilotmsaroufim
andcommitted
Add GitHub Actions workflow for running tests in CI
Co-authored-by: msaroufim <[email protected]>
1 parent cbeba05 commit 14bbddf

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/test.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
frontend-tests:
11+
name: Frontend Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
cache: 'npm'
22+
cache-dependency-path: frontend/package-lock.json
23+
24+
- name: Install frontend dependencies
25+
run: |
26+
cd frontend
27+
npm ci
28+
29+
- name: Run frontend tests
30+
run: |
31+
cd frontend
32+
npm run test -- --run
33+
34+
backend-tests:
35+
name: Backend Tests
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup Python
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: '3.12'
45+
cache: 'pip'
46+
47+
- name: Install dependencies
48+
run: |
49+
pip install -r requirements.txt
50+
pip install -e .
51+
52+
- name: Run backend tests
53+
env:
54+
REDIS_URL: memory://
55+
DATABASE_URL: sqlite:///tmp/test.db
56+
DISCORD_CLIENT_ID: test
57+
DISCORD_CLIENT_SECRET: test
58+
SECRET_KEY: test-secret-key
59+
DISCORD_CLUSTER_MANAGER_API_BASE_URL: http://test.example.com
60+
run: |
61+
pytest -v
62+
63+
- name: Run coverage
64+
env:
65+
REDIS_URL: memory://
66+
DATABASE_URL: sqlite:///tmp/test.db
67+
DISCORD_CLIENT_ID: test
68+
DISCORD_CLIENT_SECRET: test
69+
SECRET_KEY: test-secret-key
70+
DISCORD_CLUSTER_MANAGER_API_BASE_URL: http://test.example.com
71+
run: |
72+
coverage run -m pytest
73+
coverage report -m

0 commit comments

Comments
 (0)