Skip to content

Commit b569d50

Browse files
authored
Merge pull request #1 from lemonade-sdk/fix/dev-environment-and-infrastructure
fix: resolve dev environment module resolution and add infrastructure
2 parents 9e73a9f + 3bbb00c commit b569d50

File tree

91 files changed

+21226
-5827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+21226
-5827
lines changed

.eslintrc.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"env": {
33
"browser": true,
44
"es2021": true,
5-
"node": true
5+
"node": true,
6+
"jest": true
67
},
78
"extends": [
89
"eslint:recommended",
@@ -24,12 +25,23 @@
2425
],
2526
"rules": {
2627
"react/react-in-jsx-scope": "off",
28+
"@typescript-eslint/no-unused-vars": ["warn", {
29+
"argsIgnorePattern": "^_",
30+
"varsIgnorePattern": "^_"
31+
}],
2732
"@typescript-eslint/no-explicit-any": "warn",
28-
"@typescript-eslint/no-unused-vars": "warn"
33+
"no-console": ["warn", { "allow": ["warn", "error"] }]
2934
},
3035
"settings": {
3136
"react": {
3237
"version": "detect"
3338
}
34-
}
39+
},
40+
"ignorePatterns": [
41+
"dist",
42+
"build",
43+
"node_modules",
44+
"*.config.js",
45+
"jest.setup.js"
46+
]
3547
}

