Skip to content

Commit 81d83fb

Browse files
committed
Move contrib CI into tox
1 parent a9481fa commit 81d83fb

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

.github/workflows/contrib-tests.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- tests/integration/data/**
1111
- pyproject.toml
1212
- poetry.lock
13+
- tox.ini
1314
- .github/workflows/contrib-tests.yml
1415
pull_request:
1516
types: [opened, synchronize]
@@ -21,6 +22,7 @@ on:
2122
- tests/integration/data/**
2223
- pyproject.toml
2324
- poetry.lock
25+
- tox.ini
2426
- .github/workflows/contrib-tests.yml
2527

2628
concurrency:
@@ -128,44 +130,36 @@ jobs:
128130
with:
129131
poetry-version: "2.3.1"
130132

131-
- name: Configure poetry
132-
run: poetry config virtualenvs.in-project true
133-
134133
- name: Set up cache
135134
uses: actions/cache@v5
136135
id: cache
137136
with:
138137
path: |
139138
~/.cache/pypoetry
140139
~/.cache/pip
141-
key: deps-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ matrix.target.label }}-${{ hashFiles('**/poetry.lock') }}
140+
key: deps-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ matrix.target.label }}-${{ hashFiles('**/poetry.lock', 'tox.ini') }}
142141
restore-keys: |
143142
deps-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ matrix.target.label }}-
144143
deps-${{ runner.os }}-${{ matrix.python-version }}-
145144
146-
- name: Install dependencies
147-
run: poetry install --extras "${{ matrix.target.contrib }}"
148-
149-
- name: Install framework variant
150-
if: matrix.target.spec != ''
151-
run: poetry run pip install --upgrade --force-reinstall --no-cache-dir "${{ matrix.target.contrib }}${{ matrix.target.spec }}"
145+
- name: Install tox
146+
run: python -m pip install tox
152147

153-
- name: Validate environment
154-
run: |
155-
poetry run python -m pip check
156-
poetry run python -c "import importlib; name='${{ matrix.target.contrib }}'; mod = importlib.import_module(name); print(name, getattr(mod, '__version__', 'unknown'))"
157-
158-
- name: Test
148+
- name: Build tox test paths
159149
shell: bash
160-
env:
161-
PYTEST_ADDOPTS: "--color=yes"
162150
run: |
163151
paths=("${{ matrix.target.integration_path }}")
164152
unit_path="${{ matrix.target.unit_path }}"
165153
if [ -d "$unit_path" ]; then
166154
paths+=("$unit_path")
167155
fi
168-
poetry run pytest "${paths[@]}"
156+
printf "CONTRIB_PATHS=%s\n" "${paths[*]}" >> "$GITHUB_ENV"
157+
158+
- name: Test
159+
env:
160+
CONTRIB_PACKAGE: ${{ matrix.target.contrib }}
161+
CONTRIB_SPEC: ${{ matrix.target.spec }}
162+
run: tox -e contrib
169163

170164
- name: Upload coverage
171165
uses: codecov/codecov-action@v5

tox.ini

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tox]
2+
min_version = 4.21
3+
env_list = contrib
4+
isolated_build = true
5+
skip_missing_interpreters = false
6+
7+
[testenv:contrib]
8+
description = Run contrib integration and unit tests for selected framework range.
9+
package = skip
10+
allowlist_externals = poetry
11+
set_env =
12+
PYTEST_ADDOPTS = --color=yes
13+
pass_env =
14+
CONTRIB_PACKAGE
15+
CONTRIB_SPEC
16+
CONTRIB_PATHS
17+
commands_pre =
18+
poetry install --all-extras --with dev --no-interaction
19+
python -m pip install --upgrade --force-reinstall --no-cache-dir {env:CONTRIB_PACKAGE}{env:CONTRIB_SPEC:}
20+
python -m pip check
21+
python -c "import importlib, os; name=os.environ['CONTRIB_PACKAGE']; mod=importlib.import_module(name); print(name, getattr(mod, '__version__', 'unknown'))"
22+
commands =
23+
python -m pytest {env:CONTRIB_PATHS}

0 commit comments

Comments
 (0)