Skip to article content
FrontendXLesson 15 / 16

Capstone: A Full Pipeline for the Quality Task Board

Take one task-board application from local tests to a real delivery pipeline: continuous integration fundamentals, push and pull-request quality gates, lint, type-check, unit, component and end-to-end gates, dependency caching, matrix builds, artifacts and checksums, secrets and supply-chain security, release promotion, staging and production, rollback and observability.

advanced · about 45 minutes · 4 exercises

  • Implement
  • Debug
  • Test
  • Interview

What you will be able to do

#
  • Assemble lint, type-check, unit, build and e2e gates in cost order.
  • Share one build artifact across downstream jobs.
  • Add a new required check without blocking open pull requests.

Overview

#

The capstone pipeline

The testing course builds a quality task-board application milestone by milestone, adding a defect, a failing test and a fix at each step. This lesson wires those checks into one pipeline. The pipeline is the delivery mechanism for the capstone: the same tests that catch the milestone defects become the gates that protect the branch.

snippet.yaml
name: capstone-ci
on:
  pull_request:
  push:
    branches: [main]
concurrency:
  group: capstone-${{ github.ref }}
  cancel-in-progress: true
jobs:
  static:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: pnpm
      - run: corepack enable && pnpm install --frozen-lockfile
      - run: pnpm lint
      - run: pnpm typecheck
  unit:
    needs: static
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: pnpm
      - run: corepack enable && pnpm install --frozen-lockfile
      - run: pnpm test -- --coverage
  build:
    needs: unit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: pnpm
      - run: corepack enable && pnpm install --frozen-lockfile
      - run: pnpm build
      - uses: actions/upload-artifact@v4
        with:
          name: task-board-dist
          path: dist
  e2e:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          name: task-board-dist
          path: dist
      - run: npx playwright install --with-deps chromium
      - run: pnpm test:e2e

Order the stages by cost

Fast gates first: lint and type-check, then unit, then build, then end-to-end. A cheap failure stops the pipeline before expensive stages run. needs encodes this order. The commands match the quality-task-board project scripts (lint, typecheck, test, build, test:e2e).

One artifact, many consumers

The build job uploads the artifact once. The e2e job downloads it instead of rebuilding. This keeps the tested bytes identical to the built bytes.

Adding a new required check safely

When you add a gate, add the job first, let it run on a few pull requests, then mark it required. Marking it required before it is stable can block all merges. Renaming a job after it is required breaks the protection rule, as covered earlier.

Sandbox boundary

The browser sandbox can run the task-board's pure logic and a small assertion. It cannot run the full lint, type-check, build and Playwright pipeline. The workflow above is authored configuration for a native runner, not something the browser executes.

Exercises

#

Reference answers and expected output are authored, not executed in this browser. Nothing you type is run, and there is no Run or Pass control on this page.

  1. Exercise 1Implement

    Add an e2e job that depends on the build job, downloads the task-board-dist artifact and installs Chromium before running the end-to-end tests.

    starter.yaml
      e2e:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
    

    Reveal the reference answer
    reference.yaml
      e2e:
        needs: build
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/download-artifact@v4
            with:
              name: task-board-dist
              path: dist
          - run: npx playwright install --with-deps chromium
          - run: pnpm test:e2e

    Authored expected output: An e2e job that needs build, downloads task-board-dist and installs Chromium before the tests.

    Depending on build and downloading the artifact means the e2e tests run against the built bytes. Installing the browser first avoids the missing-browser failure.

  2. Exercise 2Debug

    This e2e job downloads an artifact that the build job never uploaded, so it fails. Add the missing upload to the build job.

    starter.yaml
      build:
        runs-on: ubuntu-latest
        steps:
          - run: pnpm build
      e2e:
        needs: build
        steps:
          - uses: actions/download-artifact@v4
            with:
              name: task-board-dist
    

    Reveal the reference answer
    reference.yaml
      build:
        runs-on: ubuntu-latest
        steps:
          - run: pnpm build
          - uses: actions/upload-artifact@v4
            with:
              name: task-board-dist
              path: dist
      e2e:
        needs: build
        steps:
          - uses: actions/download-artifact@v4
            with:
              name: task-board-dist

    Authored expected output: The build job uploads task-board-dist before the e2e job downloads it.

    An artifact must be uploaded before it can be downloaded. The names must match exactly.

  3. Exercise 3Test

    Write a function pipelineComplete(jobs) that returns true only when jobs contains static, unit, build and e2e keys and e2e declares needs build.

    starter.javascript
    function pipelineComplete(jobs) {
      // return true or false
    }

    Reveal the reference answer
    reference.javascript
    function pipelineComplete(jobs) {
      if (!jobs || typeof jobs !== 'object') return false;
      const required = ['static', 'unit', 'build', 'e2e'];
      const hasAll = required.every((name) => Object.prototype.hasOwnProperty.call(jobs, name));
      if (!hasAll) return false;
      const e2e = jobs.e2e;
      return Boolean(e2e) && e2e.needs === 'build';
    }

    Authored expected output: pipelineComplete({ static: {}, unit: {}, build: {}, e2e: { needs: 'build' } }) is true; a pipeline missing e2e is false.

    The function checks the pipeline shape, not its execution. It runs in the browser sandbox; the pipeline it describes runs on a native runner.

  4. Exercise 4Interview

    Walk through how you would add a new required check to the capstone pipeline without breaking open pull requests.

    Reveal the reference answer
    reference.text
    Add the job to the workflow and let it run on several pull requests without marking it required, so flakiness and setup problems surface. Once it is stable, add it to branch protection as a required check. Keep the job name stable, because renaming a required check leaves pull requests waiting. If the check is slow, place it after the fast gates so cheap failures still stop the pipeline early.

    Authored expected output: A staged rollout from non-required to required with a stable name.

    Marking an unstable check required blocks every merge. Adding it first and requiring it later keeps the pipeline trustworthy.

Common misconceptions

#
  • Every job should rebuild the app so it is fresh.
  • A new check should be marked required immediately.
  • The browser sandbox can run the full capstone pipeline.

Follow-up practice

#
  • cicd-16-hardening-and-cost

Related resources

#

Your progress

#

Answers, drafts and completion marks are stored only in this browser. Nothing is sent to a server and no account is used.

Verification: authored. Answers and outputs on this page are authored reference material, not executed results.

© 2026 FrontendX. All rights reserved.