Software engineering has evolved far beyond writing code locally. In modern engineering teams, every commit triggers automated testing, static security analysis, code linting, and cloud deployments. GitHub Actions is GitHub's built-in Continuous Integration and Continuous Delivery (CI/CD) platform.
.github/workflows/.push, pull_request, release, or scheduled schedule: cron).needs:) are specified.run: npm test) or pre-built reusable actions (uses: actions/checkout@v4).ubuntu-latest, windows-latest, macos-latest) to execute your jobs.Create a file at .github/workflows/ci.yml in your repository:
# .github/workflows/ci.yml
name: Continuous Integration
# 1. When should this workflow trigger?
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# 2. What jobs should execute?
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
# Step 1: Check out repository source code onto the VM
- name: Check out repository
uses: actions/checkout@v4
# Step 2: Install Node.js runtime environment
- name: Set up Node.js runtime
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
# Step 3: Install dependencies cleanly
- name: Install dependencies
run: npm ci
# Step 4: Run linter
- name: Run code linter
run: npm run lint
# Step 5: Execute automated unit test suite
- name: Run test suite
run: npm test
Once you commit and push this file to GitHub:
Strengthen your version control mastery by studying these connected classes:
Implement multi-job build, test, Docker containerization, and cloud deployment.
Configure workflows to run on pull_request events and block failing merges.
Block branch merges until all GitHub Actions workflows report success.
Understand defense-in-depth: linting locally with hooks + validating in CI.
Advance your software engineering skills with the next topic in our synchronized curriculum.
Continue to CI/CD Pipelines → Previous: ← Git Automation Hooks | Full Syllabus