diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2017-09-19 18:18:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-19 18:18:35 +0200 |
commit | 6aae4bd0a15575eb11b4774cfdcdad1c2a994fe0 (patch) | |
tree | 6a13b2f27a0e06b5358c7b52556ef2b774cb817e | |
parent | fc1c1b8869817f5864c72d57385761b9124603da (diff) | |
parent | d691604080cc920e7d1d7ad5c98f4e3fae779524 (diff) | |
download | Shaarli-6aae4bd0a15575eb11b4774cfdcdad1c2a994fe0.tar.gz Shaarli-6aae4bd0a15575eb11b4774cfdcdad1c2a994fe0.tar.zst Shaarli-6aae4bd0a15575eb11b4774cfdcdad1c2a994fe0.zip |
Merge pull request #909 from virtualtam/docker/test-environments
docker: add alpine,debian,ubuntu test images
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | doc/md/Unit-tests-Docker.md | 56 | ||||
-rw-r--r-- | docker/test/alpine36/Dockerfile | 34 | ||||
-rw-r--r-- | docker/test/debian8/Dockerfile | 35 | ||||
-rw-r--r-- | docker/test/debian9/Dockerfile | 36 | ||||
-rw-r--r-- | docker/test/ubuntu16/Dockerfile | 36 | ||||
-rw-r--r-- | mkdocs.yml | 1 |
7 files changed, 208 insertions, 0 deletions
@@ -19,6 +19,16 @@ PHP_COMMA_SOURCE = index.php,application,tests,plugins | |||
19 | all: static_analysis_summary check_permissions test | 19 | all: static_analysis_summary check_permissions test |
20 | 20 | ||
21 | ## | 21 | ## |
22 | # Docker test adapter | ||
23 | # | ||
24 | # Shaarli sources and vendored libraries are copied from a shared volume | ||
25 | # to a user-owned directory to enable running tests as a non-root user. | ||
26 | ## | ||
27 | docker_%: | ||
28 | rsync -az /shaarli/ ~/shaarli/ | ||
29 | cd ~/shaarli && make $* | ||
30 | |||
31 | ## | ||
22 | # Concise status of the project | 32 | # Concise status of the project |
23 | # These targets are non-blocking: || exit 0 | 33 | # These targets are non-blocking: || exit 0 |
24 | ## | 34 | ## |
diff --git a/doc/md/Unit-tests-Docker.md b/doc/md/Unit-tests-Docker.md new file mode 100644 index 00000000..c2de7cc7 --- /dev/null +++ b/doc/md/Unit-tests-Docker.md | |||
@@ -0,0 +1,56 @@ | |||
1 | ## Running tests inside Docker containers | ||
2 | |||
3 | Read first: | ||
4 | |||
5 | - [Docker 101](docker/docker-101.md) | ||
6 | - [Docker resources](docker/resources.md) | ||
7 | - [Unit tests](Unit-tests.md) | ||
8 | |||
9 | ### Docker test images | ||
10 | |||
11 | Test Dockerfiles are located under `docker/tests/<distribution>/Dockerfile`, | ||
12 | and can be used to build Docker images to run Shaarli test suites under common | ||
13 | Linux environments. | ||
14 | |||
15 | Dockerfiles are provided for the following environments: | ||
16 | |||
17 | - `alpine36` - [Alpine 3.6](https://www.alpinelinux.org/downloads/) | ||
18 | - `debian8` - [Debian 8 Jessie](https://www.debian.org/DebianJessie) (oldstable) | ||
19 | - `debian9` - [Debian 9 Stretch](https://wiki.debian.org/DebianStretch) (stable) | ||
20 | - `ubuntu16` - [Ubuntu 16.04 Xenial Xerus](http://releases.ubuntu.com/16.04/) (LTS) | ||
21 | |||
22 | What's behind the curtains: | ||
23 | |||
24 | - each image provides: | ||
25 | - a base Linux OS | ||
26 | - Shaarli PHP dependencies (OS packages) | ||
27 | - test PHP dependencies (OS packages) | ||
28 | - Composer | ||
29 | - the local workspace is mapped to the container's `/shaarli/` directory, | ||
30 | - the files are rsync'd to so tests are run using a standard Linux user account | ||
31 | (running tests as `root` would bypass permission checks and may hide issues) | ||
32 | - the tests are run inside the container. | ||
33 | |||
34 | ### Building test images | ||
35 | |||
36 | ```bash | ||
37 | # build the Debian 9 Docker image | ||
38 | $ cd /path/to/shaarli | ||
39 | $ cd docker/test/debian9 | ||
40 | $ docker build -t shaarli-test:debian9 . | ||
41 | ``` | ||
42 | |||
43 | ### Running tests | ||
44 | |||
45 | ```bash | ||
46 | $ cd /path/to/shaarli | ||
47 | |||
48 | # install/update 3rd-party test dependencies | ||
49 | $ composer install --prefer-dist | ||
50 | |||
51 | # run tests using the freshly built image | ||
52 | $ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_test | ||
53 | |||
54 | # run the full test campaign | ||
55 | $ docker run -v $PWD:/shaarli shaarli-test:debian9 docker_all_tests | ||
56 | ``` | ||
diff --git a/docker/test/alpine36/Dockerfile b/docker/test/alpine36/Dockerfile new file mode 100644 index 00000000..fa84f6e2 --- /dev/null +++ b/docker/test/alpine36/Dockerfile | |||
@@ -0,0 +1,34 @@ | |||
1 | FROM alpine:3.6 | ||
2 | MAINTAINER Shaarli Community | ||
3 | |||
4 | RUN apk --update --no-cache add \ | ||
5 | ca-certificates \ | ||
6 | curl \ | ||
7 | make \ | ||
8 | php7 \ | ||
9 | php7-ctype \ | ||
10 | php7-curl \ | ||
11 | php7-dom \ | ||
12 | php7-gd \ | ||
13 | php7-iconv \ | ||
14 | php7-intl \ | ||
15 | php7-json \ | ||
16 | php7-mbstring \ | ||
17 | php7-openssl \ | ||
18 | php7-phar \ | ||
19 | php7-session \ | ||
20 | php7-simplexml \ | ||
21 | php7-tokenizer \ | ||
22 | php7-xdebug \ | ||
23 | php7-xml \ | ||
24 | php7-zlib \ | ||
25 | rsync | ||
26 | |||
27 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
28 | |||
29 | RUN mkdir /shaarli | ||
30 | WORKDIR /shaarli | ||
31 | VOLUME /shaarli | ||
32 | |||
33 | ENTRYPOINT ["make"] | ||
34 | CMD [] | ||
diff --git a/docker/test/debian8/Dockerfile b/docker/test/debian8/Dockerfile new file mode 100644 index 00000000..eaa34e9b --- /dev/null +++ b/docker/test/debian8/Dockerfile | |||
@@ -0,0 +1,35 @@ | |||
1 | FROM debian:jessie | ||
2 | MAINTAINER Shaarli Community | ||
3 | |||
4 | ENV TERM dumb | ||
5 | ENV DEBIAN_FRONTEND noninteractive | ||
6 | ENV LANG en_US.UTF-8 | ||
7 | ENV LANGUAGE en_US:en | ||
8 | |||
9 | RUN apt-get update \ | ||
10 | && apt-get install --no-install-recommends -y \ | ||
11 | ca-certificates \ | ||
12 | curl \ | ||
13 | locales \ | ||
14 | make \ | ||
15 | php5 \ | ||
16 | php5-curl \ | ||
17 | php5-gd \ | ||
18 | php5-intl \ | ||
19 | php5-xdebug \ | ||
20 | rsync \ | ||
21 | && apt-get clean | ||
22 | |||
23 | RUN locale-gen en_US.UTF-8 \ | ||
24 | && locale-gen de_DE.UTF-8 \ | ||
25 | && locale-gen fr_FR.UTF-8 | ||
26 | |||
27 | ADD https://getcomposer.org/composer.phar /usr/local/bin/composer | ||
28 | RUN chmod 755 /usr/local/bin/composer | ||
29 | |||
30 | RUN mkdir /shaarli | ||
31 | WORKDIR /shaarli | ||
32 | VOLUME /shaarli | ||
33 | |||
34 | ENTRYPOINT ["make"] | ||
35 | CMD [] | ||
diff --git a/docker/test/debian9/Dockerfile b/docker/test/debian9/Dockerfile new file mode 100644 index 00000000..3ab4b93d --- /dev/null +++ b/docker/test/debian9/Dockerfile | |||
@@ -0,0 +1,36 @@ | |||
1 | FROM debian:stretch | ||
2 | MAINTAINER Shaarli Community | ||
3 | |||
4 | ENV TERM dumb | ||
5 | ENV DEBIAN_FRONTEND noninteractive | ||
6 | ENV LANG en_US.UTF-8 | ||
7 | ENV LANGUAGE en_US:en | ||
8 | |||
9 | RUN apt-get update \ | ||
10 | && apt-get install --no-install-recommends -y \ | ||
11 | ca-certificates \ | ||
12 | curl \ | ||
13 | locales \ | ||
14 | make \ | ||
15 | php7.0 \ | ||
16 | php7.0-curl \ | ||
17 | php7.0-gd \ | ||
18 | php7.0-intl \ | ||
19 | php7.0-xml \ | ||
20 | php-xdebug \ | ||
21 | rsync \ | ||
22 | && apt-get clean | ||
23 | |||
24 | RUN locale-gen en_US.UTF-8 \ | ||
25 | && locale-gen de_DE.UTF-8 \ | ||
26 | && locale-gen fr_FR.UTF-8 | ||
27 | |||
28 | ADD https://getcomposer.org/composer.phar /usr/local/bin/composer | ||
29 | RUN chmod 755 /usr/local/bin/composer | ||
30 | |||
31 | RUN mkdir /shaarli | ||
32 | WORKDIR /shaarli | ||
33 | VOLUME /shaarli | ||
34 | |||
35 | ENTRYPOINT ["make"] | ||
36 | CMD [] | ||
diff --git a/docker/test/ubuntu16/Dockerfile b/docker/test/ubuntu16/Dockerfile new file mode 100644 index 00000000..e53ed9e3 --- /dev/null +++ b/docker/test/ubuntu16/Dockerfile | |||
@@ -0,0 +1,36 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | MAINTAINER Shaarli Community | ||
3 | |||
4 | ENV TERM dumb | ||
5 | ENV DEBIAN_FRONTEND noninteractive | ||
6 | ENV LANG en_US.UTF-8 | ||
7 | ENV LANGUAGE en_US:en | ||
8 | |||
9 | RUN apt-get update \ | ||
10 | && apt-get install --no-install-recommends -y \ | ||
11 | ca-certificates \ | ||
12 | curl \ | ||
13 | language-pack-de \ | ||
14 | language-pack-en \ | ||
15 | language-pack-fr \ | ||
16 | locales \ | ||
17 | make \ | ||
18 | php7.0 \ | ||
19 | php7.0-curl \ | ||
20 | php7.0-gd \ | ||
21 | php7.0-intl \ | ||
22 | php7.0-xml \ | ||
23 | php-xdebug \ | ||
24 | rsync \ | ||
25 | && apt-get clean | ||
26 | |||
27 | ADD https://getcomposer.org/composer.phar /usr/local/bin/composer | ||
28 | RUN chmod 755 /usr/local/bin/composer | ||
29 | |||
30 | RUN useradd -m dev \ | ||
31 | && mkdir /shaarli | ||
32 | USER dev | ||
33 | WORKDIR /shaarli | ||
34 | |||
35 | ENTRYPOINT ["make"] | ||
36 | CMD [] | ||
@@ -45,6 +45,7 @@ pages: | |||
45 | - Static analysis: Static-analysis.md | 45 | - Static analysis: Static-analysis.md |
46 | - Theming: Theming.md | 46 | - Theming: Theming.md |
47 | - Unit tests: Unit-tests.md | 47 | - Unit tests: Unit-tests.md |
48 | - Unit tests inside Docker: Unit-tests-Docker.md | ||
48 | - About: | 49 | - About: |
49 | - FAQ: FAQ.md | 50 | - FAQ: FAQ.md |
50 | - Community & Related software: Community-&-Related-software.md | 51 | - Community & Related software: Community-&-Related-software.md |