Skip to content

Commit 3d0468f

Browse files
committed
feat(workflows): add CI/CD workflows for continuous integration, quality assurance, security scanning, and typo checks
1 parent 1545d72 commit 3d0468f

10 files changed

Lines changed: 509 additions & 455 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Setup SortVision
2+
description: Install pnpm, Node.js, and SortVision dependencies (run after actions/checkout).
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version (must satisfy SortVision/package.json engines)
7+
required: false
8+
default: '24'
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
15+
with:
16+
version: 10.28.2
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
20+
with:
21+
node-version: ${{ inputs.node-version }}
22+
cache: pnpm
23+
cache-dependency-path: SortVision/pnpm-lock.yaml
24+
25+
- name: Install dependencies
26+
shell: bash
27+
working-directory: SortVision
28+
run: pnpm install --frozen-lockfile

.github/workflows/README.md

Lines changed: 43 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,73 @@
1-
# CI/CD Workflows
1+
# SortVision — GitHub Actions
22

3-
Automated quality assurance and deployment pipelines for SortVision.
3+
Workflows are split by responsibility. **Node.js 24** is used in CI to match [`SortVision/package.json` engines](../../SortVision/package.json). Third-party actions are pinned to **commit SHAs** (comments note the tag) for reproducible builds.
44

55
## Workflows
66

7-
### 1. Quality Assurance Pipeline (`quality-assurance.yml`)
7+
### `continuous-integration.yml`
88

9-
**Triggers:** Push/PR to main, master, develop branches
9+
**Triggers:** pull request, push to `main` / `master` / `develop`, merge queue, manual dispatch.
1010

11-
**Jobs:**
12-
- **quality-assurance** (30min timeout)
13-
- Code linting
14-
- Application build
15-
- Comprehensive test suite (600+ tests)
16-
- SEO validation and sitemap generation
17-
- Security audit
18-
- Bundle size analysis
11+
| Job | Purpose |
12+
|-----|---------|
13+
| **Formatting** | Prettier (`pnpm run format:check`) |
14+
| **Lint** | ESLint |
15+
| **Build and test** | After format + lint: Next.js build, dev server, `pnpm test` |
16+
| **Lighthouse** | After format + lint: production build, Lighthouse on key URLs; assertions live in [`SortVision/lighthouserc.json`](../../SortVision/lighthouserc.json) |
17+
| **Production validation** | On `main` / `master` only, after build/test: production smoke tests and HTTP checks |
1918

20-
- **lighthouse-audit** (Parallel, 15min timeout)
21-
- Lighthouse performance tests on 4 key pages
22-
- Automated performance scoring
23-
- Artifact upload for historical tracking
19+
Shared setup: [`setup-sortvision`](../actions/setup-sortvision/action.yml) (pnpm, Node, `pnpm install`).
2420

25-
- **production-validation** (Only on main/master, 10min timeout)
26-
- Production site health check
27-
- Production test suite (58 tests)
28-
- Response time validation
29-
- HTTP status verification
21+
### `extended-quality-assurance.yml`
3022

31-
### 2. Security Scan (`security-scan.yml`)
23+
**Triggers:** nightly (`0 2 * * *` UTC), `workflow_dispatch`.
3224

33-
**Triggers:**
34-
- Push/PR to main, master, develop
35-
- Weekly schedule (Sunday midnight)
25+
Longer validation: format, lint, build, `pnpm run test:extended`, sitemap, **pnpm audit** (fails on high/critical for production deps), bundle notes, artifacts.
3626

37-
**Jobs:**
38-
- Dependency vulnerability scan
39-
- Secret detection
40-
- Security audit report generation
27+
### `security-scan.yml`
4128

42-
## Test Suite
29+
**Triggers:** push/PR, weekly schedule.
4330

44-
Single comprehensive test file: `tests/quality-assurance.mjs`
31+
- **pnpm audit** for production dependencies: **fails on high and critical** (moderate/low: review locally or via Dependabot).
32+
- **TruffleHog** (pinned release) for verified secrets.
33+
- **Dependency review** on pull requests (`fail-on-severity: moderate`).
4534

46-
### Test Modes:
35+
### CodeQL (GitHub default setup)
4736

48-
| Command | Tests | Description |
49-
|---------|-------|-------------|
50-
| `npm test` | 600+ | Complete suite (localhost) |
51-
| `npm run test:quick` | 30 | Quick validation only |
52-
| `npm run test:prod` | 100+ | Production validation |
37+
This repo does **not** use a custom `codeql.yml` workflow. Enable **Code scanning** with **Default setup** under **Settings → Code security and analysis → Code scanning**. Results and status appear under the **Security** tab; required checks (if any) use the names GitHub shows for that setup (not the old workflow job `Analyze (JavaScript)`).
5338

