🎓 A1Learner
🔍
0 of 50 lessons completed

GitHub Actions: Runners

A runner is the machine that runs a job. GitHub provides fresh runners with common tools already installed.

A Linux runner

Most workflows start here. It is the common choice.

runs-on: ubuntu-latest

A Windows runner

Use this when the code must also work on Windows.

runs-on: windows-latest

A macOS runner

Use this when the code must also work on macOS.

runs-on: macos-latest

Two jobs, two runners

Each job names its own runner. The jobs run at the same time.

jobs:
  test-ubuntu:
    runs-on: ubuntu-latest
  test-windows:
    runs-on: windows-latest

Example

name: Runners
on: push
jobs:
  test-ubuntu:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: '24'
      - run: npm test
  test-windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: '24'
      - run: npm test

Key points

  • Use ubuntu-latest for a Linux runner.
  • Use windows-latest for a Windows runner.
  • Use macos-latest for a macOS runner.
  • Each job runs on a fresh runner, so jobs do not share files.
  • A runner comes with Node, Python, and git already installed.
  • Pick the runner that matches the system the code must work on.

In this example, the workflow is saved as .github/workflows/runners.yml. It has two jobs, not one. The first runs on the latest Ubuntu runner and the second on the latest Windows runner. Both jobs run the same three steps: fetch the code, set up Node 24, and run the tests. The output shows both tests passing on both runners.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

Which runs-on value picks a Windows runner?