Skip to content

Commit f957aa7

Browse files
committed
👷 Migrate to GitHub Actions
Also bump a few versions to get the CI to pass. In future iterations we could bump more dependencies. TODO: - explain why we removed dependencies from the Makefile
1 parent 8c75846 commit f957aa7

File tree

9 files changed

+103
-45
lines changed

9 files changed

+103
-45
lines changed

.github/workflows/tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
include:
11+
- tag: zbarcam-linux
12+
dockerfile: dockerfiles/Dockerfile-linux
13+
# TODO: debugging
14+
command: "make test"
15+
# command: "xeyes"
16+
# TODO: debugging
17+
# - tag: zbarcam-android
18+
# dockerfile: dockerfiles/Dockerfile-android
19+
# command: "buildozer android debug"
20+
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Build Docker image
29+
run: docker build --tag=${{ matrix.tag }} --file=${{ matrix.dockerfile }} --build-arg CI .
30+
31+
# - name: Run headless test
32+
# uses: coactions/setup-xvfb@v1
33+
# with:
34+
# run: docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix ${{ matrix.tag }} ${{ matrix.command }}
35+
36+
# TODO
37+
- name: Run Docker container
38+
# TODO: try with :0 too
39+
env:
40+
DISPLAY: :1
41+
run: |
42+
# TODO
43+
ls -la /tmp/
44+
sudo apt update
45+
sudo apt install xvfb x11-xserver-utils
46+
sudo apt install mutter dbus-x11
47+
dbus-launch --auto-syntax > dbus-env;
48+
source dbus-env;
49+
# try with x11/wayland
50+
mutter --headless --virtual-monitor 1920x1080 &
51+
# xhost +local:root
52+
# docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix ${{ matrix.tag }} ${{ matrix.command }}
53+
xvfb-run --auto-servernum docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY ${{ matrix.tag }} ${{ matrix.command }}
54+
# docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix ${{ matrix.tag }} ${{ matrix.command }}
55+
# docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix ${{ matrix.tag }} ${{ matrix.command }}
56+
# TODO: needed?
57+
# timeout-minutes: 30

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SOURCES=src/ tests/ setup.py setup_meta.py
1010
# using full path so it can be used outside the root dir
1111
SPHINXBUILD=$(shell realpath venv/bin/sphinx-build)
1212
DOCS_DIR=doc
13+
# TODO: remove
1314
SYSTEM_DEPENDENCIES= \
1415
build-essential \
1516
ccache \
@@ -20,7 +21,6 @@ SYSTEM_DEPENDENCIES= \
2021
libsdl2-image-dev \
2122
libsdl2-mixer-dev \
2223
libsdl2-ttf-dev \
23-
libpython3.7-dev \
2424
libpython$(PYTHON_VERSION)-dev \
2525
libzbar-dev \
2626
pkg-config \
@@ -31,7 +31,7 @@ SYSTEM_DEPENDENCIES= \
3131
virtualenv
3232
OS=$(shell lsb_release -si 2>/dev/null || uname)
3333
PYTHON_MAJOR_VERSION=3
34-
PYTHON_MINOR_VERSION=7
34+
PYTHON_MINOR_VERSION=10
3535
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
3636
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
3737
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
@@ -46,7 +46,8 @@ endif
4646

4747
$(VIRTUAL_ENV):
4848
$(PYTHON_WITH_VERSION) -m venv $(VIRTUAL_ENV)
49-
$(PIP) install Cython==0.28.6
49+
$(PIP) install --upgrade pip
50+
$(PIP) install Cython==0.29.34
5051
$(PIP) install -r requirements.txt
5152

5253
virtualenv: $(VIRTUAL_ENV)
@@ -111,3 +112,4 @@ docker/run/app:
111112

112113
docker/run/shell:
113114
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 -it --rm zbarcam-linux
115+
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 -it --rm --gpus all -e DISPLAY=unix$$DISPLAY zbarcam-linux

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# zbarcam
22

