-
Notifications
You must be signed in to change notification settings - Fork 504
161 lines (146 loc) · 6.58 KB
/
Copy pathbuild.yml
File metadata and controls
161 lines (146 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Test PySceneDetect on Linux/OSX/Windows and generate Python distribution (sdist/wheel).
name: Python Distribution
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- packaging/**
- scripts/**
- scenedetect/**
- tests/**
- pyproject.toml
- .github/workflows/build.yml
- .github/actions/setup-ffmpeg/**
push:
paths:
- packaging/**
- scripts/**
- scenedetect/**
- tests/**
- pyproject.toml
- .github/workflows/build.yml
- .github/actions/setup-ffmpeg/**
branches:
- main
- 'releases/**'
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-latest, ubuntu-22.04, ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
env:
# Version is extracted below and used to find correct package install path.
scenedetect_version: ""
steps:
- uses: actions/checkout@v5
- name: Setup FFmpeg
uses: ./.github/actions/setup-ffmpeg
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip build wheel virtualenv setuptools
pip install -e .[dev] --only-binary av,opencv-python
- name: Checkout test resources
run: |
git fetch --depth=1 https://github.com/Breakthrough/PySceneDetect.git refs/heads/resources:refs/remotes/origin/resources
git checkout refs/remotes/origin/resources -- tests/resources/
# Instrumented while chasing a windows-latest flake where python exits 1 after a
# fully green pytest run with no output. `-X dev` makes shutdown-time warnings and
# finalizer errors loud; echoing the exit code separates python's own return value
# from anything the shell wrapper does to a crash code.
- name: Unit Tests
shell: bash
run: |
set +e
python -X dev -m pytest -vv
code=$?
echo "pytest exit code: $code"
exit $code
- name: Smoke Test (Module)
run: |
python -m scenedetect version
python -m scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
python -m scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
python -m pip uninstall -y scenedetect-core
- name: Build Package
shell: bash
run: |
# Builds the scenedetect/scenedetect-headless packages.
python packaging/build_all.py
echo "scenedetect_version=`python -c \"import scenedetect; print(scenedetect.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
- name: Smoke Test Package (Source Dist)
shell: bash
run: |
python -m venv .smoke-sdist
VENV_BIN=.smoke-sdist/bin
[ -d .smoke-sdist/Scripts ] && VENV_BIN=.smoke-sdist/Scripts
source "$VENV_BIN/activate"
pip install "dist/scenedetect-${{ env.scenedetect_version }}.tar.gz[pyav]" --only-binary av
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'], f'Expected only opencv-python, got: {ds}'"
scenedetect version
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
- name: Smoke Test Package (Wheel)
shell: bash
run: |
python -m venv .smoke-wheel
VENV_BIN=.smoke-wheel/bin
[ -d .smoke-wheel/Scripts ] && VENV_BIN=.smoke-wheel/Scripts
source "$VENV_BIN/activate"
pip install "dist/scenedetect-${{ env.scenedetect_version }}-py3-none-any.whl[pyav]" --only-binary av
scenedetect version
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
- name: Smoke Test Package (Headless Wheel)
shell: bash
run: |
python -m venv .smoke-headless
VENV_BIN=.smoke-headless/bin
[ -d .smoke-headless/Scripts ] && VENV_BIN=.smoke-headless/Scripts
source "$VENV_BIN/activate"
pip install "dist/scenedetect_headless-${{ env.scenedetect_version }}-py3-none-any.whl[pyav]" --only-binary av
# Confirm the install pulled `opencv-python-headless`, not the GUI variant.
# If both are present, cv2 imports may silently come from either.
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}'"
scenedetect version
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
- name: Smoke Test Package (Upgrade From 0.7)
shell: bash
run: |
# Both packages ship the code (no metapackage layering) precisely so that
# in-place upgrades from older installs keep working - a code-carrying dist
# flipped to a code-free metapackage would break here, since uninstalling the old
# version deletes module files a dependency just wrote. This is also why the
# short-lived scenedetect-core (published in 0.7.1 only) was yanked rather than
# layered on. Keep this as a regression guard for that failure mode
# (https://scenedetect.com/issues/558).
python -m venv .smoke-upgrade
VENV_BIN=.smoke-upgrade/bin
[ -d .smoke-upgrade/Scripts ] && VENV_BIN=.smoke-upgrade/Scripts
source "$VENV_BIN/activate"
pip install "scenedetect==0.7"
pip install --upgrade --find-links dist/ "scenedetect==${{ env.scenedetect_version }}"
python -c "import scenedetect; print(scenedetect.__version__)"
scenedetect version
- name: Upload Package
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v6
with:
name: scenedetect-dist
path: |
dist/*.tar.gz
dist/*.whl