bum version to 1.1.0 #52
Workflow file for this run
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
# On a push to any branch this workflow: | |
# - builds the Docker image, | |
# - build wheels for different Python versions, | |
# - installs the wheel for each Python version and runs the unit tests | |
# against newest and oldest versions of dependencies. | |
# On manual dispatch this workflow: | |
# - pushes the previously built Docker image to DockerHub with tag "dev". | |
name: ci and release | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
build_docker: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and export | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
tags: mv-extractor:local | |
outputs: type=docker,dest=/tmp/image.tar | |
cache-from: type=registry,ref=lubo1994/mv-extractor:buildcache | |
cache-to: type=registry,ref=lubo1994/mv-extractor:buildcache,mode=max | |
- name: Upload Docker image as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mv-extractor-docker-image | |
path: /tmp/image.tar | |
test_docker: | |
name: Run unit tests in Docker container (only for the Python version used in the Dockerfile command) | |
runs-on: ubuntu-latest | |
needs: | |
- build_docker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact containing Docker image | |
uses: actions/download-artifact@v4 | |
with: | |
name: mv-extractor-docker-image | |
path: /tmp | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/image.tar | |
- name: Run unit tests | |
run: | | |
docker run -v ${{ github.workspace }}:/home/video_cap \ | |
mv-extractor:local \ | |
python3.12 -m unittest discover -s tests -p "*tests.py" | |
build_and_test_wheels: | |
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build_docker | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
python: 39 | |
bitness: 64 | |
platform_id: manylinux_x86_64 | |
manylinux_image: mv-extractor:local | |
numpy_min_version: "numpy==1.19.3" | |
opencv_min_version: "opencv-python==4.4.0.46" | |
- os: ubuntu-latest | |
python: 310 | |
bitness: 64 | |
platform_id: manylinux_x86_64 | |
manylinux_image: mv-extractor:local | |
numpy_min_version: "numpy==1.21.2" | |
opencv_min_version: "opencv-python==4.5.4.60" | |
- os: ubuntu-latest | |
python: 311 | |
bitness: 64 | |
platform_id: manylinux_x86_64 | |
manylinux_image: mv-extractor:local | |
numpy_min_version: "numpy==1.23.3" | |
opencv_min_version: "opencv-python==4.7.0.72" | |
- os: ubuntu-latest | |
python: 312 | |
bitness: 64 | |
platform_id: manylinux_x86_64 | |
manylinux_image: mv-extractor:local | |
numpy_min_version: "numpy==1.26.0" | |
opencv_min_version: "opencv-python==4.9.0.80" | |
# opencv-python does not yet support Python 3.13 as of Oct 2024 | |
# - os: ubuntu-latest | |
# python: 313 | |
# bitness: 64 | |
# platform_id: manylinux_x86_64 | |
# manylinux_image: mv-extractor:local | |
# numpy_min_version: "numpy==2.1.0" | |
# opencv_min_version: "opencv-python==" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact containing Docker image | |
uses: actions/download-artifact@v4 | |
with: | |
name: mv-extractor-docker-image | |
path: /tmp | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/image.tar | |
- name: Build and test wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_PLATFORM: linux | |
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
# Disable building PyPy wheels on all platforms | |
CIBW_SKIP: pp* | |
CIBW_ARCHS: x86_64 | |
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} | |
#CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} | |
CIBW_BUILD_FRONTEND: build | |
CIBW_TEST_COMMAND: | | |
echo "Running unit tests" && \ | |
PROJECT_ROOT={project} python3 -m unittest discover -s {project}/tests -p "*tests.py" && \ | |
echo "Running unit tests against oldest supported versions of dependencies" && \ | |
python3 -m pip install ${{ matrix.numpy_min_version }} ${{ matrix.opencv_min_version }} && \ | |
PROJECT_ROOT={project} python3 -m unittest discover -s {project}/tests -p "*tests.py" | |
CIBW_BUILD_VERBOSITY: 1 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: python-wheel-${{ matrix.python }} | |
path: ./wheelhouse/*.whl | |
push_docker: | |
name: Push Docker image to DockerHub | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
needs: | |
- build_docker | |
- test_docker | |
- build_and_test_wheels | |
steps: | |
- name: Download artifact containing Docker image | |
uses: actions/download-artifact@v4 | |
with: | |
name: mv-extractor-docker-image | |
path: /tmp | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Load and push Docker image | |
run: | | |
docker load --input /tmp/image.tar | |
docker tag mv-extractor:local lubo1994/mv-extractor:dev | |
docker push lubo1994/mv-extractor:dev |