Skip to content

feat: complete CI/CD setup with automated testing (phases 1-3)#2

Open
vrnvrn wants to merge 8 commits intomainfrom
ci-cd-setup
Open

feat: complete CI/CD setup with automated testing (phases 1-3)#2
vrnvrn wants to merge 8 commits intomainfrom
ci-cd-setup

Conversation

@vrnvrn
Copy link
Member

@vrnvrn vrnvrn commented Dec 15, 2025

What

Complete GitOps implementation with CI/CD pipeline, automated testing, and team hygiene tools.

Why

Establish automated quality gates to prevent broken code from reaching main and ensure consistent code quality across the team.

Testing

  • ✅ All checks pass locally (pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build)
  • ✅ Pre-commit hooks working (lint-staged auto-fixes)
  • ✅ E2E tests configured (smoke tests with mocks, real Arkiv tests with real services)
  • ✅ CI pipeline configured and ready to run

Checklist

  • Build passes (pnpm build succeeds)
  • No secrets in code, commit messages, or documentation
  • No hardcoded credentials as fallbacks
  • Documentation updated (moved internal docs to refs/)
  • Code is clean (no commented code, unused imports, debug logs)
  • Commit messages are clear and don't mention secrets

Changes Summary

Phase 1 - Foundation:

  • GitHub Actions CI workflow
  • ESLint + Prettier configuration
  • Vitest unit testing setup
  • Husky pre-commit hooks with lint-staged

Phase 2 - Real Testing:

  • Playwright E2E framework
  • Smoke tests (mocked, fast)
  • Real Arkiv integration tests (real services)
  • MSW mocking layer for smoke tests

Phase 3 - Team Hygiene:

  • PR template
  • Coverage thresholds (0% baseline, will raise incrementally)
  • Dependabot configuration
  • Branch protection rules (configured in GitHub)

Notes

  • Branch protection rule is active and will require this PR to pass all checks
  • E2E tests use real Arkiv/web3 for integration confidence
  • Coverage thresholds start at 0% (baseline) - will raise as test suite grows

Phase 1 of GitOps implementation: automated quality checks on every push and PR.

Added:
- GitHub Actions workflow (.github/workflows/ci.yml) that runs on push/PR to main
  - Quality job: lint, typecheck, test, format check
  - Build job: verifies Next.js build succeeds
- ESLint config (.eslintrc.cjs) for Next.js + TypeScript
  - Allows up to 1000 warnings during transition
  - Ignores refs/, scripts/, subgraph/ directories
- Prettier config (.prettierrc) for consistent code formatting
- Vitest setup (vitest.config.ts, vitest.setup.ts) for unit testing
  - jsdom environment for React component testing
  - Sample test file included
- Husky pre-commit hook (.husky/pre-commit) with lint-staged
  - Automatically runs lint/format on staged files before commit
  - Prevents broken code from being committed

Updated:
- package.json: added scripts (lint, format, typecheck, test, etc.)
- tsconfig.json: excludes vitest config files from type checking

All checks pass locally. Build verified before commit per engineering guidelines.
Phase 2 of GitOps implementation: end-to-end testing with mocked web3 services.

Added:
- Playwright E2E test framework (playwright.config.ts)
  - Configured for local dev and CI environments
  - HTML reporter for test results
  - Automatic retries on CI
- Smoke test suite (e2e/smoke.spec.ts)
  - Verifies landing page loads and renders
  - Basic navigation accessibility checks
  - MSW integration for HTTP/GraphQL mocking
- MSW mocking layer (e2e/mocks/)
  - Handlers for Arkiv GraphQL endpoint (/api/graphql)
  - Mock responses for networkOverview and profile queries
  - Server setup for request interception
- Viem mock transport placeholder (lib/test/viemMockTransport.ts)
  - Documents approach for RPC mocking if needed
  - MSW handles HTTP interception for most cases
