CICD-038 · Exclude an incompatible combination
Encyclopedia · Matrices and sharding · All snippets
Previous · CICD-037 · Next · CICD-039
1. Where it fits
- Placement .github/workflows/ci.yml, inside the relevant job.
- Prerequisites workspace whose runtime dependencies match the chosen target combinations.
- Platforms github-actions, gitea-actions.
2. Copy the snippet
yaml
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.11", "3.12"]
exclude:
- {os: windows-latest, python: "3.11"}3. How it works
The Cartesian product starts with four combinations. exclude removes the matching Windows and Python 3.11 tuple, leaving three.
The exclude rule removes one combination from the test matrix.
flowchart TD
N1["OS and Python arrays"]
N2["Four combinations"]
N1 --> N2
N3{"Windows with 3.11"}
N2 --> N3
N4["Exclude row"]
N3 -->|Yes| N4
N5["Queue remaining rows"]
N3 -->|No| N5
classDef trigger fill:#EFF6FF,stroke:#0540F2,color:#0A0A0A
classDef build fill:#CCFBF1,stroke:#0D9488,color:#0A0A0A
classDef test fill:#EEF2FF,stroke:#4F46E5,color:#0A0A0A
classDef gate fill:#FEF3C7,stroke:#D97706,color:#0A0A0A
classDef security fill:#EDE9FE,stroke:#7C3AED,color:#0A0A0A
classDef deploy fill:#D1FAE5,stroke:#059669,color:#0A0A0A
classDef fail fill:#FEE2E2,stroke:#DC2626,color:#0A0A0A
class N1 trigger
class N2 build
class N3 gate
class N4 fail
class N5 test
4. Verify the result
The matrix yields three jobs. Explain the omitted compatibility combination in the repository.
Validation syntax-validated (YAML parse). Status definitions.