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.
More on Write-a-pipeline tasks
Write a GitHub Actions workflow that runs tests on every PR and push to main.BeginnerWrite a workflow that builds a Docker image and pushes it to ECR using OIDC (no access keys).IntermediateWrite a declarative Jenkinsfile with build, test, Docker push and a manual approval before prod.AdvancedWrite a GitHub Actions deploy job that requires approval for production using environments.BeginnerWrite a reusable workflow and call it from another repo.IntermediateWrite a workflow that only runs the backend job when files under `backend/` change.Intermediate