Skip to content

Commit 4d35707

Browse files
committed
[build] Use isolated venv for smoke tests
1 parent 11053e4 commit 4d35707

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,28 @@ jobs:
8282
echo "scenedetect_version=`python -c \"import scenedetect; print(scenedetect.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
8383
8484
- name: Smoke Test Package (Source Dist)
85+
shell: bash
8586
run: |
86-
python -m pip install dist/scenedetect-${{ env.scenedetect_version }}.tar.gz
87+
python -m venv .smoke-sdist
88+
VENV_BIN=.smoke-sdist/bin
89+
[ -d .smoke-sdist/Scripts ] && VENV_BIN=.smoke-sdist/Scripts
90+
source "$VENV_BIN/activate"
91+
pip install "dist/scenedetect-${{ env.scenedetect_version }}.tar.gz[pyav]" --only-binary av
8792
scenedetect version
8893
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
8994
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
90-
python -m pip uninstall -y scenedetect
9195
9296
- name: Smoke Test Package (Wheel)
97+
shell: bash
9398
run: |
94-
python -m pip install dist/scenedetect-${{ env.scenedetect_version }}-py3-none-any.whl
99+
python -m venv .smoke-wheel
100+
VENV_BIN=.smoke-wheel/bin
101+
[ -d .smoke-wheel/Scripts ] && VENV_BIN=.smoke-wheel/Scripts
102+
source "$VENV_BIN/activate"
103+
pip install "dist/scenedetect-${{ env.scenedetect_version }}-py3-none-any.whl[pyav]" --only-binary av
95104
scenedetect version
96105
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
97106
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
98-
python -m pip uninstall -y scenedetect
99107
100108
- name: Build Package (Headless)
101109
shell: bash
@@ -105,15 +113,19 @@ jobs:
105113
git checkout pyproject.toml
106114
107115
- name: Smoke Test Package (Headless Wheel)
116+
shell: bash
108117
run: |
109-
python -m pip install dist/scenedetect_headless-${{ env.scenedetect_version }}-py3-none-any.whl
118+
python -m venv .smoke-headless
119+
VENV_BIN=.smoke-headless/bin
120+
[ -d .smoke-headless/Scripts ] && VENV_BIN=.smoke-headless/Scripts
121+
source "$VENV_BIN/activate"
122+
pip install "dist/scenedetect_headless-${{ env.scenedetect_version }}-py3-none-any.whl[pyav]" --only-binary av
110123
# Confirm the install pulled `opencv-python-headless`, not the GUI variant.
111124
# If both are present, cv2 imports may silently come from either.
112125
python -c "import importlib.metadata as m; ds = sorted(d.metadata['Name'] for d in m.distributions() if d.metadata['Name'] in ('opencv-python', 'opencv-python-headless')); assert ds == ['opencv-python-headless'], f'Expected only opencv-python-headless, got: {ds}'"
113126
scenedetect version
114127
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
115128
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
116-
python -m pip uninstall -y scenedetect-headless
117129
118130
- name: Upload Package
119131
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}

0 commit comments

Comments
 (0)