use Gamera from PyPI #179
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
name: CI | |
on: | |
- push | |
- pull_request | |
env: | |
# Allow automated checks. | |
BOOST_VERSION: 1.85.0 | |
BOOST_URL: https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.gz | |
jobs: | |
main: | |
strategy: | |
matrix: | |
include: | |
- python: 3.8 | |
gamera: pypi | |
- python: 3.9 | |
gamera: pypi | |
- python: '3.10' | |
gamera: pypi | |
- python: 3.8 | |
gamera: master | |
- python: 3.9 | |
gamera: master | |
- python: '3.10' | |
gamera: master | |
- python: '3.11' | |
gamera: master | |
- python: '3.12' | |
gamera: master | |
runs-on: ubuntu-latest | |
name: Python ${{ matrix.python }} with Gamera ${{ matrix.gamera }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: apt update | |
run: | |
sudo apt-get update | |
- name: apt install deps | |
run: | |
sudo apt-get install | |
djvulibre-bin | |
docbook-xml | |
docbook-xsl | |
exiv2 | |
gir1.2-gexiv2-0.10 | |
libexempi[38] | |
libpng-dev | |
libtiff-dev | |
libxml2-utils | |
minidjvu | |
xsltproc | |
- name: set up CC and CXX env variables | |
run: | | |
echo "cc=gcc" >> $GITHUB_ENV | |
echo "cxx=g++" >> $GITHUB_ENV | |
- name: apt install GCC | |
run: | |
sudo apt-get install ${{ env.cc }} ${{ env.cxx }} | |
- name: install ccache | |
run: | | |
sudo apt-get install ccache | |
echo "/usr/lib/ccache:$PATH" >> $GITHUB_PATH | |
- name: check ccache setup | |
run: | | |
command -v ${{ env.cc }} | grep /ccache/ | |
command -v ${{ env.cxx }} | grep /ccache/ | |
- name: update PIP | |
run: | |
python -m pip install --upgrade pip | |
- name: install wheel | |
run: | |
python -m pip install --upgrade wheel | |
- name: download Gamera from GitHub | |
run: | | |
url="https://github.com/hsnr-gamera/gamera-4/archive/${{ matrix.gamera }}.tar.gz" | |
mkdir -p deps/ | |
wget "$url" -O deps/gamera-${{ matrix.gamera }}.tar.gz | |
if: ${{ matrix.gamera == 'master' }} | |
- name: unpack Gamera from GitHub | |
run: | | |
cd deps/ | |
tar -xzf gamera-*.tar.gz | |
if: ${{ matrix.gamera == 'master' }} | |
- name: build and install Gamera from unpacked archive | |
run: | | |
cd deps/gamera-*/ | |
python -m pip install --verbose . | |
env: | |
CC: ${{ env.cc }} | |
CXX: ${{ env.cxx }} | |
if: ${{ matrix.gamera == 'master' }} | |
- name: remove Gamera source | |
run: | |
rm -rf deps | |
if: ${{ matrix.gamera == 'master' }} | |
- name: install package | |
run: | | |
python -m pip install .[dev,docs] | |
env: | |
CC: ${{ env.cc }} | |
CXX: ${{ env.cxx }} | |
# Package breaks for Python 3.12 and has been archived anyway. | |
# Corresponding issue: https://github.com/python-xmp-toolkit/python-xmp-toolkit/issues/90 | |
- name: install python-xml-toolkit | |
run: | |
python -m pip install python-xmp-toolkit | |
# `libboost-python-dev` cannot be used, as this only works with the Python version shipped by the system. | |
# This means that for Ubuntu 20.04 each Python version different from 3.8 fails with something like | |
# `cannot find -lboost_python39` when installing Boost.Python through the system package manager. | |
# Based upon: | |
# * https://www.boost.org/doc/libs/release/libs/python/doc/html/building/installing_boost_python_on_your_.html | |
# * https://www.boost.org/doc/libs/release/more/getting_started/unix-variants.html | |
- name: install Boost.Python | |
run: | | |
mkdir -p deps | |
wget $BOOST_URL -O deps/boost.tar.gz | |
cd deps | |
tar -xzf boost.tar.gz | |
cd boost_*/ | |
./bootstrap.sh --with-libraries=python | |
sudo ./b2 install | |
rm -rf deps | |
# The following two steps ensure that `libboost_python*.so.*` actually is available. | |
# Otherwise, the shared object would not be found during the tests (although the | |
# *py3exiv2* build actually finds them beforehand). For this reason, just add | |
# the installation path to the search path for Python. | |
# The alternative would be to use `--prefix` during bootstrapping above with the | |
# original value of `LD_LIBRARY_PATH`. | |
# Reference: https://github.com/boostorg/boost/blob/master/bootstrap.sh | |
- name: check Boost.Python | |
run: | |
ls -l /usr/local/lib/libboost* | |
- name: update LD_LIBRARY_PATH | |
run: | |
echo "LD_LIBRARY_PATH=/usr/local/lib:$( echo $LD_LIBRARY_PATH )" >> $GITHUB_ENV | |
- name: install py3exiv2 | |
run: | | |
sudo apt-get install libexiv2-dev | |
python -m pip install py3exiv2 | |
- name: set up PyGI | |
run: | | |
sudo apt-get install libgirepository1.0-dev | |
python -m pip install pygobject | |
- name: run tests | |
run: | |
make test | |
- name: determine coverage | |
run: | |
make update-coverage | |
- name: run flake8 | |
run: | |
python -m flake8 . | |
- name: check docs | |
run: | |
make -C doc check | |
- name: build docs | |
run: | |
make -C doc all | |
- name: check whether the executable was installed correctly | |
run: | | |
cd / | |
didjvu --version | |
didjvu --help | |
- name: install man page | |
run: | |
make install_manpage PREFIX=$HOME/.local | |
- name: check whether the man page was installed correctly | |
env: | |
MANPATH: /home/runner/.local/share/man | |
MANWIDTH: 80 | |
run: | | |
cd / | |
man 1 didjvu | grep -A 10 -w DIDJVU |