Course contentsShow
← Cloud and Infrastructure
Lesson 1695 of 2,98935. GitHub ActionsFree lesson

Basic Workflow Example: CI Pipeline

Building a simple continuous integration workflow that checks out code, installs dependencies, and runs tests.

Basic Workflow Example: CI Pipeline

You'll learn how to build your first continuous integration workflow in GitHub Actions that automatically checks out code, installs dependencies, and runs tests whenever code changes.

The Core Idea

A CI pipeline workflow is like an automated quality control assembly line for your code. When you push changes to GitHub, the workflow springs into action: it grabs your code, sets up the environment, installs what's needed, and runs tests—all without you lifting a finger. This catches bugs early and ensures every change meets your quality standards.

Building the Pipeline

Here's a simple CI workflow that demonstrates the fundamental pattern:

name: CI Pipeline

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      
      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
      
      - name: Install dependencies
        run: npm ci
      
      - name: Run tests
        run: npm test

This workflow triggers on pushes and pull requests to the main branch. The test job runs on a GitHub-hosted Ubuntu runner and executes four sequential steps: checking out your repository code, setting up Node.js, installing dependencies with npm ci, and running your test suite.

Why This Pattern Works

This basic structure is the foundation of professional CI pipelines. The steps flow naturally—you can't run tests without dependencies, and you can't install dependencies without code. Each step validates the previous one succeeded before continuing.

Key Takeaway: A basic CI pipeline workflow automates the repetitive tasks of checking out code, preparing the environment, and validating changes through tests—providing fast, consistent feedback on every code change.