- E2E seed data structure (e2e/fixtures/seed.ts)
  - Deterministic test data for predictable scenarios
  - Guarded behind E2E_SEED env var (no secrets)

Updated:
- package.json: added e2e, e2e:ui, e2e:debug scripts
- CI workflow: added e2e job that runs after build
  - Installs Playwright browsers
  - Starts Next.js server
  - Runs E2E tests with mocked services
  - Uploads test reports as artifacts on failure
  - Marked continue-on-error initially for stability

All checks pass locally. Build verified before commit per engineering guidelines.
Phase 3 of GitOps implementation: team hygiene and quality gates.

Added:
- PR template (.github/PULL_REQUEST_TEMPLATE.md)
  - Standardized sections: What, Why, Testing, Checklist
  - Aligned with ENGINEERING_GUIDELINES.md requirements
  - Ensures PRs include necessary context and verification
- Dependabot config (.github/dependabot.yml)
  - Weekly npm dependency checks
  - Auto-opens PRs for security updates
  - Groups security updates to reduce PR noise
- Coverage thresholds (vitest.config.ts)
  - Set to 0% baseline (prevents backsliding)
  - Goal: raise to 20% → 40% → 60% → 80% as test suite grows
  - CI fails if coverage drops below thresholds

Updated:
- Implementation plan (refs/GITOPS_IMPLEMENTATION_PLAN.md)
  - Clarified: mocks ONLY for smoke tests
  - Full E2E tests use REAL Arkiv queries and REAL web3
  - Ensures integration testing with actual services, not mocked responses
  - Updated Phase 2 status to complete
  - Updated coverage threshold guidance (0% baseline)

Note: Branch protection rules must be configured in GitHub repo settings
(no code changes needed). See implementation plan for details.

All checks pass locally. Build verified before commit per engineering guidelines.
Add comprehensive E2E tests that use REAL Arkiv queries and REAL web3 services.

Added:
- Real Arkiv integration tests (e2e/arkiv-real.spec.ts)
  - Tests GraphQL endpoint with real Arkiv indexer queries
  - Tests network page loading real Arkiv data
  - Tests profile queries against real Arkiv
  - Verifies landing page loads without errors
  - NO MOCKS - uses real services for integration confidence
- Updated smoke tests (e2e/smoke.spec.ts)
  - Clearly marked as mocked tests for fast checks
  - Separated from real integration tests
- Updated Playwright config
  - Clarified smoke vs real test distinction
  - Real tests explicitly disable mocks

Updated:
- CI workflow (.github/workflows/ci.yml)
  - Runs smoke tests (mocked) first for fast feedback
  - Runs real Arkiv tests (real services) separately
  - Real tests marked continue-on-error (may fail if Arkiv/RPC unavailable)
  - This ensures we test actual integration, not just mocked responses

Testing approach:
- Smoke tests: Fast, mocked, CI-friendly (basic rendering checks)
- Real tests: Full integration with real Arkiv/web3 (production-like confidence)
- Balance between speed (smoke) and confidence (real E2E)

All checks pass locally. Build verified before commit per engineering guidelines.
Auto-fixed by lint-staged during previous commit.
Changes let to const for variables that are never reassigned.
@vercel
Copy link

vercel bot commented Dec 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
p2pmentor Ready Ready Preview, Comment Dec 15, 2025 10:42pm

Best practice: Husky git hooks are only needed locally, not in CI.
Setting HUSKY=0 prevents potential issues during pnpm install in CI
environments while keeping hooks functional for local development.
Update prepare script to check for CI environment variable (set by GitHub Actions)
and HUSKY=0 before running husky. This ensures husky only runs locally,
preventing install failures in CI while maintaining hooks for local development.
CI was using pnpm 9 but lockfile was generated with pnpm 8.6.0.
Update all CI jobs to use pnpm 8.6.0 to match local environment and
prevent lockfile version mismatch errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant