forked from jwilk-archive/python-djvulibre
-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (140 loc) · 4.43 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
- push
- pull_request
- workflow_dispatch
env:
# Allow automated checks.
DJVULIBRE_VERSION: 3.5.28
jobs:
main:
strategy:
matrix:
python: [3.8, 3.9, '3.10', '3.11', '3.12']
runs-on: ubuntu-latest
name: Python ${{ matrix.python }}
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 language-pack-ja ghostscript
- name: install ccache
run: |
sudo apt-get install ccache
echo "/usr/lib/ccache:$PATH" >> $GITHUB_PATH
- name: restore ccache data
uses: actions/cache@v3
with:
path: ~/.ccache
key:
ccache-${{ env.DJVULIBRE_VERSION }}-py${{ matrix.python }}
restore-keys:
ccache-${{ env.DJVULIBRE_VERSION }}-py${{ matrix.python }}
- name: install DjVuLibre
run: |
wget https://downloads.sourceforge.net/project/djvu/DjVuLibre/${DJVULIBRE_VERSION}/djvulibre-${DJVULIBRE_VERSION}.tar.gz
tar -xvvf djvulibre-*.tar.gz
(cd djvulibre-*/ && ./configure --disable-desktopfiles --prefix ~/.local CXXFLAGS="-fpermissive -include cstddef" || cat config.log /fail)
make -C djvulibre-*/libdjvu/ install
make -C djvulibre-*/tools/ install
make -C djvulibre-*/ install
echo CPATH=~/.local/include/ >> $GITHUB_ENV
echo PKG_CONFIG_PATH=~/.local/lib/pkgconfig/ >> $GITHUB_ENV
echo LD_LIBRARY_PATH=~/.local/lib/ >> $GITHUB_ENV
- name: update PIP
run:
python -m pip install --upgrade pip
- name: install wheel
run:
python -m pip install wheel
# `setuptools` is not included inside a virtual environment any more since Python 3.12:
# https://discuss.python.org/t/announcement-pip-23-2-release/29702
- name: install setuptools
run:
python -m pip install --upgrade setuptools
- name: install Cython
run:
python -m pip install Cython
- name: install packaging
run:
python -m pip install packaging
- name: check changelog syntax
run:
dpkg-parsechangelog -ldoc/changelog --all 2>&1 >/dev/null | { ! grep .; }
- name: build the extension in-place
run:
PYTHONWARNINGS=error::FutureWarning python setup.py build_ext --inplace
- name: run tests
run:
LC_ALL=C python -m unittest discover tests/ -v
- name: build the docs
run: |
python -m pip install sphinx
PYTHONPATH=$PWD sphinx-build -W -b doctest doc/api/ tmp
- name: check reST syntax
run:
private/check-rst
- name: install flake8
run:
python -m pip install --upgrade flake8 pep8-naming
- name: run flake8
run:
python -m flake8 tests/ doc/ setup.py
- name: run pycodestyle
run:
python -m pycodestyle djvu/
- name: build sdist
run:
python setup.py sdist
- name: check sdist tarball
run: |
tar -tvf dist/*.tar.gz | { ! grep -F /djvu/config.pxi; }
tar -tvf dist/*.tar.gz | { grep -F /djvu/sexpr.pyx; }
tar -tvf dist/*.tar.gz | { grep -F /djvu/sexpr.pxd; }
- name: install via sdist
run:
python -m pip install dist/*.tar.gz
- name: check import
run: |
cd /
python -c 'import djvu.sexpr, djvu.decode'
- name: uninstall
run: |
cd /
pip uninstall -y python-djvulibre
set +e; python -c 'import djvu'; [ $? -eq 1 ]
- name: build wheel
run:
python -m pip wheel --verbose --no-deps --wheel-dir dist .
# Wheels are basically ZIP files.
- name: check wheel file
run: |
unzip -l dist/*.whl | { ! grep -F /djvu/config.pxi; }
unzip -l dist/*.whl | { grep "sexpr\.cpython-3[[:digit:]]\+-x86_64-linux-gnu\.so"; }
- name: install via wheel
run:
python -m pip install dist/*.whl
- name: check import
run: |
cd /
python -c 'import djvu.sexpr, djvu.decode'
- name: uninstall
run: |
cd /
pip uninstall -y python-djvulibre
set +e; python -c 'import djvu'; [ $? -eq 1 ]
- name: install directly
run:
python -m pip install --verbose .
- name: check import
run: |
cd /
python -c 'import djvu.sexpr, djvu.decode'
# vim:ts=2 sts=2 sw=2 et