Skip to content

Commit 20942f2

Browse files
Copilothuangyiirene
andcommitted
Add workflow documentation, badges, and additional workflows
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent ee99612 commit 20942f2

File tree

5 files changed

+415
-0
lines changed

5 files changed

+415
-0
lines changed

.github/WORKFLOWS.md

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
# GitHub Workflows Documentation
2+
3+
This document describes the automated workflows configured for the Object UI repository.
4+
5+
## Overview
6+
7+
Our GitHub Actions workflows automate testing, security scanning, dependency management, and deployment processes. All workflows are located in `.github/workflows/`.
8+
9+
## Workflows
10+
11+
### 1. CI (Continuous Integration)
12+
13+
**File**: `ci.yml`
14+
**Triggers**: Push to `main`/`develop`, Pull Requests
15+
16+
This is the main CI pipeline that ensures code quality.
17+
18+
**Jobs**:
19+
- **Test**: Runs tests on Node.js 18.x and 20.x
20+
- Executes unit and integration tests
21+
- Generates coverage reports (Node 20.x only)
22+
- Uploads coverage to Codecov
23+
24+
- **Lint**: Checks code style and quality
25+
- Runs ESLint on all packages
26+
- Ensures code follows project standards
27+
28+
- **Build**: Validates that all packages build successfully
29+
- Builds all packages in the monorepo
30+
- Verifies build artifacts are created
31+
32+
**Optimizations**:
33+
- Uses pnpm store caching for faster dependency installation
34+
- Runs jobs in parallel when possible
35+
- Only uploads coverage on Node 20.x to save time
36+
37+
### 2. CodeQL Security Scan
38+
39+
**File**: `codeql.yml`
40+
**Triggers**: Push to `main`/`develop`, Pull Requests, Weekly schedule (Mondays)
41+
42+
Analyzes code for security vulnerabilities using GitHub's CodeQL engine.
43+
44+
**Features**:
45+
- Scans JavaScript/TypeScript code
46+
- Uses security-extended and security-and-quality query packs
47+
- Runs automatically on schedule to catch new vulnerabilities
48+
- Results visible in Security tab
49+
50+
### 3. PR Checks
51+
52+
**File**: `pr-checks.yml`
53+
**Triggers**: Pull Request opened/synchronized/reopened
54+
55+
Validates pull requests and provides feedback.
56+
57+
**Actions**:
58+
- Runs type checking (via build)
59+
- Executes tests
60+
- Runs linter (continues on error)
61+
- Posts success comment when all checks pass
62+
63+
### 4. Auto Label PRs
64+
65+
**File**: `labeler.yml`
66+
**Configuration**: `labeler.yml`
67+
**Triggers**: Pull Request opened/synchronized/reopened
68+
69+
Automatically labels PRs based on changed files.
70+
71+
**Labels Applied**:
72+
- Package-specific labels (e.g., `package: core`, `package: react`)
73+
- Plugin labels (e.g., `plugin: charts`)
74+
- Category labels (e.g., `documentation`, `tests`, `configuration`)
75+
- Scope labels (e.g., `examples`, `apps`, `ci/cd`)
76+
77+
### 5. Bundle Size Check
78+
79+
**File**: `size-check.yml`
80+
**Triggers**: Pull Requests (when package files change)
81+
82+
Reports bundle size changes in PR comments.
83+
84+
**Features**:
85+
- Calculates size of built packages
86+
- Reports both raw and gzipped sizes
87+
- Shows size warnings for large packages
88+
- Posts results as PR comment
89+
90+
**Size Limits**:
91+
- Core packages: < 50KB gzipped
92+
- Component packages: < 100KB gzipped
93+
- Plugin packages: < 150KB gzipped
94+
95+
### 6. Deploy Documentation
96+
97+
**File**: `deploy-docs.yml`
98+
**Triggers**: Push to `main` (docs changes), Manual workflow dispatch
99+
100+
Builds and deploys documentation to GitHub Pages.
101+
102+
**Steps**:
103+
1. Builds VitePress documentation
104+
2. Uploads artifact to GitHub Pages
105+
3. Deploys to production
106+
107+
**Access**: Documentation available at https://www.objectui.org
108+
109+
### 7. Release
110+
111+
**File**: `release.yml`
112+
**Triggers**: Push of version tags (e.g., `v1.0.0`)
113+
114+
Creates GitHub releases and publishes packages.
115+
116+
**Process**:
117+
1. Runs tests to ensure quality
118+
2. Builds all packages
119+
3. Creates GitHub release with changelog
120+
4. (Optional) Publishes to npm registry
121+
122+
**Note**: npm publishing is currently disabled. Uncomment the publish step when ready.
123+
124+
### 8. Stale Issues & PRs
125+
126+
**File**: `stale.yml`
127+
**Triggers**: Daily schedule, Manual workflow dispatch
128+
129+
Manages stale issues and pull requests.
130+
131+
**Configuration**:
132+
- Issues: Marked stale after 60 days, closed after 7 more days
133+
- PRs: Marked stale after 45 days, closed after 14 more days
134+
- Exempt labels: `pinned`, `security`, `critical`, `bug`, `enhancement`
135+
- Can be reopened if activity resumes
136+
137+
### 9. Dependabot Auto-merge
138+
139+
**File**: `dependabot-auto-merge.yml`
140+
**Configuration**: `dependabot.yml`
141+
**Triggers**: Dependabot pull requests
142+
143+
Automatically manages dependency updates.
144+
145+
**Behavior**:
146+
- **Patch/Minor updates**: Auto-approved and auto-merged
147+
- **Major updates**: Commented for manual review
148+
- Only merges after CI checks pass
149+
150+
**Dependabot Configuration**:
151+
- Weekly npm dependency updates (Mondays)
152+
- Weekly GitHub Actions updates
153+
- Groups related dependencies
154+
- Limits to 10 open PRs
155+
156+
### 10. Auto Changelog
157+
158+
**File**: `changelog.yml`
159+
**Triggers**: Release published, Manual workflow dispatch
160+
161+
Generates and updates CHANGELOG.md from git history.
162+
163+
**Note**: Requires `cliff.toml` configuration file for customization.
164+
165+
## Security Features
166+
167+
### CodeQL Analysis
168+
- Continuous security monitoring
169+
- Detects common vulnerabilities:
170+
- SQL injection
171+
- XSS vulnerabilities
172+
- Path traversal
173+
- Command injection
174+
- Sensitive data exposure
175+
176+
### Dependabot
177+
- Automated dependency updates
178+
- Security vulnerability alerts
179+
- Grouped updates by category
180+
- Auto-merge for safe updates
181+
182+
### Permissions
183+
All workflows follow the principle of least privilege:
184+
- Read-only access by default
185+
- Write permissions only when needed
186+
- Explicit permission declarations
187+
188+
## Issue & PR Templates
189+
190+
### Issue Templates
191+
- **Bug Report**: Structured bug reporting with environment details
192+
- **Feature Request**: Feature proposals with use cases
193+
- **Config**: Links to Discord, documentation, and discussions
194+
195+
### Pull Request Template
196+
- Comprehensive checklist
197+
- Change type classification
198+
- Testing requirements
199+
- Breaking change documentation
200+
- Migration guide section
201+
202+
## Workflow Badges
203+
204+
Add these badges to show workflow status:
205+
206+
```markdown
207+
[![CI](https://github.com/objectstack-ai/objectui/workflows/CI/badge.svg)](https://github.com/objectstack-ai/objectui/actions/workflows/ci.yml)
208+
[![CodeQL](https://github.com/objectstack-ai/objectui/workflows/CodeQL%20Security%20Scan/badge.svg)](https://github.com/objectstack-ai/objectui/actions/workflows/codeql.yml)
209+
```
210+
211+
## Best Practices
212+
213+
### For Contributors
214+
1. **Run checks locally first**: Use `pnpm lint`, `pnpm test`, `pnpm build`
215+
2. **Keep PRs focused**: One feature or fix per PR
216+
3. **Watch workflow results**: Fix failures promptly
217+
4. **Update documentation**: For user-facing changes
218+
219+
### For Maintainers
220+
1. **Review auto-merge settings**: Verify Dependabot merges are safe
221+
2. **Monitor security alerts**: Act on CodeQL findings
222+
3. **Manage stale items**: Review before auto-closure
223+
4. **Keep workflows updated**: Regular dependency updates for actions
224+
225+
## Troubleshooting
226+
227+
### Common Issues
228+
229+
**Problem**: CI fails with "pnpm: command not found"
230+
- **Solution**: Ensure `pnpm/action-setup@v4` is configured correctly
231+
232+
**Problem**: Tests timeout
233+
- **Solution**: Increase timeout in workflow or optimize tests
234+
235+
**Problem**: Bundle size check fails
236+
- **Solution**: Review size report, optimize imports, use code splitting
237+
238+
**Problem**: CodeQL analysis fails
239+
- **Solution**: Check for syntax errors, review CodeQL logs
240+
241+
### Getting Help
242+
243+
- Check [GitHub Actions documentation](https://docs.github.com/en/actions)
244+
- Review workflow logs in Actions tab
245+
- Ask in Discord community
246+
- Create an issue for workflow problems
247+
248+
## Maintenance
249+
250+
### Regular Tasks
251+
- [ ] Review and update GitHub Actions versions monthly
252+
- [ ] Monitor CodeQL findings weekly
253+
- [ ] Review Dependabot PRs weekly
254+
- [ ] Update workflow documentation for changes
255+
- [ ] Review stale item closure weekly
256+
257+
### Updating Workflows
258+
1. Test changes in a fork first
259+
2. Use workflow dispatch for manual testing
260+
3. Update documentation
261+
4. Monitor first few runs after changes
262+
263+
## Future Enhancements
264+
265+
Potential workflow additions:
266+
- [ ] Visual regression testing
267+
- [ ] Performance benchmarking
268+
- [ ] Automated canary releases
269+
- [ ] Integration tests with examples
270+
- [ ] Automated component documentation generation
271+
- [ ] npm package publishing automation
272+
273+
## Resources
274+
275+
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
276+
- [Dependabot Documentation](https://docs.github.com/en/code-security/dependabot)
277+
- [CodeQL Documentation](https://codeql.github.com/docs/)
278+
- [Conventional Commits](https://www.conventionalcommits.org/)

.github/workflows/secret-scan.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Secret Scanning
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
schedule:
9+
# Run weekly on Sundays
10+
- cron: '0 0 * * 0'
11+
12+
jobs:
13+
scan:
14+
name: Scan for Secrets
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Run Gitleaks
23+
uses: gitleaks/gitleaks-action@v2
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} # Only required for Organizations

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,39 @@ refactor: simplify expression evaluator
340340
- Respond to review comments promptly
341341
- Keep commits clean and meaningful
342342

343+
### Automated Workflows
344+
345+
Our repository includes several automated GitHub workflows that will run when you create a PR:
346+
347+
#### CI Pipeline
348+
- **Linting**: Checks code style and quality
349+
- **Type Checking**: Validates TypeScript types
350+
- **Tests**: Runs unit and integration tests
351+
- **Build**: Ensures all packages build successfully
352+
- **Matrix Testing**: Tests on Node.js 18.x and 20.x
353+
354+
#### Security Scans
355+
- **CodeQL**: Scans for security vulnerabilities in code
356+
- **Dependency Scanning**: Checks for known vulnerabilities in dependencies
357+
358+
#### PR Automation
359+
- **Auto-labeling**: Automatically labels PRs based on changed files
360+
- **Bundle Size**: Reports bundle size changes in PR comments
361+
- **PR Checks**: Validates PR requirements and posts status
362+
363+
#### What to Expect
364+
1. All checks must pass before merging
365+
2. Failed checks will show detailed error messages
366+
3. Some workflows (like auto-labeling) run automatically
367+
4. Review the check results and fix any issues
368+
369+
#### Tips for Passing Checks
370+
- Run `pnpm lint` before committing
371+
- Run `pnpm test` to catch test failures early
372+
- Run `pnpm build` to ensure successful builds
373+
- Keep dependencies up to date
374+
- Follow TypeScript strict mode requirements
375+
343376
## Documentation
344377

345378
### Writing Documentation

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*From JSON to world-class UI in minutes*
88

99
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10+
[![CI](https://github.com/objectstack-ai/objectui/workflows/CI/badge.svg)](https://github.com/objectstack-ai/objectui/actions/workflows/ci.yml)
11+
[![CodeQL](https://github.com/objectstack-ai/objectui/workflows/CodeQL%20Security%20Scan/badge.svg)](https://github.com/objectstack-ai/objectui/actions/workflows/codeql.yml)
1012
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
1113
[![React](https://img.shields.io/badge/React-18+-61dafb.svg)](https://reactjs.org/)
1214
[![Tailwind CSS](https://img.shields.io/badge/Tailwind-3.0+-38bdf8.svg)](https://tailwindcss.com/)

0 commit comments

Comments
 (0)