54-
### Coverage:
55-
- **Quick Validation** (30 tests): Core pages, SEO files, sample algorithms
56-
- **Comprehensive** (200 tests): All languages × all algorithms × all tabs
57-
- **Integration** (250 tests): Extended core, deep SEO, security, headers, edge cases
58-
- **Performance** (120 tests): Multi-run performance validation across all languages
59-
- **Total:** 600+ tests
39+
### `typos.yml`
6040

61-
## Artifacts
41+
**Triggers:** push/PR when `SortVision/**`, [`_typos.toml`](../../_typos.toml), or this workflow changes.
6242

63-
### Retention Periods:
64-
- Test results: 30 days
65-
- Security audits: 90 days
66-
- Lighthouse reports: Permanent (via temporary public storage)
43+
Spell check using [typos](https://github.com/crate-ci/typos); large i18n and lockfiles are excluded in [`_typos.toml`](../../_typos.toml).
6744

68-
## Status Badges
45+
### `dependabot-auto-merge.yml`
6946

70-
Add to README.md:
47+
Auto-merge rules for Dependabot PRs (repository-specific).
7148

72-
```markdown
73-
![Quality Assurance](https://github.com/YOUR_USERNAME/SortVision/workflows/Quality%20Assurance%20Pipeline/badge.svg)
74-
![Security Scan](https://github.com/YOUR_USERNAME/SortVision/workflows/Security%20Scan/badge.svg)
75-
```
76-
77-
## Configuration
78-
79-
### Environment Variables:
80-
- `NODE_VERSION`: '22'
81-
- `NEXT_PUBLIC_SITE_URL`: https://www.sortvision.com
49+
## Branch protection
8250

83-
### Timeouts:
84-
- Quality Assurance: 30 minutes
85-
- Lighthouse: 15 minutes
86-
- Production Validation: 10 minutes
87-
- Security Scan: 10 minutes
51+
Required status check names must match each job’s `name:` field exactly (for example **Formatting**, **Lint**, **Build and test**, **Typos**). Add CodeQL-related checks only if you require them, using the exact names from **Settings → Rules** after a green run.
8852

89-
## Local Testing
53+
## Adding more checks
9054

91-
Run tests locally:
55+
- **Default PR path:** extend [`continuous-integration.yml`](continuous-integration.yml) or add a job with `needs:` as appropriate.
56+
- **Nightly / manual only:** use [`extended-quality-assurance.yml`](extended-quality-assurance.yml) or a new workflow file.
57+
- **Security:** prefer [`security-scan.yml`](security-scan.yml); CodeQL is managed in **Settings → Code scanning** (default setup).
9258

93-
```bash
94-
# Complete test suite
95-
npm test
96-
97-
# Quick validation (30 tests)
98-
npm run test:quick
59+
**Not configured here (optional later):** Knip/depcheck for unused exports, Playwright E2E — useful once you want the extra maintenance cost.
9960

100-
# Production validation
101-
npm run test:prod
61+
## Badges
10262

103-
# Other checks
104-
npm run lint
105-
npm run build
106-
npm run generate-sitemap
107-
npm audit --production
63+
```markdown
64+
![CI](https://github.com/OWNER/REPO/workflows/Continuous%20integration/badge.svg)
65+
![Security](https://github.com/OWNER/REPO/workflows/Security%20Scan/badge.svg)
10866
```
10967

110-
## Troubleshooting
111-
112-
### Build Failures:
113-
1. Check Node version (requires 22+)
114-
2. Clear cache: `npm ci`
115-
3. Verify dependencies: `npm audit`
68+
## Local parity
11669

117-
### Test Failures:
118-
1. Ensure dev server starts: `npm run dev`
119-
2. Check port 3000 is free
120-
3. Review test output for details
121-
4. Check specific failed URLs
122-
123-
### Production Validation Failures:
124-
1. Verify site is deployed
125-
2. Check DNS resolution
126-
3. Test manually: `curl https://www.sortvision.com`
127-
128-
## Maintenance
129-
130-
### Weekly:
131-
- Review security scan results
132-
- Check for dependency updates
133-
134-
### Monthly:
135-
- Review Lighthouse trends
136-
- Analyze bundle size changes
137-
- Update workflow versions
138-
139-
## Contact
140-
141-
For CI/CD issues, check:
142-
1. GitHub Actions logs
143-
2. Uploaded artifacts
144-
3. GITHUB_STEP_SUMMARY reports
70+
```bash
71+
cd SortVision
72+
pnpm run format:check && pnpm run lint && pnpm run build && pnpm test
73+
```

0 commit comments

Comments
 (0)