So far, many of our checks have been manual. After changing code, we may run the application ourselves, execute tests, and make sure everything works before opening a Pull Request.
The problem is that developers can forget to run these checks.
This is where CI/CD becomes useful.
At a beginner level, the main idea is simple:
When code changes, a server can automatically run tests, build the project, or even deploy it.
GitHub provides an automation system for this called GitHub Actions.
What Is CI?
Continuous Integration (CI) means developers regularly integrate code changes while automated checks verify those changes.
For example, whenever someone pushes:
feature/loginor opens a Pull Request, GitHub may automatically do this:
Install dependencies → Run tests → Check code style → Build the project
If everything succeeds, the Pull Request may show:
All checks have passedIf something fails, it may show:
Some checks were not successfulThis lets reviewers know whether the new code passes the project's automated checks before it is merged.
What Is CD?
CD is usually related to releasing or deploying software. Depending on the team, it may mean Continuous Delivery or Continuous Deployment.
For a beginner, a simple interpretation is enough:
Once the code passes its checks, the next steps toward release or deployment can also be automated.
For example:
Merge code into main → Run tests automatically → Build automatically → Deploy the website automatically
A web project may therefore publish a new version whenever changes are merged into main, without someone manually copying files to a server each time.
What Is GitHub Actions?
GitHub Actions is GitHub's automation system.
It uses configuration files called workflows to define when an automation should run and what it should do.
Workflow files are normally stored under:
.github/workflows/For example:
.github/
workflows/
ci.yml
They are usually written in YAML.
A very small workflow might look like this:
name: CI
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "Run tests here"At this stage, you do not need to memorize the YAML syntax.
The important idea is that a workflow describes:
When to run
+
Where to run
+
What commands to runWhen Does a Workflow Run?
GitHub Actions can respond to many events.
Common triggers include:
Push
Pull Request
Manual startA workflow might say:
Every push → run tests
or:
Every Pull Request update → run tests
A typical workflow therefore looks like:
Push branch → Open Pull Request → GitHub Actions starts → Tests → Build → Lint → Pass → Merge
This is one of the most common examples of CI in everyday GitHub development.
Common Automated Tasks
Different projects run different checks.
A Python project might run:
pytestA JavaScript project might run:
npm testor:
npm run buildA project may also use a linter, which automatically checks code style and certain common mistakes.
A workflow might therefore perform:
Install dependencies → Lint → Unit tests → Build
If any step fails, the check can be marked as failed.
Why Is CI Useful?
Suppose a project has 20 developers. If everyone must remember to manually run exactly the same commands before every Pull Request, someone will eventually forget.
GitHub Actions makes the process automatic.
Whether the push comes from:
Alice
Bob
Christhe same workflow can run every time.
This gives the team a consistent set of checks for every contribution.
What If CI Fails?
Suppose your Pull Request shows:
1 failing checkYou usually should not simply ignore it and merge.
Open the failed GitHub Actions job and inspect the logs.
You may see something like:
Test failed:
Expected 200
Received 500This tells you that a test failed.
Return to your branch:
git switch feature/loginfix the problem, then:
git add .
git commit -m "Fix failing login test"
git pushGitHub Actions will normally run again automatically.
If the new code passes, the check will turn successful.
KNOWLEDGE QUIZ
How Does CI/CD Relate to Git?
Git itself does not provide CI/CD.
Git handles things such as:
Commits
Branches
Merges
HistoryGitHub Actions reacts to Git-related events on GitHub and runs automated tasks.
For example:
Git push → GitHub receives new commits → GitHub Actions starts → Tests run
Git and CI/CD are separate concepts, but they are commonly used together in modern software development.
Practice
A PR's Actions log shows a failure in login.test.js during npm test. Write the concrete steps from reading the log and reproducing locally through fixing, verifying, and updating the PR.