Skip to content

Commit c5d9e93

Browse files
fix(ci): prevent concurrent PyMongo test interference
- Add pymongo-version to test matrix to isolate test runs - Run one Python × MongoDB × PyMongo combination per job - Change from tox run-parallel to single tox run per job - Update cache key to include PyMongo version This prevents transaction/lock conflicts that occurred when multiple PyMongo versions ran concurrently against the same MongoDB instance. Matrix: 5 Python × 6 MongoDB × 4 PyMongo = 120 jobs
1 parent 82d2cf6 commit c5d9e93

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

.github/workflows/github-actions.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
matrix:
4646
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
4747
mongodb-version: [ "4.4", "5.0", "6.0", "7.0", "8.0", "8.3" ]
48+
pymongo-version: [ "414", "415", "416", "417" ]
4849
steps:
4950
- uses: actions/checkout@v6
5051
- name: Install uv and set the Python version ${{ matrix.python-version }}
@@ -62,20 +63,16 @@ jobs:
6263
uses: actions/cache@v4
6364
with:
6465
path: .tox
65-
key: tox-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
66+
key: tox-${{ matrix.python-version }}-mg${{ matrix.pymongo-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
6667
restore-keys: |
67-
tox-${{ matrix.python-version }}-
68+
tox-${{ matrix.python-version }}-mg${{ matrix.pymongo-version }}-
6869
- name: Install Dependencies
6970
run: uv sync --only-group test
7071
- name: Run test suite
7172
run: |
72-
envs="$(uv run tox -a | grep py$(echo "${{ matrix.python-version }}" | tr -d . ) | tr '\n' ',' | sed 's/,$//' || true)"
73-
if [ -z "$envs" ]; then
74-
echo "Error: No matching tox envs found" >&2
75-
exit 1
76-
fi
77-
echo "Running with: $envs"
78-
uv run tox run-parallel -e "$envs" -- "--cov=mongoengine --cov-report="
73+
env="py$(echo "${{ matrix.python-version }}" | tr -d . )-mg${{ matrix.pymongo-version }}"
74+
echo "Running tox environment: $env"
75+
uv run tox run -e "$env" -- "--cov=mongoengine --cov-report="
7976
uv run coverage combine
8077
uv run coverage report
8178
# - name: Send coverage to Coveralls

0 commit comments

Comments
 (0)