Skip to content

Commit 7d1c4d9

Browse files
testing added
1 parent 4025802 commit 7d1c4d9

26 files changed

Lines changed: 14644 additions & 974 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
labels: bug
5+
---
6+
7+
## Describe the bug
8+
A clear and concise description of what the bug is.
9+
10+
## To Reproduce
11+
Steps to reproduce the behavior:
12+
1. Go to '...'
13+
2. Click on '...'
14+
3. See error
15+
16+
## Expected behavior
17+
A clear and concise description of what you expected to happen.
18+
19+
## Screenshots
20+
If applicable, add screenshots to help explain your problem.
21+
22+
## Environment
23+
- OS: [e.g. Windows 11]
24+
- Node version: [e.g. 20.x]
25+
- Browser (if frontend): [e.g. Chrome 127]
26+
27+
## Additional context
28+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
labels: enhancement
5+
---
6+
7+
## Is your feature request related to a problem? Please describe.
8+
A clear and concise description of what the problem is.
9+
10+
## Describe the solution you'd like
11+
A clear and concise description of what you want to happen.
12+
13+
## Describe alternatives you've considered
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
## Additional context
17+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Summary
2+
Explain the motivation and context for this change.
3+
4+
## Changes
5+
- [ ] Frontend
6+
- [ ] Backend
7+
- [ ] Python ML
8+
- [ ] Docs
9+
- [ ] CI / Infra
10+
11+
## Checklist
12+
- [ ] I opened an issue and linked it (or this is a small tweak)
13+
- [ ] I added/updated tests
14+
- [ ] `frontend`: `npm run test:run` passes
15+
- [ ] `backend`: `npm test` passes
16+
- [ ] CI passes on this PR
17+
- [ ] Docs updated (README/CONTRIBUTING as needed)
18+
19+
## Screenshots (if UI)
20+
21+
## Notes for reviewers

.github/workflows/test.yml

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
name: Test Suite
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
frontend-tests:
11+
name: Frontend Tests
12+
runs-on: ubuntu-latest
13+
14+
defaults:
15+
run:
16+
working-directory: ./frontend
17+
18+
strategy:
19+
matrix:
20+
node-version: [18.x, 20.x]
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
cache-dependency-path: frontend/package-lock.json
32+
33+
- name: Install dependencies
34+
run: npm ci
35+
36+
- name: Run type checking
37+
run: npm run typecheck
38+
39+
- name: Run tests
40+
run: npm run test:run
41+
42+
- name: Run tests with coverage
43+
run: npm run test:coverage
44+
45+
- name: Upload frontend coverage to Codecov
46+
uses: codecov/codecov-action@v4
47+
with:
48+
file: ./frontend/coverage/lcov.info
49+
flags: frontend
50+
name: frontend-coverage
51+
fail_ci_if_error: false
52+
53+
backend-tests:
54+
name: Backend Tests
55+
runs-on: ubuntu-latest
56+
57+
defaults:
58+
run:
59+
working-directory: ./backend
60+
61+
strategy:
62+
matrix:
63+
node-version: [18.x, 20.x]
64+
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Node.js ${{ matrix.node-version }}
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: ${{ matrix.node-version }}
73+
cache: 'npm'
74+
cache-dependency-path: backend/package-lock.json
75+
76+
- name: Install dependencies
77+
run: npm ci
78+
79+
- name: Run tests
80+
run: npm test
81+
82+
- name: Run tests with coverage
83+
run: npm run test:coverage
84+
85+
- name: Upload backend coverage to Codecov
86+
uses: codecov/codecov-action@v4
87+
with:
88+
file: ./backend/coverage/lcov.info
89+
flags: backend
90+
name: backend-coverage
91+
fail_ci_if_error: false
92+
93+
integration-tests:
94+
name: Integration Tests
95+
runs-on: ubuntu-latest
96+
needs: [frontend-tests, backend-tests]
97+
98+
steps:
99+
- name: Checkout code
100+
uses: actions/checkout@v4
101+
102+
- name: Setup Node.js
103+
uses: actions/setup-node@v4
104+
with:
105+
node-version: '20.x'
106+
cache: 'npm'
107+
108+
- name: Install backend dependencies
109+
working-directory: ./backend
110+
run: npm ci
111+
112+
- name: Install frontend dependencies
113+
working-directory: ./frontend
114+
run: npm ci
115+
116+
- name: Start backend server
117+
working-directory: ./backend
118+
run: |
119+
npm start &
120+
sleep 10
121+
curl -f http://localhost:8000/api/health || exit 1
122+
env:
123+
PORT: 8000
124+
125+
- name: Build frontend
126+
working-directory: ./frontend
127+
run: npm run build
128+
env:
129+
VITE_API_URL: http://localhost:8000
130+
131+
python-ml-tests:
132+
name: Python ML Pipeline Tests
133+
runs-on: ubuntu-latest
134+
135+
steps:
136+
- name: Checkout code
137+
uses: actions/checkout@v4
138+
139+
- name: Setup Python
140+
uses: actions/setup-python@v4
141+
with:
142+
python-version: '3.9'
143+
cache: 'pip'
144+
145+
- name: Install Python dependencies
146+
run: |
147+
python -m pip install --upgrade pip
148+
pip install -r requirements.txt
149+
pip install pytest pytest-cov
150+
151+
- name: Run Python tests (if they exist)
152+
run: |
153+
if [ -d "tests" ] || [ -f "test_*.py" ] || find . -name "*_test.py" | grep -q .; then
154+
python -m pytest --cov=src --cov-report=xml --cov-report=term
155+
else
156+
echo "No Python tests found, skipping..."
157+
fi
158+
159+
- name: Validate Python syntax
160+
run: |
161+
python -m py_compile main.py
162+
python -m py_compile config.py
163+
find src -name "*.py" -exec python -m py_compile {} \;
164+
165+
security-scan:
166+
name: Security Scan
167+
runs-on: ubuntu-latest
168+
169+
steps:
170+
- name: Checkout code
171+
uses: actions/checkout@v4
172+
173+
- name: Setup Node.js
174+
uses: actions/setup-node@v4
175+
with:
176+
node-version: '20.x'
177+
178+
- name: Run npm audit for frontend
179+
working-directory: ./frontend
180+
run: npm audit --audit-level=moderate
181+
continue-on-error: true
182+
183+
- name: Run npm audit for backend
184+
working-directory: ./backend
185+
run: npm audit --audit-level=moderate
186+
continue-on-error: true

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ dmypy.json
7979

