You can use GitHub Actions matrix strategy to test your code against multiple Python or PyPy versions. You can also use the exclude keyword to skip specific combinations (e.g., skipping a specific Python version on a specific OS).
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', 'pypy3.9']
exclude:
- os: macos-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.9'
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}