Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
488 changes: 488 additions & 0 deletions .github/CI_CD_GUIDE.md

Large diffs are not rendered by default.

342 changes: 342 additions & 0 deletions .github/CI_CD_SETUP_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
# CI/CD Pipeline Setup Summary

## Overview

Comprehensive CI/CD pipeline successfully configured for the `genomic-vector-analysis` package with 5 GitHub Actions workflows, quality gates, security scanning, and automated release management.

## Quick Reference

### Workflows Created

| Workflow | File | Trigger | Purpose |
|----------|------|---------|---------|
| **Test** | `test.yml` | Push/PR + Daily | Matrix testing, coverage, performance benchmarks |
| **Build** | `build.yml` | Push/PR | TypeScript + Rust/WASM builds, bundle analysis |
| **Publish** | `publish.yml` | Git tags + Manual | NPM publishing, GitHub releases, Docker images |
| **Docs** | `docs.yml` | Push to main | API docs generation, GitHub Pages deployment |
| **Quality** | `quality.yml` | Push/PR + Weekly | ESLint, Prettier, security scans, CodeQL |

### Configuration Files

| File | Location | Purpose |
|------|----------|---------|
| `.prettierrc` | `packages/genomic-vector-analysis/` | Code formatting rules |
| `.eslintrc.json` | `packages/genomic-vector-analysis/` | Linting configuration |
| `.nvmrc` | `packages/genomic-vector-analysis/` | Node version (20.10.0) |
| `dependabot.yml` | `.github/` | Automated dependency updates |
| `markdown-link-check-config.json` | `.github/` | Documentation link validation |

### Package Configuration

**Updated `package.json` with:**
- Enhanced description with SEO keywords
- Repository, homepage, and bug tracker links
- Funding information
- NPM publish configuration with provenance
- Additional keywords for NPM discovery
- OS compatibility specifications
- Engine requirements (Node >=18.0.0, npm >=9.0.0)
- Proper `files` field for published package
- Additional scripts: `lint:fix`, `format:check`, `build:wasm`, `prepublishOnly`

## Quality Gates

### Testing Thresholds
- Code Coverage: ≥90% (statements, functions, lines)
- Branch Coverage: ≥85%
- Performance: Query latency p95 <1ms, Throughput >50k var/sec
- Bundle Size: <512KB

### Security Measures
- npm audit (moderate threshold)
- Snyk security scanning (high severity)
- CodeQL analysis
- Dependency review on PRs
- License compliance checking

## Setup Checklist

### Required GitHub Secrets

Set these secrets in GitHub repository settings (`Settings → Secrets and variables → Actions`):

- [ ] `NPM_TOKEN` - For publishing to NPM registry
- [ ] `SNYK_TOKEN` - For Snyk security scanning (optional but recommended)

**Note:** `GITHUB_TOKEN` is automatically provided by GitHub Actions.

### NPM Token Setup

```bash
# 1. Log in to npm
npm login

# 2. Generate access token
# Go to: https://www.npmjs.com/settings/YOUR_USERNAME/tokens
# Click "Generate New Token" → "Automation" or "Publish"
# Copy the token

# 3. Add to GitHub
# Repository → Settings → Secrets → New repository secret
# Name: NPM_TOKEN
# Value: [paste token]
```

### Snyk Token Setup (Optional)

```bash
# 1. Sign up at https://snyk.io
# 2. Go to Account Settings → API Token
# 3. Copy your token
# 4. Add to GitHub secrets as SNYK_TOKEN
```

### GitHub Pages Setup

Enable GitHub Pages for documentation:

1. Go to `Settings → Pages`
2. Source: `GitHub Actions`
3. Documentation will be deployed automatically on push to main

## Usage

### Running Tests Locally

```bash
cd packages/genomic-vector-analysis

# All tests
npm test

# Specific test suites
npm run test:unit
npm run test:integration
npm run test:performance
npm run test:coverage

# Watch mode
npm run test:watch
```

### Code Quality Checks

```bash
# Linting
npm run lint # Check for errors
npm run lint:fix # Auto-fix errors

# Formatting
npm run format # Format all files
npm run format:check # Check formatting

# Type checking
npm run typecheck # TypeScript strict mode
```

### Building

```bash
# TypeScript build
npm run build

# Rust/WASM build
npm run build:wasm

# Clean build artifacts
npm run clean
```

### Documentation

```bash
# Generate API docs
npm run docs

# Watch mode (auto-regenerate)
npm run docs:serve

# Export as JSON
npm run docs:json

# Export as Markdown
npm run docs:markdown
```

### Publishing a New Version

#### Automated (Recommended)

```bash
# 1. Update CHANGELOG.md with changes

# 2. Create and push a version tag
git tag v1.2.3
git push origin v1.2.3

# 3. GitHub Actions will automatically:
# - Run all quality gates
# - Publish to NPM
# - Create GitHub release
# - Build Docker image (optional)
```

#### Manual

```bash
# 1. Update version in package.json
npm version patch # 1.0.0 → 1.0.1
npm version minor # 1.0.0 → 1.1.0
npm version major # 1.0.0 → 2.0.0

# 2. Run quality checks
npm run test:ci
npm run lint
npm run typecheck

# 3. Build
npm run build

# 4. Publish
npm publish --access public
```

## Workflow Triggers

### Automatic Triggers

| Event | Workflows |
|-------|-----------|
| Push to main/develop | Test, Build, Quality |
| Pull request | Test, Build, Quality, Docs |
| Git tag (v*.*.*) | Publish |
| Daily (2 AM UTC) | Test |
| Weekly (Mon 9 AM UTC) | Quality |

### Manual Triggers

All workflows can be manually triggered via:
- GitHub UI: `Actions → [Workflow] → Run workflow`
- GitHub CLI: `gh workflow run [workflow-name]`

## Monitoring

### GitHub Actions Dashboard

Monitor workflow runs:
- `Actions` tab in repository
- Filter by workflow, branch, or event
- Download logs and artifacts

### PR Comments

Automated comments posted on PRs:
- Performance benchmark results
- Bundle size analysis
- Test coverage reports

### GitHub Security Tab

Security alerts:
- `Security → Dependabot alerts`
- `Security → Code scanning alerts`

## Next Steps

### Immediate Actions

1. **Set NPM_TOKEN secret** (required for publishing)
2. **Enable GitHub Pages** (for documentation)
3. **Set SNYK_TOKEN secret** (recommended for enhanced security)
4. **Review and customize thresholds** in workflow files if needed

### Recommended Setup

1. **Branch Protection Rules:**
```
Settings → Branches → Add rule
- Branch name pattern: main
- Require status checks to pass before merging
- Require branches to be up to date before merging
- Select: Test, Build, Quality workflows
```

2. **CODEOWNERS File:**
```bash
# Create .github/CODEOWNERS
* @ruvnet
/.github/ @ruvnet
/packages/genomic-vector-analysis/ @ruvnet
```

3. **Issue Templates:**
Create issue templates for bug reports and feature requests

4. **Pull Request Template:**
Create PR template with checklist

### Future Enhancements

- [ ] Add end-to-end tests
- [ ] Implement visual regression testing
- [ ] Add performance regression detection
- [ ] Set up staging environment
- [ ] Implement canary deployments
- [ ] Add Slack/Discord notifications
- [ ] Configure custom domain for docs
- [ ] Add badge.fury.io badges to README
- [ ] Implement changelog automation with conventional commits

## Troubleshooting

### Common Issues

**Tests pass locally but fail in CI:**
```bash
# Run in CI mode locally
npm run test:ci

# Check Node version matches
node --version # Should be 20.10.0
```

**Bundle size exceeds threshold:**
```bash
# Check bundle size
npm run build && du -sh dist/

# Review dependencies
npm ls --depth=0
```

**Coverage below threshold:**
```bash
# Generate coverage report
npm run test:coverage

# Open HTML report
open coverage/lcov-report/index.html
```

**Publishing fails:**
- Verify NPM_TOKEN is set correctly
- Check version doesn't already exist on NPM
- Ensure tag format is correct (v1.2.3)

## Documentation

- **Full CI/CD Guide:** `.github/CI_CD_GUIDE.md`
- **Package README:** `packages/genomic-vector-analysis/README.md`
- **Architecture:** `packages/genomic-vector-analysis/ARCHITECTURE.md`
- **Contributing:** `packages/genomic-vector-analysis/CONTRIBUTING.md`

## Support

- **Issues:** https://github.com/ruvnet/ruvector/issues
- **Email:** support@ruv.io

---

**Setup Date:** 2025-11-23
**Version:** 1.0.0
**Status:** ✅ Complete and Ready for Use
Loading
Loading