Skip to content

Commit 5e85ed0

Browse files
committed
Add GitHub templates and CI/CD workflow
1 parent dbe684e commit 5e85ed0

File tree

5 files changed

+285
-0
lines changed

5 files changed

+285
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: ['bug']
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
A clear and concise description of what the bug is.
11+
12+
## Steps to Reproduce
13+
1. Go to '...'
14+
2. Click on '....'
15+
3. Scroll down to '....'
16+
4. See error
17+
18+
## Expected Behavior
19+
A clear and concise description of what you expected to happen.
20+
21+
## Actual Behavior
22+
A clear and concise description of what actually happened.
23+
24+
## Environment
25+
- OS: [e.g. Windows 11]
26+
- Node.js Version: [e.g. 20.5.0]
27+
- Browser: [e.g. Chrome 118]
28+
29+
## Screenshots
30+
If applicable, add screenshots to help explain your problem.
31+
32+
## Additional Context
33+
Add any other context about the problem here.
34+
35+
## Fix Checklist
36+
- [ ] Identify root cause
37+
- [ ] Create fix branch
38+
- [ ] Implement solution
39+
- [ ] Add regression tests
40+
- [ ] Verify fix works
41+
- [ ] Create pull request
42+
43+
---
44+
**Note:** This issue will be linked to a pull request when fix is implemented.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature for the project
4+
title: '[FEATURE] '
5+
labels: ['enhancement']
6+
assignees: ''
7+
---
8+
9+
## Feature Description
10+
A clear and concise description of what feature you want to add.
11+
12+
## Problem Statement
13+
What problem does this feature solve?
14+
15+
## Proposed Solution
16+
Describe your proposed solution in detail.
17+
18+
## Implementation Plan
19+
- [ ] Create branch from main
20+
- [ ] Implement feature
21+
- [ ] Add tests
22+
- [ ] Update documentation
23+
- [ ] Create pull request
24+
25+
## Acceptance Criteria
26+
- [ ] Feature works as expected
27+
- [ ] Tests pass
28+
- [ ] Code is documented
29+
- [ ] No breaking changes
30+
31+
## Additional Context
32+
Add any other context, screenshots, or examples about the feature request here.
33+
34+
---
35+
**Note:** This issue will be linked to a pull request when implementation begins.

.github/pull_request_template.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Pull Request
2+
3+
## Related Issue
4+
Closes #[issue_number]
5+
6+
## Description
7+
Brief description of the changes made.
8+
9+
## Type of Change
10+
- [ ] Bug fix (non-breaking change which fixes an issue)
11+
- [ ] New feature (non-breaking change which adds functionality)
12+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
13+
- [ ] Documentation update
14+
- [ ] Code refactoring
15+
- [ ] Performance improvement
16+
17+
## Changes Made
18+
- List the main changes made
19+
- Be specific about what was modified
20+
- Include any new files created
21+
22+
## Testing
23+
- [ ] All existing tests pass
24+
- [ ] New tests added for this change
25+
- [ ] Manual testing completed
26+
- [ ] No console errors or warnings
27+
28+
## Test Results
29+
```
30+
npm test
31+
# Add test results here
32+
```
33+
34+
## Screenshots (if applicable)
35+
Add screenshots to help explain your changes.
36+
37+
## Checklist
38+
- [ ] My code follows the style guidelines of this project
39+
- [ ] I have performed a self-review of my own code
40+
- [ ] I have commented my code, particularly in hard-to-understand areas
41+
- [ ] I have made corresponding changes to the documentation
42+
- [ ] My changes generate no new warnings
43+
- [ ] I have added tests that prove my fix is effective or that my feature works
44+
- [ ] New and existing unit tests pass locally with my changes
45+
46+
## Additional Notes
47+
Any additional information that reviewers should know.

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm test
32+
33+
- name: Run build
34+
run: npm run build
35+
36+
- name: Upload coverage reports
37+
uses: codecov/codecov-action@v3
38+
if: matrix.node-version == '20.x'
39+
with:
40+
file: ./coverage/lcov.info
41+
fail_ci_if_error: false
42+
43+
lint:
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Setup Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: '20.x'
54+
cache: 'npm'
55+
56+
- name: Install dependencies
57+
run: npm ci
58+
59+
- name: Check TypeScript types
60+
run: npx tsc --noEmit

CONTRIBUTING.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Contributing to TypeScript MongoDB Accounting App
2+
3+
Thank you for your interest in contributing! Please follow these guidelines to ensure a smooth development process.
4+
5+
## Development Workflow
6+
7+
### 1. Create an Issue First
8+
- **Every task must start with an Issue**
9+
- Use the appropriate Issue template (Bug Report or Feature Request)
10+
- Provide detailed description and acceptance criteria
11+
- Wait for discussion/approval before starting work
12+
13+
### 2. Create a Branch
14+
```bash
15+
# Create and checkout new branch from main
16+
git checkout main
17+
git pull origin main
18+
git checkout -b feature/issue-123-add-user-auth
19+
20+
# Branch naming convention:
21+
# feature/issue-{number}-{short-description}
22+
# bugfix/issue-{number}-{short-description}
23+
# hotfix/issue-{number}-{short-description}
24+
```
25+
26+
### 3. Development Process
27+
- Write clean, documented TypeScript code
28+
- Follow existing code style and patterns
29+
- Add tests for new functionality
30+
- Ensure all tests pass locally
31+
32+
### 4. Testing Requirements
33+
```bash
34+
# Run all tests
35+
npm test
36+
37+
# Run tests with coverage
38+
npm run test:coverage
39+
40+
# Build project
41+
npm run build
42+
```
43+
44+
### 5. Create Pull Request
45+
- **Every Issue must be linked to a Pull Request**
46+
- Use the Pull Request template
47+
- Reference the Issue number: "Closes #123"
48+
- Provide detailed description of changes
49+
- Ensure CI/CD checks pass
50+
51+
### 6. Code Review Process
52+
- Self-review your code before requesting review
53+
- Address all feedback and comments
54+
- Keep PR focused and small when possible
55+
- Update documentation if needed
56+
57+
## Code Standards
58+
59+
### TypeScript Guidelines
60+
- Use strict TypeScript settings
61+
- Define proper interfaces and types
62+
- Avoid `any` type when possible
63+
- Use meaningful variable and function names
64+
65+
### Testing Standards
66+
- Write unit tests for all new functions
67+
- Write integration tests for API endpoints
68+
- Maintain test coverage above 80%
69+
- Use Jest testing framework
70+
71+
### Commit Messages
72+
```bash
73+
# Format: type(scope): description
74+
git commit -m "feat(auth): add user login endpoint"
75+
git commit -m "fix(upload): handle large file validation"
76+
git commit -m "test(api): add integration tests"
77+
git commit -m "docs(readme): update installation guide"
78+
```
79+
80+
## Issue-to-PR Workflow Example
81+
82+
1. **Create Issue**: "#123 Add user authentication"
83+
2. **Create Branch**: `feature/issue-123-add-user-auth`
84+
3. **Develop & Test**: Write code, add tests
85+
4. **Create PR**: "Add user authentication (Closes #123)"
86+
5. **Review & Merge**: Code review, CI passes, merge to main
87+
6. **Issue Closed**: Automatically closed when PR merges
88+
89+
## Branch Protection Rules
90+
91+
- `main` branch is protected
92+
- All changes must go through Pull Requests
93+
- At least 1 approval required (even for self-review)
94+
- CI/CD checks must pass
95+
- No direct pushes to `main`
96+
97+
## Questions?
98+
99+
Feel free to open an Issue for questions about contributing!

0 commit comments

Comments
 (0)