Skip to content

Commit 56a5f26

Browse files
committed
fix test ci
1 parent 3eed37c commit 56a5f26

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

project_name/.github/workflows/ci.yml.jinja

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -67,58 +67,62 @@ jobs:
6767

6868
test:
6969
if: {% raw %}${{ always() }}{% endraw %}
70-
runs-on: ubuntu-latest
70+
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
7171
strategy:
7272
matrix:
7373
resolution:
74-
- "no-upgrade"
7574
- "highest"
76-
- "lowest"
75+
os:
76+
- ubuntu-latest
7777
python-version:
78-
{%- if python_min <= 9 %}
79-
- "3.9"
80-
{%- endif %}
81-
{%- if python_min <= 10 %}
82-
- "3.10"
83-
{%- endif %}
84-
{%- if python_min <= 11 %}
85-
- "3.11"
86-
{%- endif %}
87-
{%- if python_min <= 12 %}
88-
- "3.12"
89-
{%- endif %}
90-
{%- if python_min <= 13 %}
91-
- "3.13"
92-
{%- endif %}
93-
allow-failure: [false]
78+
{%- for version in range(python_min, python_max + 1) %}
79+
- "3.{{ version }}"
80+
{%- endfor %}
9481
include:
95-
# map resolution to resolution-args
96-
- resolution: "no-upgrade"
97-
resolution-args: "--no-upgrade"
98-
- resolution: "highest"
99-
resolution-args: "--upgrade --resolution highest"
82+
# test with lowest resolution
10083
- resolution: "lowest"
101-
resolution-args: "--upgrade --resolution lowest-direct"
102-
# add prerelease versions
84+
os: ubuntu-latest
85+
python-version: "3.{{ python_min }}"
86+
{%- if python_min != python_max %}
87+
- resolution: "lowest"
88+
os: ubuntu-latest
89+
python-version: "3.{{ python_max }}"
90+
{%- endif %}
91+
# test on os
92+
- resolution: "locked"
93+
os: ubuntu-latest
94+
python-version: "3.{{ python_min }}"
95+
- resolution: "locked"
96+
os: macos-latest
97+
python-version: "3.{{ python_min }}"
98+
- resolution: "locked"
99+
os: windows-latest
100+
python-version: "3.{{ python_min }}"
101+
# test on prerelease
103102
- resolution: "prerelease"
104-
resolution-args: "--upgrade --resolution highest --prerelease allow"
105-
python-version: "3.13"
106-
allow-failure: true
103+
os: ubuntu-latest
104+
python-version: "3.{{ python_max }}"
107105
- resolution: "prerelease"
108-
resolution-args: "--upgrade --resolution highest --prerelease allow"
109-
python-version: "3.14"
110-
allow-failure: true
111-
continue-on-error: {% raw %}${{ matrix.allow-failure }}{% endraw %}
112-
name: {% raw %}test-py${{ matrix.python-version }}-${{ matrix.resolution }}{% endraw %}
106+
os: ubuntu-latest
107+
python-version: "3.{{ python_max + 1 }}"
108+
continue-on-error: {% raw %}${{ matrix.resolution == 'prerelease' }}{% endraw %}
109+
name: {% raw %}test-py${{ matrix.python-version }}-${{ matrix.resolution }}-${{ matrix.os }}{% endraw %}
113110
steps:
114111
- uses: actions/checkout@v4
115-
with:
116-
fetch-depth: 0
117112
- uses: astral-sh/setup-uv@v5
118113
with:
119-
enable-cache: true
120114
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
121-
- name: Install the project
122-
run: uv sync --all-extras --group test {% raw %}${{ matrix.resolution-args }}{% endraw %}
115+
cache-suffix: {% raw %}${{ matrix.resolution }}{% endraw %}
123116
- name: Run tests
124-
run: uv run pytest
117+
run: >-
118+
uv run
119+
--all-extras
120+
--no-default-groups
121+
--group test
122+
--exact
123+
{% raw %}${{ matrix.resolution == 'locked' && '--locked' ||
124+
matrix.resolution == 'lowest' && '--upgrade --resolution lowest-direct' ||
125+
matrix.resolution == 'highest' && '--upgrade --resolution highest' ||
126+
matrix.resolution == 'prerelease' && '--upgrade --resolution highest --prerelease allow' ||
127+
'--NON_RECOGNIZED_RESOLUTION'
128+
}}{% endraw %} pytest

0 commit comments

Comments
 (0)