-
Notifications
You must be signed in to change notification settings - Fork 63
126 lines (112 loc) · 3.99 KB
/
build.yml
File metadata and controls
126 lines (112 loc) · 3.99 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
# Build Python Source/Wheel Distributions of DVR-Scan
name: Python Distribution
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- dist/**
- dvr_scan/**
- tests/**
- pyproject.toml
- setup.py
- requirements*.txt
- uv.lock
push:
paths:
- dist/**
- dvr_scan/**
- tests/**
- pyproject.toml
- setup.py
- requirements*.txt
- uv.lock
branches:
- main
- release
- 'releases/**'
tags:
- v*-release
workflow_dispatch:
jobs:
build:
env:
# Set below after building the final package.
dvr_scan_version: ""
UV_SYSTEM_PYTHON: 1
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"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
version: "0.5.11"
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
uv pip install --upgrade build wheel virtualenv
# TODO: Figure out how to avoid installing the original OpenCV package.
uv pip install -e ".[dev]" -r docs/requirements.txt
# TODO(#257): Unpin OpenCV versions once we figure out why frame numbers are mismatching in tests.
# Use headless OpenCV variant on CI to reduce download size.
uv pip uninstall opencv-python opencv-contrib-python
uv pip install "opencv-contrib-python-headless<4.13" --only-binary :all:
- name: Setup FFmpeg
# TODO: This action currently does not work for non-x64 builders (e.g. macos-14):
# https://github.com/federicocarboni/setup-ffmpeg/issues/21
if: ${{ runner.arch == 'X64' }}
uses: ./.github/actions/setup-ffmpeg
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Unit Test
run: |
python -m pytest tests
- name: Build Package
shell: bash
run: |
python dist/pre_release.py
python -m build
echo "dvr_scan_version=`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
- name: Build Package (Headless)
shell: bash
run: |
python dist/build_headless.py
python -m build
git reset --hard HEAD
- name: Smoke Test (Source)
run: |
uv pip install dist/dvr_scan-${{ env.dvr_scan_version }}.tar.gz
python -m dvr_scan --version
python -m dvr_scan -i tests/resources/simple_movement.mp4 -so -df 4 -et 100
uv pip uninstall dvr-scan
uv pip install dist/dvr_scan_headless-${{ env.dvr_scan_version }}.tar.gz
python -m dvr_scan --version
python -m dvr_scan -i tests/resources/simple_movement.mp4 -so -df 4 -et 100
uv pip uninstall dvr-scan-headless
- name: Smoke Test (Wheel)
run: |
uv pip install dist/dvr_scan-${{ env.dvr_scan_version }}-py3-none-any.whl
python -m dvr_scan --version
python -m dvr_scan -i tests/resources/simple_movement.mp4 -so -df 4 -et 100
uv pip uninstall dvr-scan
uv pip install dist/dvr_scan_headless-${{ env.dvr_scan_version }}-py3-none-any.whl
python -m dvr_scan --version
python -m dvr_scan -i tests/resources/simple_movement.mp4 -so -df 4 -et 100
uv pip uninstall dvr-scan-headless
- name: Upload Package
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v4.6.0
with:
name: dvr-scan-dist
path: |
dist/*.tar.gz
dist/*.whl