GitHub Actions Workflow Generator · Tutorial

How to test a Python project on several versions and systems

7 min readintermediateUpdated

Your library should work for users on different Python versions and operating systems. You will set up a matrix that runs nine combinations in parallel, and a weekly scheduled run that catches breakage from new dependency releases.

What you need

Steps

  1. Load the matrix example

    It tests Python 3.11, 3.12 and 3.13 on Linux, Windows and macOS: nine jobs in parallel.

  2. Check the version quoting

    In the generated YAML the versions appear as '3.11' in quotes. Without quotes, YAML reads 3.10 as the number 3.1, a classic mistake.

    matrix:
      os: [ubuntu-latest, windows-latest, macos-latest]
      python-version: ['3.11', '3.12', '3.13']
  3. Add a weekly run

    The schedule 0 6 * * 1 runs every Monday at 06:00 UTC, even when nobody pushes, so you find out when a new release of a dependency breaks your tests.

  4. Let all jobs finish

    fail-fast: false keeps the other jobs running when one fails, so you see whether a problem affects one system or all of them.

Try it yourself

Opens the GitHub Actions Workflow Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Paths that only work on Linux
Windows jobs fail on hard-coded / paths or shell commands like rm. Use pathlib in tests.
Testing every combination forever
macOS runners use more of your minutes on private repositories. Test the oldest and newest Python on macOS if minutes are tight.

Next steps

Go back to the GitHub Actions Workflow Generator, or keep going with one of these: