Skip to content

Commit

Permalink
Add Dockerfile and bash script to more easily run tests (s3ql#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
d--j authored Sep 14, 2020
1 parent 3ba066f commit 9b2ea62
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*.pyc
__pycache__
*/__pycache__
*/*/__pycache__
*/*/*/__pycache__
/.project
/.pydevproject
/.settings
/.idea
/build/
/contrib/expire_backups.1
/contrib/pcp.1
/dist/
/doc/
/rst/autogen/
/s3ql.old/
/src/s3ql.egg-info/
/src/s3ql/deltadump.*.so
/src/s3ql/deltadump.c
/tests/.cache/
/tests/.pytest_cache/
/tests/test.log
/tests/test_crit.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
/.project
/.pydevproject
/.settings
/.idea
/build/
/contrib/expire_backups.1
/contrib/pcp.1
Expand Down
32 changes: 32 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is not a general purpose Dockerfile
# It's tailored for running tests and building documentation.

FROM ubuntu:bionic AS build
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install -y fakeroot curl dpkg-dev build-essential manpages pbuilder aptitude rsync \
git libbz2-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev \
zlib1g-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils libxml2-dev libxmlsec1-dev liblzma-dev \
libsystemd-dev gcc psmisc pkg-config libattr1-dev libsqlite3-dev libjs-sphinxdoc texlive-latex-base \
texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended python3-pip python3-setuptools \
ninja-build udev libudev1 libudev-dev \
&& mkdir /build \
&& ln -sf /usr/bin/pip3 /usr/bin/pip && ln -sf /usr/bin/python3 /usr/bin/python \
&& pip install "setuptools >= 40.3.0"

ADD tests/travis-install.sh /travis-install.sh
RUN /travis-install.sh

ADD . /build
WORKDIR /build
RUN python setup.py build_cython \
&& python setup.py build_ext --inplace \
&& python setup.py test \
&& python setup.py build_sphinx \
&& python setup.py install

FROM scratch AS export
COPY --from=build /build/doc/ /doc/
COPY --from=build /build/src/s3ql/deltadump.c /src/s3ql/deltadump.c
9 changes: 9 additions & 0 deletions tests/run-tests-via-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

# always use S3QL source root as working dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/.." || exit 1

# run tests in docker and copy documentation to /build/
# use BuildKit when available so that the --output option works on macOS
DOCKER_BUILDKIT=1 docker build -f ./tests/Dockerfile -o "./build" .

0 comments on commit 9b2ea62

Please sign in to comment.