Skip to content

fix github workflow for unit tests #4

fix github workflow for unit tests

fix github workflow for unit tests #4

name: Build Docker and run unit tests
on:
push:
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: lubo1994/mv-extractor:dev
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
run_unit_tests:
name: Run unit tests for python${{ matrix.python }}
runs-on: ubuntu-latest
needs: build_docker
strategy:
fail-fast: false
matrix:
include:
- python: "3.9"
- python: "3.10"
- python: "3.11"
- python: "3.12"
- python: "3.13"
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
docker image ls -a
- name: Run unit test
run: |
docker run \
-v ${{ github.workspace }}:/home/video_cap \
lubo1994/mv-extractor:dev \
python${{ matrix.python }} -m pip install --upgrade pip \
python${{ matrix.python }} -m pip install . \
python${{ matrix.python }} tests/tests.py
# TODO: if tests pass, push image to registry