-
Notifications
You must be signed in to change notification settings - Fork 487
137 lines (122 loc) · 4.91 KB
/
build.yml
File metadata and controls
137 lines (122 loc) · 4.91 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
# 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*-release
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
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/
- name: Unit Tests
run: |
python -m pytest -vv
- 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
- name: Build Package
shell: bash
run: |
python -m build
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
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: Build Package (Headless)
shell: bash
run: |
python packaging/build_headless.py
python -m build
git checkout pyproject.toml
- 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: 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