8080
# IDE
8181
.vscode/
82-
.idea/
8382
*.swp
8483
*.swo
8584

@@ -91,3 +90,15 @@ Thumbs.db
9190
saved_models/
9291
data/processed/
9392
*.log
93+
94+
# Node/JS (frontend & backend)
95+
frontend/node_modules/
96+
backend/node_modules/
97+
frontend/dist/
98+
frontend/.vite/
99+
frontend/.vite-temp/
100+
**/coverage/
101+
102+
# Test environment files
103+
frontend/.env.test
104+
backend/.env.test

CODE_OF_CONDUCT.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Code of Conduct
2+
3+
This project follows the Contributor Covenant Code of Conduct.
4+
5+
## Our Pledge
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone.
8+
9+
## Our Standards
10+
Examples of behavior that contributes to a positive environment include:
11+
- Using welcoming and inclusive language
12+
- Being respectful of differing viewpoints and experiences
13+
- Gracefully accepting constructive criticism
14+
15+
Examples of unacceptable behavior include:
16+
- Trolling, insulting/derogatory comments, and personal or political attacks
17+
- Public or private harassment
18+
- Publishing others' private information without explicit permission
19+
20+
## Enforcement
21+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
22+
reported to the project maintainers at [INSERT CONTACT EMAIL].
23+
All complaints will be reviewed and investigated promptly and fairly.
24+
25+
## Attribution
26+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contributing to GoPredict
2+
3+
Thanks for your interest in contributing! This guide will help you get started.
4+
5+
## Ground Rules
6+
- **Be kind and respectful.** Follow our Code of Conduct.
7+
- **Open an issue first** for major changes to discuss the approach.
8+
- **Add tests** for any bug fix or new feature.
9+
- **Keep PRs focused** and small when possible.
10+
11+
## Project Setup
12+
13+
### Frontend
14+
```bash
15+
cd frontend
16+
npm install
17+
npm run dev
18+
npm run test:run
19+
```
20+
21+
### Backend
22+
```bash
23+
cd backend
24+
npm install
25+
npm start
26+
npm test
27+
```
28+
29+
### Python ML (optional)
30+
```bash
31+
pip install -r requirements.txt
32+
# Add tests under tests/ if contributing Python code
33+
```
34+
35+
## Branching & Commits
36+
- Create a feature branch from `main` or `develop`:
37+
- `feature/<short-description>`
38+
- `fix/<short-description>`
39+
- Use conventional-style commit messages when possible (e.g., `feat: add vitest setup`).
40+
41+
## Testing
42+
- Frontend: Vitest + React Testing Library (`frontend/src/test/*`)
43+
- Backend: Jest + Supertest (`backend/tests/*`)
44+
- Ensure `npm run test:coverage` passes in both `frontend/` and `backend/`.
45+
46+
## Linting & Formatting
47+
- Use Prettier defaults (Vite + React).
48+
- Keep code idiomatic and typed on the frontend.
49+
50+
## Pull Requests
51+
- Fill in the PR template.
52+
- Link related issues.
53+
- Describe the change, screenshots if UI.
54+
- Checklist must pass: tests, CI, and review comments.
55+
56+
## Releases
57+
- Maintainers use GitHub Releases and tags.
58+
59+
## Questions?
60+
Open a Discussion or an Issue on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Harshita Phadtare
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)