CI/CD: What It Is
CI/CD is a way to build, test and ship code automatically. Every push to the code starts the same checks, with no manual steps.
The manual way
Without CI/CD, each change needs the same checks by hand.
1. Run the tests
2. Check the code style
3. Build the app
4. Put it liveThe automatic way
With CI/CD, one push starts all four checks.
git push
tests run
checks run
build runs
app shipsOne workflow, three parts
A workflow holds jobs. A job holds steps.
jobs:
test:
steps:
- run the testsExample
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: npm testKey points
- CI/CD: short for continuous integration and continuous delivery.
- Use CI/CD to catch broken code soon after it is written.
- A workflow is a set of automatic steps stored in a file.
- A job is one part of a workflow that runs on one machine.
- A step is one command or action inside a job.
- A runner is the computer that runs a job.
- CI/CD repeats the same checks on every push, so nothing is skipped.
- CI/CD turns shipping code into a repeatable routine.
In this example, the fragment shows the shape of a workflow. The job is called test. The runs-on line picks the runner, a computer running Ubuntu. The job has one step, and that step runs the tests. This is a fragment, not a full file. A later lesson adds the steps that fetch the code and set up Node.
Note
A workflow file lives with the code it checks, in the same repository.
Try it Yourself
Edit the code, then press Run.
Running is simulated Β· Rust Playground
Exercise
What does CI/CD do?