# Continuous Integration for Frontend Projects

> Automate type checks, linting, tests, builds and previews on every pull request with GitHub Actions. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/frontend-ci
Last updated: 2026-11-28

Automate type checks, linting, tests, builds and previews on every pull request with GitHub Actions.

Intermediate · about 3 hours · difficulty 3/5

Learn first: [End-to-End Testing with Playwright](https://www.internhack.in/roadmaps/tracks/frontend/e2e-testing), [Linting and Formatting](https://www.internhack.in/roadmaps/tracks/frontend/linting-formatting), [Deploying Frontend Apps](https://www.internhack.in/roadmaps/tracks/frontend/deployment)

**Continuous integration (CI)** runs your quality checks automatically on every push and pull request, so broken code is caught before it merges. For a frontend team it is also where performance, accessibility and bundle-size budgets are enforced.

### A typical pipeline

1. **Install** with the lockfile (`npm ci` or `pnpm install --frozen-lockfile`), with dependency caching for speed.
2. **Type check** (`tsc --noEmit`) and **lint** (ESLint) and check formatting (Prettier).
3. **Unit and component tests** (Vitest) with coverage.
4. **Build** the production bundle.
5. **End-to-end tests** (Playwright) against the build or a preview deployment, uploading traces on failure.
6. Optional gates: **bundle size** limits, Lighthouse CI budgets, axe accessibility checks, visual regression.

### GitHub Actions basics

Workflows are YAML files in `.github/workflows/`: triggers (`on: pull_request`), jobs that run on hosted runners, steps using actions like `actions/checkout` and `actions/setup-node` (pin the Node version), and secrets for tokens. Run independent jobs in parallel and use a matrix for multiple browsers or Node versions.

### Team practices

- **Branch protection**: require CI to pass and a review before merging to `main`.
- Keep CI **fast** (under about 10 minutes) through caching, parallelism and running only affected checks in monorepos.
- Treat flaky tests as bugs; quarantine and fix them rather than re-running until green.
- Use **pre-commit hooks** (Husky plus lint-staged) for instant local feedback, but never rely on them alone.
- **Continuous deployment**: hosting platforms deploy `main` automatically once CI passes.

### Good enough to move on

Your project has a GitHub Actions workflow that type checks, lints, tests, builds and runs E2E tests on every pull request, with branch protection requiring it to pass.

## Key concepts

- **What CI is and why it matters**
- **GitHub Actions workflows, jobs and steps**
- **Caching dependencies**
- **Typecheck, lint, test and build stages**
- **E2E tests in CI**
- **Branch protection and required checks**
- **Bundle size and Lighthouse budgets**
- **Husky and lint-staged**

## Mini project

Write a GitHub Actions workflow for your capstone repository with parallel lint/typecheck/test jobs, a build, Playwright E2E against the preview URL, a bundle-size check and branch protection on main.

## Check yourself

Why should CI install dependencies with npm ci rather than npm install?

## Free resources

- [GitHub Actions documentation](https://docs.github.com/en/actions) (GitHub)
- [Building and testing Node.js](https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-nodejs) (GitHub)
- [Playwright Continuous Integration](https://playwright.dev/docs/ci) (Playwright)

Previous: [Environment Variables and Configuration](https://www.internhack.in/roadmaps/tracks/frontend/env-config) · Next: [Mobile Apps with React Native](https://www.internhack.in/roadmaps/tracks/frontend/react-native)

## More in Shipping to Production and Beyond

- [Deploying Frontend Apps](https://www.internhack.in/roadmaps/tracks/frontend/deployment)
- [Environment Variables and Configuration](https://www.internhack.in/roadmaps/tracks/frontend/env-config)
- [Continuous Integration for Frontend Projects](https://www.internhack.in/roadmaps/tracks/frontend/frontend-ci)
- [Mobile Apps with React Native](https://www.internhack.in/roadmaps/tracks/frontend/react-native)
- [Desktop Apps with Electron and Tauri](https://www.internhack.in/roadmaps/tracks/frontend/desktop-apps)
- [Capstone: A Production-Grade Frontend Application](https://www.internhack.in/roadmaps/tracks/frontend/capstone)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
