Skip to content

Commit 47b491e

Browse files
committed
Add github workflows for tests
1 parent 26183f9 commit 47b491e

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Backend Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'backend/**'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: ./backend
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
cache-dependency-path: './backend/package-lock.json'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run linting
30+
run: npm run lint
31+
32+
- name: Run tests
33+
run: npm test
34+
35+
- name: Generate test summary
36+
if: always()
37+
run: |
38+
echo "# Backend Test Results" >> $GITHUB_STEP_SUMMARY
39+
if [ ${{ job.status }} == "success" ]; then
40+
echo "✅ All tests passed successfully!" >> $GITHUB_STEP_SUMMARY
41+
else
42+
echo "❌ Some tests failed. Please check the logs for details." >> $GITHUB_STEP_SUMMARY
43+
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Frontend Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'frontend/**'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: ./frontend
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
cache-dependency-path: './frontend/package-lock.json'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run tests
30+
run: npm test
31+
32+
- name: Generate test summary
33+
if: always()
34+
run: |
35+
echo "# Frontend Test Results" >> $GITHUB_STEP_SUMMARY
36+
if [ ${{ job.status }} == "success" ]; then
37+
echo "✅ All tests passed successfully!" >> $GITHUB_STEP_SUMMARY
38+
else
39+
echo "❌ Some tests failed. Please check the logs for details." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)