Skip to content
YAML Workflows
step 1/5

Reading — step 1 of 5

Read

~1 min readWhat is CI?

YAML Workflows

Modern CI uses YAML for declarative pipelines. Example (.github/workflows/ci.yml):

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: pip install -r requirements.txt
      - run: pytest

Key concepts:

  • Workflow: top-level file. Triggers on events.
  • Jobs: parallel units. Each runs on a fresh runner (VM or container).
  • Steps: sequential within a job. Either run: <shell> or uses: <action>.
  • Actions: reusable units (checkout, setup-X, deploy-Y) — community packages.

Triggers (on:):

  • push, pull_request, release
  • schedule: [{cron: "0 0 * * *"}]
  • workflow_dispatch (manual)
  • repository_dispatch (API-triggered)

Conditional execution:

- run: deploy.sh
  if: github.ref == 'refs/heads/main'

Matrix builds:

strategy:
  matrix:
    python-version: ['3.10', '3.11', '3.12']
    os: [ubuntu-latest, macos-latest, windows-latest]

That spawns 9 parallel jobs (3×3). Useful for cross-platform / cross-version testing.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…