Sikau

GitHub Actions · Day 4 · about 40 min

Project: CI for the café API

Install, lint, test and build on every push and pull request.

The standard pipeline

Almost every JavaScript project's first workflow is the same four commands. Write it from scratch for the café API.

The four checks

Keep the workflow simple at first. You can add caching, matrices and deploys later, once the basic pipeline is reliable and the team trusts its results.

This is the workflow you'll write for almost every JavaScript project you start. Once it exists, every pull request gets the same checks automatically, and reviewers can focus on design and behaviour instead of asking whether the tests were run.

Each command in the standard pipeline catches a different class of problem. npm ci proves the lockfile installs cleanly. npm run lint catches style issues and likely bugs without running anything. npm test checks behaviour. npm run build proves the app compiles for production. Separate steps mean the log tells you which one failed at a glance.

  • Install — a missing or mismatched dependency.
  • Lint — unused variables, risky patterns, formatting.
  • Test — logic that no longer behaves as expected.
  • Build — type errors and bundling problems that only appear in production builds.

Run the same four commands locally before pushing; CI should rarely be the first place you see a failure.

The rest of this lesson

  • The workflow fileexplain
  • Make it requiredexplain
  • What each step catchesmatch
  • Lint failspredict
  • ci.ymlchallenge
  • Badge quizquiz
  • Unit 1 complete!recap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of GitHub Actions