Skip to content

Commit d148dc0

Browse files
committed
Fix CI venv setup collision and log existing paths
The venv matrix failed on both Windows and Linux when .venv was already occupied. Give the venv test interpreter a distinct path and log .venv state around setup so the producer of the collision can be identified in the next CI run.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f8234b6 commit d148dc0

2 files changed

Lines changed: 36 additions & 9 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,12 @@ jobs:
290290
shell: pwsh
291291
if: matrix.test-suite == 'venv'
292292
run: |
293+
Write-Output '.venv before pipenv:'
294+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
293295
python -m pip install pipenv
294296
python -m pipenv run python ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} pipenvPath
297+
Write-Output '.venv after pipenv:'
298+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
295299
296300
- name: Prepare poetry for venv tests
297301
env:
@@ -302,6 +306,8 @@ jobs:
302306
python -m pip install poetry
303307
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
304308
poetry env use python
309+
Write-Output '.venv after poetry:'
310+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
305311
306312
- name: Prepare virtualenv for venv tests
307313
env:
@@ -325,11 +331,14 @@ jobs:
325331
shell: pwsh
326332
if: matrix.test-suite == 'venv' && startsWith(matrix.python, 3.)
327333
run: |
328-
python -m venv .venv
334+
Write-Output '.venv before venv creation:'
335+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
336+
python -m venv .ci-venv
337+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
329338
if ('${{ matrix.os }}' -match 'windows-latest') {
330-
& ".venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
339+
& "./.ci-venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
331340
} else {
332-
& ".venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
341+
& "./.ci-venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
333342
}
334343
335344
- name: Prepare conda for venv tests

‎.github/workflows/pr-check.yml‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,12 @@ jobs:
283283
shell: pwsh
284284
if: matrix.test-suite == 'venv'
285285
run: |
286+
Write-Output '.venv before pipenv:'
287+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
286288
python -m pip install pipenv
287289
python -m pipenv run python ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} pipenvPath
290+
Write-Output '.venv after pipenv:'
291+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
288292
289293
- name: Prepare poetry for venv tests
290294
env:
@@ -295,6 +299,8 @@ jobs:
295299
python -m pip install poetry
296300
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
297301
poetry env use python
302+
Write-Output '.venv after poetry:'
303+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
298304
299305
- name: Prepare virtualenv for venv tests
300306
env:
@@ -318,11 +324,14 @@ jobs:
318324
shell: pwsh
319325
if: matrix.test-suite == 'venv' && startsWith(matrix.python, 3.)
320326
run: |
321-
python -m venv .venv
327+
Write-Output '.venv before venv creation:'
328+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
329+
python -m venv .ci-venv
330+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
322331
if ('${{ matrix.os }}' -match 'windows-latest') {
323-
& ".venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
332+
& "./.ci-venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
324333
} else {
325-
& ".venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
334+
& "./.ci-venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
326335
}
327336
328337
- name: Prepare conda for venv tests
@@ -565,8 +574,12 @@ jobs:
565574
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
566575
shell: pwsh
567576
run: |
577+
Write-Output '.venv before pipenv:'
578+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
568579
python -m pip install pipenv
569580
python -m pipenv run python ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} pipenvPath
581+
Write-Output '.venv after pipenv:'
582+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
570583
571584
- name: Prepare poetry for venv tests
572585
env:
@@ -576,6 +589,8 @@ jobs:
576589
python -m pip install poetry
577590
Move-Item -Path ".\build\ci\pyproject.toml" -Destination .
578591
poetry env use python
592+
Write-Output '.venv after poetry:'
593+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
579594
580595
- name: Prepare virtualenv for venv tests
581596
env:
@@ -597,11 +612,14 @@ jobs:
597612
PYTHON_VIRTUAL_ENVS_LOCATION: './src/tmp/envPaths.json'
598613
shell: pwsh
599614
run: |
600-
python -m venv .venv
615+
Write-Output '.venv before venv creation:'
616+
Get-Item -Force .venv -ErrorAction SilentlyContinue | Format-List FullName,Mode,LinkType,Target,Length
617+
python -m venv .ci-venv
618+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
601619
if ('${{ matrix.os }}' -match 'windows-latest') {
602-
& ".venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
620+
& "./.ci-venv/Scripts/python.exe" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
603621
} else {
604-
& ".venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
622+
& "./.ci-venv/bin/python" ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} venvPath
605623
}
606624
607625
- name: Prepare conda for venv tests

0 commit comments

Comments
 (0)