.github/CI_CD_DOCUMENTATION.md

Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
# CI/CD Documentation
2+
3+
## Overview
4+
5+
This project uses a comprehensive GitHub Actions-based CI/CD pipeline to ensure code quality, security, and automated deployment across multiple platforms.
6+
7+
## Status Badges
8+
9+
Add these badges to your README.md:
10+
11+
```markdown
12+
[![Main CI](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/main-ci.yml/badge.svg)](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/main-ci.yml)
13+
[![Python CI](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/python-ci.yml/badge.svg)](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/python-ci.yml)
14+
[![Node.js CI](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/nodejs-ci.yml)
15+
[![CodeQL](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/codeql-security.yml/badge.svg)](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/codeql-security.yml)
16+
[![Documentation](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/docs-deploy.yml/badge.svg)](https://github.com/YOUR-USERNAME/ai-interviewer/actions/workflows/docs-deploy.yml)
17+
```
18+
19+
**Replace `YOUR-USERNAME` with your actual GitHub username or organization name.**
20+
21+
## Workflows
22+
23+
### 1. Main CI (`main-ci.yml`)
24+
25+
**Trigger:** Push to `main`/`develop`, Pull Requests
26+
**Purpose:** Orchestrates all CI checks
27+
28+
**Features:**
29+
- Smart path filtering (only runs affected workflows)
30+
- Coordinates Python and Node.js CI
31+
- Verifies all checks pass before allowing merge
32+
33+
**Matrix Strategy:**
34+
- Detects file changes
35+
- Runs only relevant workflows
36+
37+
### 2. Python CI (`python-ci.yml`)
38+
39+
**Trigger:** Changes to `lemonade_api/**`, `pyproject.toml`
40+
**Purpose:** Ensures Python code quality
41+
42+
**Jobs:**
43+
- **Lint & Type Check**
44+
- Black formatter validation
45+
- Ruff linting
46+
- MyPy type checking
47+
- Runs on Python 3.9, 3.10, 3.11, 3.12
48+
49+
- **Test**
50+
- pytest with coverage reporting
51+
- Coverage upload to Codecov
52+
- Multi-version testing
53+
54+
- **Package Check**
55+
- Validates package can be built
56+
- Checks package metadata with twine
57+
58+
**Dependencies Cached:** pip packages
59+
60+
### 3. Node.js CI (`nodejs-ci.yml`)
61+
62+
**Trigger:** Changes to `src/**`, `package.json`, TypeScript configs
63+
**Purpose:** Ensures TypeScript/React code quality
64+
65+
**Jobs:**
66+
- **Lint & Type Check**
67+
- ESLint validation
68+
- TypeScript compilation check
69+
70+
- **Test**
71+
- Jest test execution
72+
- Cross-platform testing (Ubuntu, Windows, macOS)
73+
- Multi-version Node.js (18, 20)
74+
- Coverage reporting
75+
76+
- **Build**
77+
- Vite build verification
78+
- Artifact upload for inspection
79+
80+
**Dependencies Cached:** npm packages
81+
82+
### 4. CodeQL Security (`codeql-security.yml`)
83+
84+
**Trigger:**
85+
- Push to `main`/`develop`
86+
- Pull Requests
87+
- Weekly schedule (Monday midnight UTC)
88+
- Manual dispatch
89+
90+
**Purpose:** Automated security vulnerability scanning
91+
92+
**Languages Analyzed:**
93+
- JavaScript/TypeScript
94+
- Python
95+
96+
**Features:**
97+
- Security and quality queries
98+
- Automated vulnerability detection
99+
- Integration with GitHub Security tab
100+
101+
### 5. Documentation Deployment (`docs-deploy.yml`)
102+
103+
**Trigger:** Push to `main` (docs changes), Manual dispatch
104+
**Purpose:** Deploy MkDocs documentation to GitHub Pages
105+
106+
**Jobs:**
107+
- Build documentation with MkDocs Material theme
108+
- Deploy to GitHub Pages
109+
- Automatic URL generation
110+
111+
**Requirements:**
112+
- Enable GitHub Pages in repository settings
113+
- Set source to "GitHub Actions"
114+
115+
### 6. Electron Release (`electron-release.yml`)
116+
117+
**Trigger:** Version tags (`v*.*.*`), Manual dispatch
118+
**Purpose:** Build and release desktop application
119+
120+
**Matrix Builds:**
121+
- **Linux:** AppImage, deb, rpm
122+
- **Windows:** exe, msi
123+
- **macOS:** dmg, zip
124+
125+
**Features:**
126+
- Multi-platform builds
127+
- Automated GitHub Release creation
128+
- Release notes generation
129+
- Code signing support (configure secrets)
130+
131+
**Artifacts:** All platform-specific installers
132+
133+
### 7. Dependency Review (`dependency-review.yml`)
134+
135+
**Trigger:** Pull Requests
136+
**Purpose:** Review dependency changes for security
137+
138+
**Features:**
139+
- Scans for vulnerable dependencies
140+
- Fails on moderate+ severity issues
141+
- Posts summary in PR comments
142+
143+
### 8. Dependabot (`dependabot.yml`)
144+
145+
**Schedule:** Weekly (Monday 9:00 AM)
146+
**Purpose:** Automated dependency updates
147+
148+
**Monitors:**
149+
- npm packages
150+
- pip packages
151+
- GitHub Actions versions
152+
153+
**Features:**
154+
- Grouped updates (production vs development)
155+
- Automatic PR creation
156+
- Configurable reviewers and labels
157+
158+
## Setup Instructions
159+
160+
### 1. Enable GitHub Pages
161+
162+
1. Go to **Settings****Pages**
163+
2. Set **Source** to "GitHub Actions"
164+
3. Save changes
165+
166+
### 2. Add Repository Secrets (Optional)
167+
168+
For enhanced functionality, add these secrets in **Settings****Secrets and variables****Actions**:
169+
170+
- `CODECOV_TOKEN`: For code coverage reporting (get from codecov.io)
171+
- `MAC_CERT`: macOS code signing certificate (for production releases)
172+
- `MAC_CERT_PASSWORD`: Certificate password
173+
174+
### 3. Configure Dependabot
175+
176+
Edit `.github/dependabot.yml` and replace `your-github-username` with your actual username.
177+
178+
### 4. Branch Protection Rules (Recommended)
179+
180+
Configure in **Settings****Branches****Branch protection rules**:
181+
182+
For `main` branch:
183+
- ✅ Require pull request reviews
184+
- ✅ Require status checks to pass
185+
- Select: Python CI, Node.js CI, CodeQL
186+
- ✅ Require branches to be up to date
187+
- ✅ Require conversation resolution before merging
188+
189+
### 5. Update README Badges
190+
191+
Copy the status badges from the top of this document to your `README.md` and replace `YOUR-USERNAME`.
192+
193+
## Development Workflow
194+
195+
### Pull Request Workflow
196+
197+
1. **Create feature branch**
198+
```bash
199+
git checkout -b feature/my-feature
200+
```
201+
202+
2. **Make changes and commit**
203+
```bash
204+
git add .
205+
git commit -m "feat: add new feature"
206+
```
207+
208+
3. **Push and create PR**
209+
```bash
210+
git push origin feature/my-feature
211+
```
212+
213+
4. **Automated checks run:**
214+
- Path filtering determines which workflows run
215+
- Linting, type checking, tests execute
216+
- Security scans analyze code
217+
- Dependency review checks new packages
218+
219+
5. **Review results:**
220+
- All checks must pass (green ✓)
221+
- Fix any issues reported
222+
- Request code review
223+
224+
6. **Merge to main:**
225+
- Upon merge, documentation deploys automatically
226+
- Main branch remains stable
227+
228+
### Release Workflow
229+
230+
1. **Update version** in `package.json` and `pyproject.toml`
231+
232+
2. **Create and push tag:**
233+
```bash
234+
git tag v1.0.0
235+
git push origin v1.0.0
236+
```
237+
238+
3. **Automated release:**
239+
- Electron builds for all platforms
240+
- GitHub Release created automatically
241+
- Installers attached to release
242+
243+
## Maintenance
244+
245+
### Updating Workflows
246+
247+
- Workflow files in `.github/workflows/`
248+
- Use GitHub's workflow editor for syntax validation
249+
- Test changes in a separate branch first
250+
251+
### Monitoring
252+
253+
- **Actions tab:** View all workflow runs
254+
- **Security tab:** CodeQL alerts
255+
- **Pull Requests:** Automated check status
256+
- **Insights → Dependency graph:** Dependabot PRs
257+
258+
### Troubleshooting
259+
260+
**Tests failing?**
261+
- Check test logs in Actions tab
262+
- Run tests locally: `npm test` or `pytest`
263+
264+
**Build failing?**
265+
- Verify dependencies are installed
266+
- Check for TypeScript compilation errors
267+
- Review ESLint/Black formatting
268+
269+
**CodeQL alerts?**
270+
- Review in Security tab
271+
- Fix vulnerabilities before merging
272+
- May require dependency updates
273+
274+
## Performance Optimization
275+
276+
### Caching Strategy
277+
278+
All workflows use dependency caching:
279+
- **npm:** `~/.npm` cached by Node.js action
280+
- **pip:** Cached by Python action
281+
- **Actions:** GitHub Actions cache
282+
283+
### Concurrent Runs
284+
285+
- Multiple PRs can run simultaneously
286+
- `concurrency` groups prevent duplicate documentation deploys
287+
- Matrix builds run in parallel
288+
289+
### Cost Management
290+
291+
- Smart path filtering reduces unnecessary runs
292+
- `continue-on-error` for non-critical checks
293+
- Artifact retention: 7 days (configurable)
294+
295+
## Best Practices
296+
297+
1. **Keep workflows fast:** Target <10 minutes per workflow
298+
2. **Use caching:** All dependency installations cached
299+
3. **Fail fast:** Use `fail-fast: false` in matrices to see all failures
300+
4. **Security first:** CodeQL and dependency review on all PRs
301+
5. **Semantic versioning:** Use conventional commits for releases
302+
6. **Test locally:** Run linters/tests before pushing
303+
7. **Monitor costs:** GitHub provides 2000 free minutes/month for public repos
304+
305+
## Additional Resources
306+
307+
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
308+
- [Electron Builder](https://www.electron.build/)
309+
- [MkDocs Material](https://squidfunk.github.io/mkdocs-material/)
310+
- [CodeQL](https://codeql.github.com/docs/)
311+
- [Dependabot](https://docs.github.com/en/code-security/dependabot)
312+
313+
## Support
314+
315+
For issues with CI/CD:
316+
1. Check workflow logs in Actions tab
317+
2. Review this documentation
318+
3. Consult GitHub Actions documentation
319+
4. Open an issue with `ci/cd` label

0 commit comments

Comments
 (0)