AI Hints
Home›CI/CD with GitHub Actions Tutorial›Events, Jobs and Steps
CI/CD with GitHub Actions · Lesson 20 of 138

Jobs and runs-on

Machines for your work.

⏱ 2 min read▶ Video at 22:44🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

A job is a group of steps that run together, on one machine. Each job gets a brand new runner, completely clean. Nothing is left over from the last run, which makes results repeatable.

Jobs and runs-on
From the video: Jobs and runs-on
  • A group of steps
  • One machine each
  • Fresh every time

Two jobs

Each job has an i d, like lint and test, which is how other parts of the workflow refer to it. Name is the friendlier title shown on GitHub. Runs on picks the machine. Ubuntu latest is the most common, but Windows and Mac OS runners exist too. By default, jobs run at the same time, in parallel.

jobs.ymlyaml
jobs:
  lint:
    name: Check style
    runs-on: ubuntu-latest
    steps:
      - run: echo "linting"
  test:
    name: Run tests
    runs-on: ubuntu-latest
    steps:
      - run: echo "testing"

Both jobs, locally

Our run steps helper runs the jobs one after another, but on GitHub, these two would run at the same time, on two separate machines. Each job has its own section in the log, and its own result.

Terminal
run-steps .github/workflows/jobs.yml
Workflow: Two jobs  (event: push, branch: main)
Job: Check style
  ✓ Run echo "linting"
      linting
  Job succeeded
Job: Run tests
  ✓ Run echo "testing"
      testing
  Job succeeded

Summary

Jobs are groups of steps on a fresh runner, and they run in parallel by default. Runs on picks the machine. Next, steps that run commands.

Key takeaways
  • jobs: id → steps
  • runs-on: ubuntu-latest
  • Parallel by default
Next up: Steps with run — shell commands