Skip to content

Commit

Permalink
👷 Migrate to GitHub Actions
Browse files Browse the repository at this point in the history
Also bump a few versions to get the CI to pass.
In future iterations we could bump more dependencies.

Bumped versions:
- Ubunto 18.04 to 24.04
- Python 3.7 to 3.11 & 3.12
- Cython==0.28.6 to Cython==0.29.15
- Kivy==2.0.0rc2 to Kivy==2.3.1
- p4a v2020.04.29 to v2024.01.21
- hostpython3==3.8.1 to hostpython3==3.10.12
- Android NDK 19b to 25b
- OpenJDK 8 to 17
  • Loading branch information
AndreMiras committed Feb 25, 2025
1 parent 8c75846 commit 0cd4e75
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 46 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Android Build

on:
# TODO
# push:
pull_request:

jobs:
android-build:
runs-on: ubuntu-latest
name: Android Build

steps:
- uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: |
docker build --tag=zbarcam-android \
--file=dockerfiles/Dockerfile-android \
--build-arg CI .
- name: Build Android app
run: |
docker run --env-file dockerfiles/env.list \
zbarcam-android buildozer android debug
timeout-minutes: 30
37 changes: 37 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Linux Build

on:
push:
pull_request:

jobs:
linux-build:
runs-on: ubuntu-latest
name: Linux Build

steps:
- uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: |
docker build --tag=zbarcam-linux \
--file=dockerfiles/Dockerfile-linux \
--build-arg CI .
- name: Setup virtual frame buffer
run: |
sudo apt-get update
sudo apt-get install -y xvfb
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Run tests
run: |
docker run --env-file dockerfiles/env.list \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
zbarcam-linux make test
timeout-minutes: 30
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SYSTEM_DEPENDENCIES= \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libpython3.7-dev \
libpython$(PYTHON_VERSION)-dev \
libpython$(PYTHON_VERSION)-dev \
libzbar-dev \
pkg-config \
Expand All @@ -31,7 +31,7 @@ SYSTEM_DEPENDENCIES= \
virtualenv
OS=$(shell lsb_release -si 2>/dev/null || uname)
PYTHON_MAJOR_VERSION=3
PYTHON_MINOR_VERSION=7
PYTHON_MINOR_VERSION=12
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION)
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION)
PYTHON_WITH_VERSION=python$(PYTHON_VERSION)
Expand All @@ -46,7 +46,7 @@ endif

$(VIRTUAL_ENV):
$(PYTHON_WITH_VERSION) -m venv $(VIRTUAL_ENV)
$(PIP) install Cython==0.28.6
$(PIP) install Cython==0.29.15
$(PIP) install -r requirements.txt

virtualenv: $(VIRTUAL_ENV)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# zbarcam

