[extensions-web] ci: Drop Docker for running tests



commit 4718566a4221525e7d8b64c235354c43b127a962
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Jul 20 16:57:50 2020 +0200

    ci: Drop Docker for running tests
    
    Move build steps from Dockerfile to separate script. Run tests directly
    in the image via regular GitLab pipeline.

 .gitlab-ci.yml              | 27 ++++++++------------
 build.sh                    | 60 +++++++++++++++++++++++++++++++++++++++++++++
 openshift/docker/Dockerfile | 58 ++-----------------------------------------
 3 files changed, 72 insertions(+), 73 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 217e4f8..0a927cf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,19 +1,12 @@
-image: docker:stable
-
-variables:
-  DOCKER_TLS_CERTDIR: ""
-
-services:
-  - docker:dind
-
-before_script:
-  - docker info
-
 test:
-  stage: test
-  tags:
-    - privileged
+  stage: build
+  image: python:3.6-stretch
   script:
-    - docker build -f openshift/docker/Dockerfile -t extensions-web .
-    - docker run -e EGO_SECRET_KEY=. -e EGO_DEBUG=1 extensions-web python manage.py test
-    - docker run extensions-web bash -c 'pip install safety && safety check -r requirements.txt && safety 
check -r requirements.ego.txt'
+    - openshift/docker/build.sh
+    - pip install -r requirements.txt
+    - pip install -r requirements.ego.txt
+    - EGO_SECRET_KEY=- python manage.py compilemessages
+    - EGO_SECRET_KEY=. EGO_DEBUG=1 python manage.py test
+    - pip install safety 
+    - safety check -r requirements.txt 
+    - safety check -r requirements.ego.txt
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..f35a1cd
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,60 @@
+export PYTHONUNBUFFERED=1
+export XAPIAN_VERSION=1.4.11
+export GPG_KEY=08E2400FF7FE8FEDE3ACB52818147B073BAD2B07
+
+set -ex
+apt-get update
+apt-get install --no-install-recommends --no-install-suggests -y gettext
+rm -r /var/lib/apt/lists/*
+
+wget -O xapian-core.tar.xz 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-core-$XAPIAN_VERSION.tar.xz";
+wget -O xapian-core.tar.xz.asc 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-core-$XAPIAN_VERSION.tar.xz.asc";
+wget -O xapian-bindings.tar.xz 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-bindings-$XAPIAN_VERSION.tar.xz";
+wget -O xapian-bindings.tar.xz.asc 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-bindings-$XAPIAN_VERSION.tar.xz.asc";
+
+export GNUPGHOME="$(mktemp -d)"
+{ \
+       found=''; \
+       for server in \
+               ha.pool.sks-keyservers.net \
+               hkp://keyserver.ubuntu.com:80 \
+               hkp://p80.pool.sks-keyservers.net:80 \
+               pgp.mit.edu \
+       ; do \
+               echo "Fetching GPG key $GPG_KEY from $server"; \
+               gpg --batch --keyserver $server --recv-keys "$GPG_KEY" && found=yes && break; \
+       done; \
+       test -z "$found" && { echo >&2 "error: failed to fetch GPG key $GPG_KEY" && exit 1; } || true; \
+}
+
+gpg --batch --verify xapian-core.tar.xz.asc xapian-core.tar.xz
+gpg --batch --verify xapian-bindings.tar.xz.asc xapian-bindings.tar.xz
+{ command -v gpgconf > /dev/null && gpgconf --kill all || :; }
+rm -r "$GNUPGHOME" xapian-core.tar.xz.asc xapian-bindings.tar.xz.asc
+
+mkdir -p /usr/src/xapian-core /usr/src/xapian-bindings
+tar -xJC /usr/src/xapian-core --strip-components=1 -f xapian-core.tar.xz
+tar -xJC /usr/src/xapian-bindings --strip-components=1 -f xapian-bindings.tar.xz
+rm xapian-core.tar.xz xapian-bindings.tar.xz
+
+cd /usr/src/xapian-core
+./configure
+make -j "$(nproc)"
+make install
+ldconfig
+
+cd /usr/src/xapian-bindings
+pip install 'Sphinx<2.0.0 '
+./configure --with-python3
+make -j "$(nproc)"
+make install
+pip freeze > /tmp/pip.txt
+pip uninstall -y -r /tmp/pip.txt
+rm /tmp/pip.txt
+# find /usr/local -depth \
+#              \( \
+#                      \( -type d -a \( -name test -o -name tests \) \) \
+#                      -o \
+#                      \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
+#              \) -exec rm -r '{}' + \;
+rm -r /usr/src/xapian-core /usr/src/xapian-bindings
diff --git a/openshift/docker/Dockerfile b/openshift/docker/Dockerfile
index 18648b8..276b1cf 100644
--- a/openshift/docker/Dockerfile
+++ b/openshift/docker/Dockerfile
@@ -6,62 +6,8 @@ ENV PYTHONUNBUFFERED=1 \
        XAPIAN_VERSION=1.4.11 \
        GPG_KEY=08E2400FF7FE8FEDE3ACB52818147B073BAD2B07
 
-RUN set -ex \
-       && apt-get update \
-       && apt-get install --no-install-recommends --no-install-suggests -y \
-               gettext \
-       && rm -r /var/lib/apt/lists/* \
-       && wget -O xapian-core.tar.xz 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-core-$XAPIAN_VERSION.tar.xz"; \
-       && wget -O xapian-core.tar.xz.asc 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-core-$XAPIAN_VERSION.tar.xz.asc"; \
-       && wget -O xapian-bindings.tar.xz 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-bindings-$XAPIAN_VERSION.tar.xz"; \
-       && wget -O xapian-bindings.tar.xz.asc 
"https://oligarchy.co.uk/xapian/$XAPIAN_VERSION/xapian-bindings-$XAPIAN_VERSION.tar.xz.asc"; \
-       && export GNUPGHOME="$(mktemp -d)" \
-       && \
-       { \
-       found=''; \
-       for server in \
-               ha.pool.sks-keyservers.net \
-               hkp://keyserver.ubuntu.com:80 \
-               hkp://p80.pool.sks-keyservers.net:80 \
-               pgp.mit.edu \
-       ; do \
-               echo "Fetching GPG key $GPG_KEY from $server"; \
-               gpg --batch --keyserver $server --recv-keys "$GPG_KEY" && found=yes && break; \
-       done; \
-       test -z "$found" && { echo >&2 "error: failed to fetch GPG key $GPG_KEY" && exit 1; } || true; \
-       } \
-       && gpg --batch --verify xapian-core.tar.xz.asc xapian-core.tar.xz \
-       && gpg --batch --verify xapian-bindings.tar.xz.asc xapian-bindings.tar.xz \
-       && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
-       && rm -r "$GNUPGHOME" xapian-core.tar.xz.asc xapian-bindings.tar.xz.asc \
-       && mkdir -p /usr/src/xapian-core \
-       && mkdir -p /usr/src/xapian-bindings \
-       && tar -xJC /usr/src/xapian-core --strip-components=1 -f xapian-core.tar.xz \
-       && rm xapian-core.tar.xz \
-       && tar -xJC /usr/src/xapian-bindings --strip-components=1 -f xapian-bindings.tar.xz \
-       && rm xapian-bindings.tar.xz \
-       && cd /usr/src/xapian-core \
-       && ./configure \
-       && make -j "$(nproc)" \
-       && make install \
-       && ldconfig \
-       && rm -r /usr/src/xapian-core \
-       && cd /usr/src/xapian-bindings \
-       && pip install Sphinx\<2.0.0 \
-       && ./configure \
-               --with-python3 \
-       && make -j "$(nproc)" \
-       && make install \
-       && pip freeze > /tmp/pip.txt \
-       && pip uninstall -y -r /tmp/pip.txt \
-       && rm /tmp/pip.txt \
-       && find /usr/local -depth \
-               \( \
-                       \( -type d -a \( -name test -o -name tests \) \) \
-                       -o \
-                       \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
-               \) -exec rm -r '{}' + \
-       && rm -r /usr/src/xapian-bindings
+ADD build.sh /build.sh
+RUN /build.sh && rm -f /build.sh
 
 RUN set -ex \
        && mkdir -p /extensions-web/app \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]