Course outline · 0% complete

0/29 lessons0%

Course overview →

What continuous integration is

lesson 7-1 · ~11 min · 19/29

Quiz

Warm-up from the git course: five teammates push to the same repository all day. Without any automation, when do you find out someone's push broke the tests?

Continuous integration

CI (continuous integration) means: every time anyone pushes code, a server automatically gets a fresh copy and runs your checks, typically install, lint, tests, and (since unit 3) docker build. If any check fails, the push is marked with a red ✗ on GitHub, the author is notified, and a pull request can be blocked from merging.

The machinery underneath is something you already know from the terminal course: exit codes. Every command finishes with a number, 0 for success, anything else for failure, readable as $?.

Test runners follow this convention: all tests green → exit 0, any test red → exit 1. The CI server just runs your commands in order and watches the exit codes. There is no magic understanding of your code, only 0 or not-0.

Code exercise · bash

Run this to see exit codes first-hand. true always succeeds, false always fails, and grep succeeds when it finds a match. $? holds the exit code of the previous command.

Code exercise · bash

Your turn: a CI server is basically this if statement. run_tests fails here (grep finds no match, so it exits non-zero). Call run_tests and print "tests passed" if it succeeded or "tests failed" if it did not.

Quiz

How does a CI server decide whether your test step passed?

Problem

A CI step's command finishes. What exit code number must it have produced for the step to count as passed?