Manuals / CI/CD Pipelines / Chapter 3

A · Foundations · beginner · Week 1–2 · Chapter 3 of 12

First GitHub Actions workflow

YAML workflow: on trigger, jobs, steps, runs-on. Install, test, fail loud on red.

Path progress
19%

Step 1 of 4

Hello workflow

on: push, jobs.test, runs-on: ubuntu-latest, steps: checkout, setup, run tests.

Hello workflowDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Hello workflowdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
      - run: npm ci
      - run: npm test

Do this now

Add .github/workflows/ci.yml. Push. See green check on commit.

Was this step clear?
Chapter learning outcomes
  • Workflow structure
  • Triggers
  • Jobs and steps
  • Action marketplace

Clear these before you leave

Side quest

Matrix awareness

Read docs on strategy.matrix. Sketch Node 18 + 20 matrix — optional implement.