[![Build Status](https://travis-ci.org/kivy-garden/zbarcam.svg?branch=develop)](https://travis-ci.org/kivy-garden/zbarcam)
[![Android Build](/~https://github.com/kivy-garden/zbarcam/actions/workflows/android-build.yml/badge.svg)](/~https://github.com/kivy-garden/zbarcam/actions/workflows/android-build.yml)
[![Linux Build](/~https://github.com/kivy-garden/zbarcam/actions/workflows/linux-build.yml/badge.svg)](/~https://github.com/kivy-garden/zbarcam/actions/workflows/linux-build.yml)
[![Coverage Status](https://coveralls.io/repos/github/kivy-garden/zbarcam/badge.svg?branch=develop)](https://coveralls.io/github/kivy-garden/zbarcam?branch=develop)
[![PyPI version](https://badge.fury.io/py/zbarcam.svg)](https://badge.fury.io/py/zbarcam)
[![Documentation Status](https://readthedocs.org/projects/zbarcam/badge/?version=latest)](https://zbarcam.readthedocs.io/en/latest/?badge=latest)
Expand Down
14 changes: 7 additions & 7 deletions buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ version.filename = %(source.dir)s/kivy_garden/zbarcam/version.py
# comma seperated e.g. requirements = sqlite3,kivy
requirements =
android,
hostpython3==3.8.1,
Kivy==58e70b1,
hostpython3==3.10.12,
Kivy==2.3.1,
libiconv,
libzbar,
Pillow==7.0.0,
python3==3.8.1,
Pillow==8.4.0,
python3==3.10.12,
pyzbar==0.1.8,
xcamera==2019.928
Expand Down Expand Up @@ -78,7 +78,7 @@ orientation = portrait
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
osx.kivy_version = 2.3.1
#
# Android specific
Expand Down Expand Up @@ -107,7 +107,7 @@ android.minapi = 21
android.sdk = 20
# (str) Android NDK version to use
android.ndk = 19b
android.ndk = 25b
# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
android.ndk_api = 21
Expand Down Expand Up @@ -219,7 +219,7 @@ android.arch = armeabi-v7a
#p4a.fork = kivy
# (str) python-for-android branch to use, defaults to master
p4a.branch = v2020.04.29
p4a.branch = v2024.01.21
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =
Expand Down
21 changes: 14 additions & 7 deletions dockerfiles/Dockerfile-android
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
# docker run zbarcam-android 'buildozer android debug'
# Or for interactive shell:
# docker run -it --rm zbarcam-android
FROM ubuntu:18.04
FROM ubuntu:24.04

ARG CI=false
ARG PYTHON_VERSION=3.12
ARG JAVA_VERSION=17
ENV USER="user"
ENV HOME_DIR="/home/${USER}"
ENV WORK_DIR="${HOME_DIR}" \
Expand All @@ -35,16 +37,16 @@ RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends
git \
libffi-dev \
libltdl-dev \
libpython3.7-dev \
libpython${PYTHON_VERSION}-dev \
libssl-dev \
libtool \
make \
openjdk-8-jdk \
openjdk-${JAVA_VERSION}-jdk \
patch \
pkg-config \
python3.7 \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-venv \
python3-pip \
python3-setuptools \
python \
sudo \
unzip \
xz-utils \
Expand All @@ -59,8 +61,13 @@ RUN useradd --create-home --shell /bin/bash ${USER} && \
USER ${USER}
WORKDIR ${WORK_DIR}

# Create and activate a virtual environment
RUN python3 -m venv ${HOME_DIR}/venv
ENV PATH="${HOME_DIR}/venv/bin:${PATH}" \
VIRTUAL_ENV="${HOME_DIR}/venv"

# install buildozer & dependencies
RUN pip3 install --user --upgrade buildozer Cython==0.28.6
RUN pip install --upgrade buildozer setuptools Cython==0.29.33

COPY . ${WORK_DIR}
# limits the amount of logs for Travis
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile-linux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix zbarcam-linux 'make uitest'
# Or for interactive shell:
# docker run -it --rm zbarcam-linux
FROM ubuntu:18.04
FROM ubuntu:24.04

ENV USER="user"
ENV HOME_DIR="/home/${USER}"
Expand Down
9 changes: 5 additions & 4 deletions dockerfiles/env.list
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# used by coveralls.io, refs:
# https://coveralls-python.readthedocs.io/en/latest/usage/tox.html#travisci
CI
TRAVIS
TRAVIS_BRANCH
TRAVIS_JOB_ID
TRAVIS_PULL_REQUEST
# TODO: needed?
GITHUB_*
GITHUB_ACTIONS
GITHUB_TOKEN
COVERALLS_REPO_TOKEN
# used for running UI tests
DISPLAY
6 changes: 3 additions & 3 deletions requirements/requirements-base.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Kivy==2.0.0rc2
Kivy==2.3.1
Kivy-Garden==0.1.4
numpy==1.18.4
opencv-python==4.2.0.34
numpy==1.26.4
opencv-python==4.8.1.78
Pillow==8.2.0
pyzbar==0.1.8
xcamera==2019.928
18 changes: 16 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[tox]
envlist = pep8,isort-check,py36,py37
envlist = pep8,isort-check,py312
# no setup.py to be ran
skipsdist = True

[testenv]
setenv =
PYTHONPATH = {toxinidir}/src/
SOURCES = src/ tests/ setup.py setup_meta.py
passenv = DISPLAY
passenv =
CI
DISPLAY
GITHUB_*
deps = -r{toxinidir}/requirements.txt
commands = pytest --cov src/ tests/

Expand All @@ -16,3 +19,14 @@ commands = flake8 {env:SOURCES}

[testenv:isort-check]
commands = isort --check-only --recursive --diff {env:SOURCES}

# TODO: DRY
# TODO: needed?
[testenv:coveralls]
passenv =
CI
DISPLAY
GITHUB_*
setenv =
COVERALLS_SERVICE_NAME = github
commands = coveralls

0 comments on commit 0cd4e75

Please sign in to comment.