1515 FORCE_COLOR : " 1"
1616
1717jobs :
18- run :
19- name : Python ${{ matrix.python-version }} on ${{ startsWith( matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
20- runs-on : ${{ matrix.os }}
21- timeout-minutes : 30
18+ test :
19+ name : Python ${{ matrix.python-version }} - ${{ matrix.cdist-group }}/3
20+ runs-on : ubuntu-latest
21+ timeout-minutes : 10
2222 strategy :
2323 fail-fast : false
2424 matrix :
25- os : [ubuntu-latest]
26- # os: [ubuntu-latest, windows-latest, macos-latest]
27- python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
25+ python-version : ["3.9", "3.10", "3.11", "3.12"]
26+ cdist-group : [1, 2, 3]
2827
2928 steps :
3029 - uses : actions/checkout@v4
3130
3231 - if : runner.os == 'Linux'
33- name : Install Microsoft ODBC Drivers & Free additional space
34- run : |
35- sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y || true
36- sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
37- sudo rm -rf \
38- /usr/share/dotnet /usr/local/lib/android /opt/ghc \
39- /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
40- /usr/lib/jvm || true
41- sudo apt-get autoremove -y \
42- && sudo apt-get clean -y \
43- && sudo rm -rf /root/.cache \
44- && sudo rm -rf /var/apt/lists/* \
45- && sudo rm -rf /var/cache/apt/* \
46- && sudo apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
32+ name : Install Microsoft ODBC Drivers
33+ run : sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 libmariadb-dev
4734
4835 - name : Set up Python ${{ matrix.python-version }}
4936 uses : actions/setup-python@v5
5037 with :
5138 python-version : ${{ matrix.python-version }}
5239
53- - name : Install Hatch
54- run : pip install --upgrade hatch hatch-pip-compile
40+ - name : Install uv
41+ uses : astral-sh/setup-uv@v5
5542
56- - if : matrix.python-version == '3.12' && runner.os == 'Linux'
57- name : Lint
58- run : hatch run lint:check
43+ - name : Intall dependencies
44+ run : uv sync --frozen
5945
6046 - if : matrix.python-version == '3.12' && runner.os == 'Linux'
6147 name : Run tests with coverage tracking
62- run : hatch run +py =${{ matrix.python-version }} test:cov
48+ run : uv run pytest --cdist-group =${{ matrix.cdist-group }}/3 -k "not elasticsearch"
6349
6450 - if : matrix.python-version != '3.12' || runner.os != 'Linux'
6551 name : Run tests without tracking coverage
66- run : hatch run +py =${{ matrix.python-version }} test:no-cov
52+ run : uv run pytest --cdist-group =${{ matrix.cdist-group }}/3 -k "not elasticsearch"
6753
6854 - if : matrix.python-version == '3.12' && runner.os == 'Linux'
6955 uses : actions/upload-artifact@v4
7763 with :
7864 token : ${{ secrets.CODECOV_TOKEN }}
7965 slug : litestar-org/pytest-databases
66+
67+ # run elasticsearch in a separate step. it's too slow
68+ test_elasticsearch :
69+ runs-on : ubuntu-latest
70+ steps :
71+ - uses : actions/checkout@v4
72+
73+ - name : Set up Python
74+ uses : actions/setup-python@v5
75+ with :
76+ python-version : 3.9
77+
78+ - name : Install uv
79+ uses : astral-sh/setup-uv@v5
80+
81+ - name : Intall dependencies
82+ run : uv sync --frozen
83+
84+ - name : Run tests with coverage tracking
85+ run : uv run pytest -k elasticsearch
86+
8087 sonar :
8188 needs :
82- - run
89+ - test
90+ - test_elasticsearch
8391 if : github.event.pull_request.head.repo.fork == false && github.repository_owner == 'litestar-org'
8492 runs-on : ubuntu-latest
8593 steps :
@@ -100,49 +108,3 @@ jobs:
100108 env :
101109 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
102110 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
103- codeql :
104- needs :
105- - run
106- runs-on : ubuntu-latest
107- permissions :
108- security-events : write
109- steps :
110- - name : Checkout repository
111- uses : actions/checkout@v4
112-
113- - name : Initialize CodeQL Without Dependencies
114- uses : github/codeql-action/init@v3
115-
116- - name : Perform CodeQL Analysis
117- uses : github/codeql-action/analyze@v3
118-
119- build-docs :
120- if : github.event_name == 'pull_request'
121- runs-on : ubuntu-latest
122- steps :
123- - name : Check out repository
124- uses : actions/checkout@v4
125-
126- - name : Set up Python
127- uses : actions/setup-python@v5
128- with :
129- python-version : " 3.11"
130-
131- - name : Install Hatch
132- run : pip install --upgrade hatch hatch-containers hatch-pip-compile
133-
134- - name : Build docs
135- run : hatch run docs:build
136-
137- - name : Save PR number
138- env :
139- PR_NUMBER : ${{ github.event.number }}
140- run : echo $PR_NUMBER > .pr_number
141-
142- - name : Upload artifact
143- uses : actions/upload-artifact@v4
144- with :
145- name : docs-preview
146- path : |
147- docs/_build/html
148- .pr_number
0 commit comments