Skip to content

Commit 5ac66d1

Browse files
authored
allowed import if C module is unavailable (for building docs) (#100)
* allowed import if C module is unavailable (for building docs)
1 parent 26428d7 commit 5ac66d1

19 files changed

+195
-25
lines changed

.github/.codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
codecov:
2+
notify:
3+
after_n_builds: 3
4+
15
comment:
26
require_changes: true
37
layout: "diff, files"

.github/workflows/analysis-coverage.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,32 @@ jobs:
300300

301301
- name: Perform tests
302302
run: sudo -H PH_LIGHT_ACTION=1 EXP_PH_LIBHEIF_VERSION="" python3 -m pytest -rs
303+
304+
coverage-import-error:
305+
runs-on: macos-12
306+
name: Coverage(ImportError)
307+
308+
steps:
309+
- uses: actions/checkout@v3
310+
- name: Install from source
311+
run: |
312+
python3 -m pip -v install .
313+
python3 -m pip install pytest coverage
314+
315+
- name: Generate coverage report
316+
run: coverage run -m pytest -rs tests/import_error_test.py && coverage xml && coverage html
317+
318+
- name: HTML coverage to artifacts
319+
uses: actions/upload-artifact@v3
320+
with:
321+
name: coverage_macos_imp_err
322+
path: ./htmlcov
323+
if-no-files-found: error
324+
325+
- name: Upload report to Codecov
326+
uses: codecov/codecov-action@v3
327+
with:
328+
token: ${{ secrets.CODECOV_TOKEN }}
329+
file: ./coverage.xml
330+
fail_ci_if_error: true
331+
verbose: true

.github/workflows/test-src-build-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
fail-fast: false
3737
matrix:
3838
arch: ["amd64", "arm64", "arm/v7"]
39-
docker_file: ["Alpine_3_15", "Alpine_3_17", "Debian_11", "Ubuntu_22_04"]
39+
docker_file: ["Alpine_3_15", "Alpine_3_17", "Alpine_3_18", "Debian_11", "Debian_12", "Ubuntu_22_04"]
4040

4141
steps:
4242
- uses: actions/checkout@v3

.readthedocs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ build:
44
os: ubuntu-22.04
55
tools:
66
python: "3.9"
7-
apt_packages:
8-
- libheif-dev
97

108
python:
119
install:

docker/from_src/Alpine_3_15.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ RUN \
2929
fi && \
3030
echo "**** Build Done ****" && \
3131
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
32-
pytest -s pillow_heif && \
32+
pytest -rs pillow_heif && \
3333
echo "**** Test Done ****"

docker/from_src/Alpine_3_17.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ RUN \
2828
fi && \
2929
echo "**** Build Done ****" && \
3030
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
31-
pytest -s pillow_heif && \
31+
pytest -rs pillow_heif && \
3232
echo "**** Test Done ****"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM alpine:3.18 as base
2+
3+
RUN \
4+
apk add --no-cache \
5+
python3-dev \
6+
py3-pip \
7+
alpine-sdk \
8+
libheif-dev \
9+
py3-numpy \
10+
py3-pillow
11+
12+
RUN \
13+
python3 -m pip install --upgrade pip
14+
15+
FROM base as build_test
16+
17+
COPY . /pillow_heif
18+
19+
RUN \
20+
if [ `getconf LONG_BIT` = 64 ]; then \
21+
python3 -m pip install -v "pillow_heif/.[tests]"; \
22+
else \
23+
python3 -m pip install -v "pillow_heif/.[tests-min]"; \
24+
fi && \
25+
echo "**** Build Done ****" && \
26+
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
27+
pytest -rs pillow_heif && \
28+
echo "**** Test Done ****"

docker/from_src/Debian_11.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ RUN \
3535
fi && \
3636
echo "**** Build Done ****" && \
3737
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
38-
pytest -s pillow_heif && \
38+
pytest -rs pillow_heif && \
3939
echo "**** Test Done ****"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM debian:bullseye-slim as base
2+
3+
RUN \
4+
apt-get -qq update && \
5+
apt-get -y -q install \
6+
python3-pip \
7+
libfribidi-dev \
8+
libharfbuzz-dev \
9+
libjpeg-dev \
10+
liblcms2-dev \
11+
libffi-dev \
12+
libtool \
13+
git \
14+
cmake \
15+
nasm \
16+
wget \
17+
libde265-dev \
18+
libx265-dev
19+
20+
RUN \
21+
python3 -m pip install --upgrade pip
22+
23+
RUN \
24+
python3 -m pip install Pillow==9.2.0
25+
26+
FROM base as build_test
27+
28+
COPY . /pillow_heif
29+
30+
RUN \
31+
if [ `getconf LONG_BIT` = 64 ]; then \
32+
python3 -m pip install -v "pillow_heif/.[tests]"; \
33+
else \
34+
python3 -m pip install -v "pillow_heif/.[tests-min]"; \
35+
export PH_TESTS_NO_HEVC_ENC=1; \
36+
fi && \
37+
echo "**** Build Done ****" && \
38+
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
39+
pytest -rs pillow_heif && \
40+
echo "**** Test Done ****"

docker/from_src/Ubuntu_22_04.Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy as base
1+
FROM ubuntu:jammy as base
22

33
RUN \
44
apt-get -qq update && \
55
apt-get -y -q install \
6+
curl \
67
python3-pip \
78
libfribidi-dev \
89
libharfbuzz-dev \
@@ -13,6 +14,7 @@ RUN \
1314
git \
1415
cmake \
1516
nasm \
17+
libde265-dev \
1618
libaom-dev
1719

1820
RUN \
@@ -33,5 +35,5 @@ RUN \
3335
fi && \
3436
echo "**** Build Done ****" && \
3537
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \
36-
pytest -s pillow_heif && \
38+
pytest -rs pillow_heif && \
3739
echo "**** Test Done ****"

0 commit comments

Comments
 (0)