Skip to content

Python Distribution #97

Python Distribution

Python Distribution #97

Workflow file for this run

# Build Python Source/Wheel Distributions of DVR-Scan
name: Python Distribution
on:
pull_request:
paths:
- dist/**
- dvr_scan/**
- tests/**
push:
paths:
- dist/**
- dvr_scan/**
- tests/**
tags:
- v*-release
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, macos-13, ubuntu-20.04, ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Dependencies
# TODO: `setuptools` is pinned for the Python 3.7 builder and can be unpinned when removed.
run: |
python -m pip install --upgrade pip build wheel virtualenv setuptools==62.3.4
pip install opencv-python-headless opencv-contrib-python-headless --only-binary :all:
pip install -r requirements_headless.txt
- name: Unit Tests
run: |
python -m pytest tests/
- name: Build Package
run: |
python -m build
- name: Get Package Paths
if: ${{ matrix.python-version == '3.7' }}
shell: bash
run: |
echo "dvr_scan_sdist=dvr-scan-`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
echo "dvr_scan_whl=dvr_scan-`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
- name: Get Package Paths
if: ${{ matrix.python-version != '3.7' }}
shell: bash
run: |
echo "dvr_scan_sdist=dvr_scan-`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
echo "dvr_scan_whl=dvr_scan-`python -c \"import dvr_scan; print(dvr_scan.__version__.replace('-', '.'))\"`" >> "$GITHUB_ENV"
- name: Smoke Test Package (Source Dist)
run: |
python -m pip install dist/${{ env.dvr_scan_sdist }}.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 Package (Wheel)
run: |
python -m pip install dist/${{ env.dvr_scan_whl }}-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