Interview Prep/Real-World Interview/Write-a-pipeline tasks

Write a matrix job that tests on Python 3.10, 3.11 and 3.12 on Linux and Windows.

BeginnerHands-onWrite-a-pipeline tasks
Answer
jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]
        python: ["3.10", "3.11", "3.12"]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python }}
          cache: pip
      - run: pip install -r requirements.txt
      - run: pytest -q

Key trick → Quote "3.10", because YAML reads an unquoted 3.10 as the float 3.1. fail-fast: false lets the other jobs finish so you see every failing combination.

All Real-World Interview questions Roadmap: Interview readiness

More on Write-a-pipeline tasks