Lesson 1 · Unit 04
Continuous integration
Workflows, jobs, steps, triggers and a matrix: read the file that checks every push
What you practise
- A workflow file read line by line: triggers, jobs, steps
- Runners
- A matrix
- Caching dependencies
- Reading a red run
Try a question from this lesson
Pick one
Ana's branch passes its tests. So does Bo's. Both merge the same afternoon and main breaks: nobody ran the two changes together. What would have caught it that day?
Correct answer
A server that runs the checks on every push, main included
Why
Each branch was tested alone, and the bug lives in the combination. Only a run on the merged result can see it. Doing that automatically, for every push, is continuous integration: breakage is found while the cause is still fresh.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
A workflow file
In GitHub Actions, the recipe for CI is a workflow: a YAML file in the repository.
on names the events that start it. Each job gets a fresh machine, picked by runs-on. Its steps run top to bottom: uses runs a packaged action (this one fetches your code), and run runs a shell command.
# .github/workflows/ci.yml
on: push
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: npm ci
- run: make checkConcept
Fresh machines and caches
Every job starts on a fresh machine: nothing installed, nothing left over from the last run. That makes runs repeatable, and slow.
A cache saves a folder, such as the package manager's downloads, under a key. The usual key is a hash of the lockfile. Same lockfile, same key: restore instead of downloading. Change a dependency and the key changes with it.
10 more exercises in the app
- 5× multiple choice
- 1× true or false
- 2× type the answer
- 1× fill the blanks
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.