Tests: cleanup and tidy docker definitions and scripts wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 24 Nov 2022 17:21:53 +0100
branchwxPython4
changeset 3693 4058140a8757
parent 3692 a9b787d84846
child 3694 129b8e32f5bb
Tests: cleanup and tidy docker definitions and scripts
.github/workflows/run_tests_in_docker.yml
tests/tools/Docker/Dockerfile
tests/tools/Docker/beremiz-requirements/Dockerfile
tests/tools/Docker/beremiz-sikuli/Dockerfile
tests/tools/Docker/beremiz-sikuli/build_docker_image.sh
tests/tools/Docker/beremiz-sikuli/clean_docker_container.sh
tests/tools/Docker/beremiz-sikuli/clean_docker_image.sh
tests/tools/Docker/beremiz-sikuli/create_docker_container.sh
tests/tools/Docker/beremiz-sikuli/do_test_in_docker.sh
tests/tools/Docker/beremiz-sikuli/enter_docker.sh
tests/tools/Docker/beremiz-sikuli/enter_docker_as_root.sh
tests/tools/Docker/beremiz-sikuli/rebuild_docker.sh
tests/tools/Docker/build_docker_image.sh
tests/tools/Docker/clean_docker_container.sh
tests/tools/Docker/clean_docker_image.sh
tests/tools/Docker/create_docker_container.sh
tests/tools/Docker/do_test_in_docker.sh
tests/tools/Docker/enter_docker.sh
tests/tools/Docker/enter_docker_as_root.sh
tests/tools/Docker/python2.7-wxpython/Dockerfile
tests/tools/Docker/rebuild_docker.sh
--- a/.github/workflows/run_tests_in_docker.yml	Thu Nov 24 16:12:03 2022 +0100
+++ b/.github/workflows/run_tests_in_docker.yml	Thu Nov 24 17:21:53 2022 +0100
@@ -40,7 +40,7 @@
     - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
       name: Create docker image
       run: |
-        cd beremiz/tests/tools/Docker/beremiz-sikuli
+        cd beremiz/tests/tools/Docker
         ./build_docker_image.sh
         docker image save --output="/tmp/latest.tar" beremiz_sikuli
 
@@ -51,12 +51,12 @@
 
     - name: Create docker container
       run: |
-        cd beremiz/tests/tools/Docker/beremiz-sikuli
+        cd beremiz/tests/tools/Docker
         ./create_docker_container.sh ${{ github.workspace }}/test
         
     - name: Run tests in docker
       run: |
