
Continuous integration (CI) puts an end to "but it works on my machine": every time someone pushes code, an automated system checks out the project on a clean computer, installs its dependencies, builds it and runs the tests. If anything fails, the team knows within minutes. This guide walks you through a first pipeline with GitHub Actions, which is built into GitHub and free for public repositories.
A pipeline is a sequence of automated steps triggered by an event, usually a push or a pull request. A typical one looks like this:
CI is often paired with continuous delivery or deployment (CD), which automatically releases every build that passes. Start with CI; deployment comes once you trust your tests.
The term "continuous integration" was used by Grady Booch in 1991 and became popular in the late 1990s through Extreme Programming, which asked developers to merge their work several times a day instead of once every few weeks. Servers such as CruiseControl (2001) and Jenkins (originally Hudson) made the practice common, and hosted services followed. GitHub Actions appeared in 2018 and quickly became one of the most widely used CI systems because it lives where the code already is.
First make sure your project has automated tests and that one command runs them, such as npm test or pytest. Commit a lock file, such as package-lock.json, so CI installs the versions you tested with. If you are new to version control, start by learning how to use Git and GitHub, because every pipeline starts with a commit.
In GitHub Actions, a pipeline is called a workflow and is described in a YAML file in the folder .github/workflows, for example .github/workflows/ci.yml. Indent YAML with spaces, never tabs. A minimal workflow for a Node.js project contains these parts:
A step with uses runs a ready-made action from the Marketplace; a step with run runs a shell command. Commit the file and push it. The Actions tab of your repository shows it running, with a live log for each step.
The real value of CI appears in pull requests: GitHub shows the check results before anyone merges. To test several environments at once, add a matrix to the job, for example node-version: [22, 24], or a list of operating systems. GitHub then runs one copy of the job for each combination in parallel.
To avoid duplicate runs, many teams limit the push trigger to main with branches: [main].
Aim for a pipeline that finishes in under ten minutes.
CI only helps if people respect its results. In the repository settings, create a branch protection rule or ruleset for main that requires pull requests and requires your CI checks to pass before merging. Broken code then cannot reach main by accident. When a build fails, read the log from the first error, reproduce it locally and fix it first.
Never write passwords or API keys into a workflow file. Store them under Settings > Secrets and variables > Actions and refer to them as ${{ secrets.API_KEY }}; GitHub hides their values in logs and does not pass them to pull requests from forks. Give the workflow only the access it needs with permissions: contents: read. Third-party actions run code in your pipeline, so prefer well-known ones pinned to a full commit hash.
The same ideas apply to every CI system. GitLab CI/CD uses a .gitlab-ci.yml file, Jenkins is a self-hosted server configured with a Jenkinsfile, and CircleCI, Azure Pipelines and Bitbucket Pipelines follow the same pattern of triggers, jobs and steps. Once CI is reliable, the natural next step is to deploy a website or application automatically when the main branch passes, turning your pipeline into full CI/CD.
Grade 10 Math: Functions and Reasoning - Quiz
1170 questions