3-
[![Build Status](https://travis-ci.org/kivy-garden/zbarcam.svg?branch=develop)](https://travis-ci.org/kivy-garden/zbarcam)
3+
[![Tests](https://github.com/kivy-garden/zbarcam/actions/workflows/tests.yml/badge.svg)](https://github.com/kivy-garden/zbarcam/actions/workflows/tests.yml)
44
[![Coverage Status](https://coveralls.io/repos/github/kivy-garden/zbarcam/badge.svg?branch=develop)](https://coveralls.io/github/kivy-garden/zbarcam?branch=develop)
55
[![PyPI version](https://badge.fury.io/py/zbarcam.svg)](https://badge.fury.io/py/zbarcam)
66
[![Documentation Status](https://readthedocs.org/projects/zbarcam/badge/?version=latest)](https://zbarcam.readthedocs.io/en/latest/?badge=latest)

dockerfiles/Dockerfile-linux

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
# docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix zbarcam-linux 'make uitest'
1111
# Or for interactive shell:
1212
# docker run -it --rm zbarcam-linux
13-
FROM ubuntu:18.04
13+
FROM ubuntu:22.04
1414

1515
ENV USER="user"
1616
ENV HOME_DIR="/home/${USER}"
1717
ENV WORK_DIR="${HOME_DIR}"
18+
ENV PYTHON_VERSION="3.10"
1819

1920
# configure locale
2021
RUN apt update -qq > /dev/null && apt install --yes --no-install-recommends \
@@ -24,11 +25,32 @@ ENV LANG="en_US.UTF-8" \
2425
LANGUAGE="en_US.UTF-8" \
2526
LC_ALL="en_US.UTF-8"
2627

28+
# TODO: x11-apps for debugging
2729
# install system dependencies
2830
RUN apt install --yes --no-install-recommends \
31+
build-essential \
32+
ccache \
33+
cmake \
34+
curl \
35+
git \
36+
libpython${PYTHON_VERSION}-dev \
37+
libsdl2-dev \
38+
libsdl2-image-dev \
39+
libsdl2-mixer-dev \
40+
libsdl2-ttf-dev \
41+
libzbar-dev \
2942
lsb-release \
3043
make \
31-
sudo
44+
pkg-config \
45+
python${PYTHON_VERSION} \
46+
python${PYTHON_VERSION}-dev \
47+
python${PYTHON_VERSION}-venv \
48+
sudo \
49+
tox \
50+
virtualenv
51+
52+
RUN apt install --yes --no-install-recommends \
53+
x11-apps
3254

3355
# prepare non root env
3456
RUN useradd --create-home --shell /bin/bash ${USER}
@@ -42,5 +64,7 @@ USER ${USER}
4264
WORKDIR ${WORK_DIR}
4365
COPY . ${WORK_DIR}
4466

45-
RUN sudo make system_dependencies && make virtualenv
46-
ENTRYPOINT ["./dockerfiles/start.sh"]
67+
# TODO
68+
# RUN sudo make system_dependencies && make virtualenv
69+
# RUN make virtualenv
70+
# ENTRYPOINT ["./dockerfiles/start.sh"]

requirements/requirements-base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Kivy==2.0.0rc2
1+
Kivy==2.1.0
22
Kivy-Garden==0.1.4
3-
numpy==1.18.4
4-
opencv-python==4.2.0.34
3+
numpy==1.21.2
4+
opencv-python==4.7.0.72
55
Pillow==8.2.0
66
pyzbar==0.1.8
77
xcamera==2019.928

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import os
2+
import re
23

34
from setuptools import find_namespace_packages, setup
45

5-
from src.kivy_garden.zbarcam import version
6-
76

87
def read(fname):
98
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
109
return f.read()
1110

1211

12+
def get_version():
13+
version_pattern = re.compile(r"__version__\s*=\s*['\"](.*?)['\"]")
14+
return version_pattern.search("src/kivy_garden/zbarcam/version.py")
15+
16+
1317
# exposing the params so it can be imported
1418
setup_params = {
1519
'name': 'kivy_garden.zbarcam',
16-
'version': version.__version__,
20+
'version': get_version(),
1721
'description': 'Real time Barcode and QR Code scanner Edit',
1822
'long_description': read('README.md'),
1923
'long_description_content_type': 'text/markdown',
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
"""
22
Exposes `ZBarCam` directly in `zbarcam` rather than `zbarcam.zbarcam`.
3-
Also note this may break `pip` since all imports within `zbarcam.py` would be
4-
required at setup time. This is because `version.py` (same directory) is used
5-
by the `setup.py` file.
6-
Hence we're not exposing `ZBarCam` if `pip` is detected.
73
"""
8-
import os
9-
10-
project_dir = os.path.abspath(
11-
os.path.join(__file__, os.pardir, os.pardir, os.pardir, os.pardir))
12-
using_pip = os.path.basename(project_dir).startswith('pip-')
13-
# only exposes `ZBarCam` if not within `pip` ongoing install
14-
if not using_pip:
15-
from .zbarcam import ZBarCam # noqa
4+
from .zbarcam import ZBarCam # noqa

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = pep8,isort-check,py36,py37
2+
envlist = pep8,isort-check,py310
33
# no setup.py to be ran
44
skipsdist = True
55

0 commit comments

Comments
 (0)