Python Distribution #281
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build Python Source/Wheel Distributions of DVR-Scan | |
name: Python Distribution | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
paths: | |
- dist/** | |
- dvr_scan/** | |
- tests/** | |
push: | |
paths: | |
- dist/** | |
- dvr_scan/** | |
- tests/** | |
branches: | |
- main | |
- develop | |
- 'releases/**' | |
tags: | |
- v*-release | |
workflow_dispatch: | |
jobs: | |
build: | |
env: | |
# Set below after building the final package. | |
dvr_scan_version: "" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-13, macos-14, ubuntu-20.04, ubuntu-latest, windows-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
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 Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build wheel virtualenv | |
python -m pip install opencv-python-headless opencv-contrib-python-headless --only-binary :all: | |
python -m pip install -r requirements_headless.txt | |
- name: Unit Test | |
run: | | |
python -m pytest tests/ | |
- name: Build Package | |
shell: bash | |
run: | | |
python -m build | |
echo "dvr_scan_version=`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV" | |
- name: Smoke Test (Source) | |
run: | | |
python -m 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 | |
python -m pip uninstall -y dvr-scan | |
- name: Smoke Test (Wheel) | |
run: | | |
python -m 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 | |
python -m pip uninstall -y dvr-scan | |
- name: Upload Package | |
if: ${{ matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dvr-scan-dist | |
path: | | |
dist/*.tar.gz | |
dist/*.whl |