-        cd beremiz/tests/tools/Docker/beremiz-sikuli
+        cd beremiz/tests/tools/Docker
         ./do_test_in_docker.sh
 
     - name: Upload test resuts artifact
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/Dockerfile	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,79 @@
+#
+# Dockerfile for Beremiz
+# This container is used to run tests for Beremiz
+#
+FROM ubuntu:focal  
+                                        
+ENV TERM xterm-256color
+    
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
+
+ARG UNAME=testing
+ENV UNAME ${UNAME}
+ARG UID=1000
+ARG GID=1000
+RUN groupadd -g $GID $UNAME
+RUN useradd -m -u $UID -g $GID -s /bin/bash $UNAME
+
+RUN set -xe \
+    && apt-get update \
+    && TZ="America/Paris" \
+       DEBIAN_FRONTEND="noninteractive" \
+       apt-get install -y --no-install-recommends \
+               `# to run sikuli` \
+               wget \
+               libopencv4.2-java \
+               openjdk-11-jre \
+               \
+               `# to run X based tests` \
+               fluxbox \
+               wmctrl xdotool xvfb \
+               x11vnc xterm xnest \
+               materia-gtk-theme \
+               \
+               `# to build tested apps` \
+               build-essential automake flex bison mercurial \
+               libgtk-3-dev libgl1-mesa-dev libglu1-mesa-dev \
+               libpython2.7-dev libssl-dev \
+               python2 virtualenv cmake
+
+
+# force bigger font and flat theme for GTK in order to make OCR more reliable
+RUN mkdir -p /etc/gtk-3.0
+RUN env echo -e '[Settings]\ngtk-font-name=FreeSans,12\ngtk-theme-name=Materia\n' > /etc/gtk-3.0/settings.ini
+
+# link obtained from https://raiman.github.io/SikuliX1/downloads.html
+RUN set -xe && \
+    wget -qP /usr/local/bin \
+        https://launchpad.net/sikuli/sikulix/2.0.5/+download/sikulixide-2.0.5.jar && \
+    echo 0795f1e0866ee5a7a84e4c89793ea78c /usr/local/bin/sikulixide-2.0.5.jar | md5sum -c && \
+    ( echo '#!/bin/sh' && \
+      echo "exec java -jar /usr/local/bin/sikulixide-*.jar \"\$@\"" \
+    ) | install /dev/stdin /usr/local/bin/sikulix
+
+
+RUN env echo -e '#!/bin/bash\nmake -f /home/testing/src/beremiz/tests/Makefile $*' > /usr/local/bin/do_tests
+RUN chmod +x /usr/local/bin/do_tests
+
+USER $UNAME
+
+RUN mkdir /home/$UNAME/build /home/$UNAME/src /home/$UNAME/test
+
+RUN virtualenv --python=$(which python2) ~/beremizenv
+
+RUN ~/beremizenv/bin/pip install \
+        pytest pytest-timeout ddt \
+        lxml future matplotlib zeroconf2 enum34 pyro sslpsk posix_spawn \
+        twisted nevow autobahn click opcua \
+        wxPython==4.1.1
+
+# Point to python binary test scripts will use
+ENV BEREMIZPYTHONPATH /home/$UNAME/beremizenv/bin/python
+
+# easy to remember 'do_tests' alias to invoke main makefile
+ARG OWNDIRBASENAME=beremiz
+ENV OWNDIRBASENAME ${OWNDIRBASENAME}
+
+
--- a/tests/tools/Docker/beremiz-requirements/Dockerfile	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#
-# Dockerfile for Beremiz
-# This container is used to run tests for Beremiz
-#
-# To run test localy use following command executed from beremiz directory:
-# $ docker run --volume=$PWD:/beremiz --workdir="/beremiz" --volume=$PWD/../CanFestival-3:/CanFestival-3 --memory=1g --entrypoint=/beremiz/tests/tools/check_source.sh skvorl/beremiz-requirements
-#
-
-FROM skvorl/python2.7-wxpython
-MAINTAINER Andrey Skvortsov <andrej.skvortzov@gmail.com>
-
-RUN set -xe \
-    && apt-get update \
-    && apt-get install -y --no-install-recommends \
-               python-nevow \
-               python-lxml \
-               python-zeroconf \
-               python-m2crypto \
-               python-autobahn \
-               python-future \
-               python-simplejson \
-    && apt-get install -y --no-install-recommends ca-certificates \
-    && apt-get install -y --no-install-recommends wxglade python-cwiid \
-    && apt-get install -y --no-install-recommends build-essential automake flex bison mercurial python-pip \
-    && apt-get install -y --no-install-recommends \
-               pep8 \
-               pylint \
-               python-pytest \
-               python-pytest-timeout \
-               gettext \
-               python-ddt \
-               libpython2.7-dev \
-    \
-    && apt-get install -y python3-pip \
-    && pip3 install crossbar \
-    \
-    && /usr/bin/pip install gnosis \
-                            pyro \
-                            sslpsk \
-                            posix_spawn \
-    && cd / \
-    && hg clone http://dev.automforge.net/CanFestival-3 \
-    && cd CanFestival-3 \
-    && ./configure \
-    \
-    && cd / \
-    && hg clone -r 24ef30a9bcee1e65b027be2c7f7a8d52c41a7479 https://bitbucket.org/automforge/matiec \
-    && cd matiec \
-    && autoreconf -i \
-    && ./configure \
-    && make \
-    && make install \
-    && mkdir /usr/lib/matiec \
-    && cp -vR lib/* /usr/lib/matiec \
-    && rm -rf /matiec \
-    \
-    && cd / \
-    && hg clone https://bitbucket.org/mjsousa/modbus Modbus \
-    && cd Modbus \
-    && make \
-    \
-    && cd / \
-    && svn checkout https://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack/ BACnet \
-    && cd BACnet \
-    && make MAKE_DEFINE='-fPIC' all \
-    \
-    && apt-get remove -y bison flex automake python-pip python3-pip libpython2.7-dev \
-    && apt-get autoremove -y \
-    && apt-get clean -y \
--- a/tests/tools/Docker/beremiz-sikuli/Dockerfile	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#
-# Dockerfile for Beremiz
-# This container is used to run tests for Beremiz
-#
-FROM ubuntu:focal  
-                                        
-ENV TERM xterm-256color
-    
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
-
-ARG UNAME=testing
-ENV UNAME ${UNAME}
-ARG UID=1000
-ARG GID=1000
-RUN groupadd -g $GID $UNAME
-RUN useradd -m -u $UID -g $GID -s /bin/bash $UNAME
-
-RUN set -xe \
-    && apt-get update \
-    && TZ="America/Paris" \
-       DEBIAN_FRONTEND="noninteractive" \
-       apt-get install -y --no-install-recommends \
-               `# to run sikuli` \
-               wget \
-               libopencv4.2-java \
-               openjdk-11-jre \
-               \
-               `# to run X based tests` \
-               fluxbox \
-               wmctrl xdotool xvfb \
-               x11vnc xterm xnest \
-               materia-gtk-theme \
-               \
-               `# to build tested apps` \
-               build-essential automake flex bison mercurial \
-               libgtk-3-dev libgl1-mesa-dev libglu1-mesa-dev \
-               libpython2.7-dev libssl-dev \
-               python2 virtualenv cmake
-
-
-# force bigger font and flat theme for GTK in order to make OCR more reliable
-RUN mkdir -p /etc/gtk-3.0
-RUN env echo -e '[Settings]\ngtk-font-name=FreeSans,12\ngtk-theme-name=Materia\n' > /etc/gtk-3.0/settings.ini
-
-# link obtained from https://raiman.github.io/SikuliX1/downloads.html
-RUN set -xe && \
-    wget -qP /usr/local/bin \
-        https://launchpad.net/sikuli/sikulix/2.0.5/+download/sikulixide-2.0.5.jar && \
-    echo 0795f1e0866ee5a7a84e4c89793ea78c /usr/local/bin/sikulixide-2.0.5.jar | md5sum -c && \
-    ( echo '#!/bin/sh' && \
-      echo "exec java -jar /usr/local/bin/sikulixide-*.jar \"\$@\"" \
-    ) | install /dev/stdin /usr/local/bin/sikulix
-
-
-RUN env echo -e '#!/bin/bash\nmake -f /home/testing/src/beremiz/tests/Makefile $*' > /usr/local/bin/do_tests
-RUN chmod +x /usr/local/bin/do_tests
-
-USER $UNAME
-
-RUN mkdir /home/$UNAME/build /home/$UNAME/src /home/$UNAME/test
-
-RUN virtualenv --python=$(which python2) ~/beremizenv
-
-RUN ~/beremizenv/bin/pip install \
-        pytest pytest-timeout ddt \
-        lxml future matplotlib zeroconf2 enum34 pyro sslpsk posix_spawn \
-        twisted nevow autobahn click opcua \
-        wxPython==4.1.1
-
-# Point to python binary test scripts will use
-ENV BEREMIZPYTHONPATH /home/$UNAME/beremizenv/bin/python
-
-# easy to remember 'do_tests' alias to invoke main makefile
-ARG OWNDIRBASENAME=beremiz
-ENV OWNDIRBASENAME ${OWNDIRBASENAME}
-
-
--- a/tests/tools/Docker/beremiz-sikuli/build_docker_image.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-set -e
-
-echo "Building docker image"
-docker build \
-    --build-arg UID=$(id -u) \
-    --build-arg GID=$(id -g) \
-    -t beremiz_sikuli .
-
--- a/tests/tools/Docker/beremiz-sikuli/clean_docker_container.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# delete container
-docker rm beremiz_sikuli_current
-
--- a/tests/tools/Docker/beremiz-sikuli/clean_docker_image.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# delete image
-docker rmi beremiz_sikuli
-
--- a/tests/tools/Docker/beremiz-sikuli/create_docker_container.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# source directory containing beremiz, matiec, etc..
-SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../../.. && pwd )"
-echo "SOURCE direcory : $SRCDIR"
-
-# absolute path to test directory. ~/test if not given as only argument
-TESTDIR=${1:-~/test}
-mkdir -p $TESTDIR
-echo "TEST direcory : $TESTDIR"
-
-UNAME=testing
-UHOME=/home/$UNAME
-
-# define TESTDEBUG in env to enable dev-mode. This enables :
-#   - debug pasthrough for Xnest
-#   - VNC port passthrough
-DEBUGARGS="-v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=$DISPLAY -p 5900:5900"
-
-echo "Creating docker container"
-docker create \
-       --name beremiz_sikuli_current \
-       -v $SRCDIR:$UHOME/src \
-       -v $TESTDIR:$UHOME/test \
-       `if [ "$TESTDEBUG" == "YES" ]; then echo $DEBUGARGS; fi` \
-       -w $UHOME/test \
-       -i -t beremiz_sikuli /bin/bash
-
--- a/tests/tools/Docker/beremiz-sikuli/do_test_in_docker.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-set -e
-
-CONTAINER=beremiz_sikuli_current
-
-docker stop $CONTAINER
-docker start $CONTAINER 
-docker exec $CONTAINER bash -c "do_tests $1"
-docker stop $CONTAINER
-
--- a/tests/tools/Docker/beremiz-sikuli/enter_docker.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-CONTAINER=beremiz_sikuli_current
-
-docker start -i $CONTAINER
--- a/tests/tools/Docker/beremiz-sikuli/enter_docker_as_root.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-CONTAINER=beremiz_sikuli_current
-
-docker start $CONTAINER
-docker exec -i -t -u root $CONTAINER bash
-docker stop $CONTAINER
--- a/tests/tools/Docker/beremiz-sikuli/rebuild_docker.sh	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-set -e
-
-./clean_docker_container.sh || true
-./clean_docker_image.sh || true
-./build_docker_image.sh
-./create_docker_container.sh $1
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/build_docker_image.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -e
+
+echo "Building docker image"
+docker build \
+    --build-arg UID=$(id -u) \
+    --build-arg GID=$(id -g) \
+    -t beremiz_sikuli .
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/clean_docker_container.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# delete container
+docker rm beremiz_sikuli_current
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/clean_docker_image.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# delete image
+docker rmi beremiz_sikuli
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/create_docker_container.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -e
+
+# source directory containing beremiz, matiec, etc..
+SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../../../.. && pwd )"
+echo "SOURCE direcory : $SRCDIR"
+
+# absolute path to test directory. ~/test if not given as only argument
+TESTDIR=${1:-~/test}
+mkdir -p $TESTDIR
+echo "TEST direcory : $TESTDIR"
+
+UNAME=testing
+UHOME=/home/$UNAME
+
+# define TESTDEBUG in env to enable dev-mode. This enables :
+#   - debug pasthrough for Xnest
+#   - VNC port passthrough
+DEBUGARGS="-v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -e DISPLAY=$DISPLAY -p 5900:5900"
+
+echo "Creating docker container"
+docker create \
+       --name beremiz_sikuli_current \
+       -v $SRCDIR:$UHOME/src \
+       -v $TESTDIR:$UHOME/test \
+       `if [ "$TESTDEBUG" == "YES" ]; then echo $DEBUGARGS; fi` \
+       -w $UHOME/test \
+       -i -t beremiz_sikuli /bin/bash
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/do_test_in_docker.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+CONTAINER=beremiz_sikuli_current
+
+docker stop $CONTAINER
+docker start $CONTAINER 
+docker exec $CONTAINER bash -c "do_tests $1"
+docker stop $CONTAINER
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/enter_docker.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+CONTAINER=beremiz_sikuli_current
+
+docker start -i $CONTAINER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/enter_docker_as_root.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+CONTAINER=beremiz_sikuli_current
+
+docker start $CONTAINER
+docker exec -i -t -u root $CONTAINER bash
+docker stop $CONTAINER
--- a/tests/tools/Docker/python2.7-wxpython/Dockerfile	Thu Nov 24 16:12:03 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#
-# Dockerfile for wxPython3.0 running on python2.7
-#
-
-FROM python:2.7-stretch
-
-RUN set -xe \
-    && apt-get update \
-    && apt-get install -y --no-install-recommends python-wxgtk3.0 python-matplotlib \
-    && apt-get install -y --no-install-recommends python-xvfbwrapper xvfb \
-    && apt-get clean
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tools/Docker/rebuild_docker.sh	Thu Nov 24 17:21:53 2022 +0100
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+
+./clean_docker_container.sh || true
+./clean_docker_image.sh || true
+./build_docker_image.sh
+./create_docker_container.sh $1
+