Debian Codegraph @

.github/workflows/main.yml

raw symbols SCIP
1 # .github/workflows/main-ci.yml
2 # Main CI workflow: orchestrates linting, documentation, and tests.
3
4 name: CI Checks and Tests
5
6 on:
7 push:
8 pull_request:
9 branches:
10 - develop
11
12 env:
13 FORCE_COLOR: 1 # Ensures colored output for tools that support it.
14
15 permissions:
16 contents: read # Required to checkout the repository.
17 pull-requests: write # For actions that might comment on PRs (e.g., repo-review if configured, or future coverage).
18 # Add other permissions if specific actions require them (e.g., id-token: write for OIDC).
19
20 concurrency:
21 group: ${{ github.workflow }}-${{ github.ref }}
22 cancel-in-progress: true
23
24 jobs:
25 # Job: Call the reusable linting and documentation workflow.
26 linting_and_documentation:
27 name: Lint, Docs, & Repo Review
28 uses: ./.github/workflows/lint.yml
29 secrets: inherit # Pass down secrets like GITHUB_TOKEN if needed by the callable workflow.
30
31 # Job: Generate the test matrix for different OS and Python versions.
32 generate_test_matrix:
33 name: Generate Test Matrix
34 runs-on: ubuntu-latest
35 outputs:
36 matrix: ${{ steps.generate-matrix.outputs.matrix }}
37 steps:
38 - name: Generate Matrix for Tests
39 id: generate-matrix
40 uses: coactions/dynamic-matrix@v3
41 with:
42 platforms: 'linux,macos,windows'
43 min_python: '3.9'
44 linux: full
45 windows: full
46 macos: full
47
48 # Job: Perform static type checking across the generated matrix.
49 type_checking:
50 name: Type py${{ matrix.python_version }}, ${{ matrix.os }})
51 needs: generate_test_matrix
52 runs-on: ${{ matrix.os || 'ubuntu-latest' }}
53 timeout-minutes: 10
54
55 strategy:
56 fail-fast: false
57 matrix: ${{ fromJSON(needs.generate_test_matrix.outputs.matrix) }}
58
59 steps:
60 - name: Checkout repository
61 uses: actions/checkout@v4
62 with:
63 fetch-depth: 1
64
65 - name: Setup Python Environment & Install Dependencies
66 uses: ./.github/actions/setup-python-uv # Reusable composite action
67 with:
68 python-version: ${{ matrix.python_version }}
69
70 - name: Run pyright
71 run: pyright
72
73 - name: Run mypy
74 run: |
75 mypy --cache-dir=/dev/null .
76
77 # Job: Run pytest tests across the generated matrix.
78 tests:
79 name: test py${{ matrix.python_version }}, ${{ matrix.os }})
80 needs: generate_test_matrix
81 runs-on: ${{ matrix.os || 'ubuntu-latest' }}
82 timeout-minutes: 15
83
84 strategy:
85 fail-fast: false
86 matrix: ${{ fromJSON(needs.generate_test_matrix.outputs.matrix) }}
87
88 steps:
89 - name: Checkout repository
90 uses: actions/checkout@v4
91 with:
92 fetch-depth: 1
93
94 - name: Setup Python Environment & Install Dependencies
95 uses: ./.github/actions/setup-python-uv
96 with:
97 python-version: ${{ matrix.python_version }}
98
99 - name: Start Redis (if applicable)
100 uses: supercharge/[email protected]
101 with:
102 redis-version: 'latest'
103 continue-on-error: true # Allow failure if Redis isn't critical or supported on all OS.
104
105 - name: Run pytest
106 run: |
107 pytest --junitxml=junit/test-results-${{ matrix.os }}-py${{ matrix.python_version }}.xml
108
109 - name: Upload pytest test results
110 if: ${{ always() }} # Ensure results are uploaded even if tests fail.
111 uses: actions/upload-artifact@v4
112 with:
113 name: pytest-results-${{ matrix.os }}-py${{ matrix.python_version }}
114 path: junit/test-results-${{ matrix.os }}-py${{ matrix.python_version }}.xml
115 retention-days: 7