Try running docker build commands
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
47
ci/docker/Dockerfile
Normal file
47
ci/docker/Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
||||
ARG PYTHON_TAG=3
|
||||
FROM python:${PYTHON_TAG}
|
||||
|
||||
RUN set -xeu ; \
|
||||
apt update ; \
|
||||
apt -yy full-upgrade ; \
|
||||
apt -yy install ca-certificates \
|
||||
libfontconfig1 \
|
||||
libfreetype6 \
|
||||
libx11-6 \
|
||||
libx11-xcb1 \
|
||||
libxext6 \
|
||||
libxfixes3 \
|
||||
libxi6 \
|
||||
libxrender1 \
|
||||
libxcb1 \
|
||||
libxcb-util1 \
|
||||
libxcb-glx0 \
|
||||
libxcb-keysyms1 \
|
||||
libxcb-image0 \
|
||||
libxcb-shm0 \
|
||||
libxcb-icccm4 \
|
||||
libxcb-sync1 \
|
||||
libxcb-xfixes0 \
|
||||
libxcb-shape0 \
|
||||
libxcb-randr0 \
|
||||
libxcb-render-util0 \
|
||||
libxcb-xinerama0 \
|
||||
libxkbcommon0 \
|
||||
libxkbcommon-x11-0 \
|
||||
libdbus-1-3 \
|
||||
xvfb xclip xsel xdotool; \
|
||||
python -m venv /venv ;\
|
||||
/venv/bin/pip install --upgrade pip ; \
|
||||
apt clean ; \
|
||||
rm -Rf /var/lib/apt/lists/* ; \
|
||||
mkdir /app
|
||||
|
||||
|
||||
|
||||
ADD run-tests /usr/local/bin
|
||||
ADD clilib /usr/local
|
||||
|
||||
VOLUME /app
|
||||
WORKDIR /app
|
||||
CMD ["/usr/local/bin/run-tests"]
|
||||
|
||||
55
ci/docker/clilib
Normal file
55
ci/docker/clilib
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
reset='\e[0m'
|
||||
bold='\e[1m'
|
||||
green='\e[92m'
|
||||
red='\e[91m'
|
||||
yellow='\e[93m'
|
||||
cyan='\e[96m'
|
||||
|
||||
status(){
|
||||
echo -e "$yellow$@$reset"
|
||||
}
|
||||
|
||||
ok() {
|
||||
echo -e " [ $green${bold}OK$reset ]"
|
||||
}
|
||||
|
||||
error(){
|
||||
echo -e "$red - $@$reset"
|
||||
}
|
||||
|
||||
failure(){
|
||||
echo -e "$red - $@$reset"
|
||||
exit
|
||||
}
|
||||
|
||||
info(){
|
||||
echo -e "$cyan$@$reset"
|
||||
}
|
||||
|
||||
infon(){
|
||||
echo -ne "$cyan$@$reset"
|
||||
}
|
||||
|
||||
|
||||
drawexit(){
|
||||
[ $1 -eq 0 ] && ok || error "Failed!"
|
||||
}
|
||||
|
||||
filelen(){
|
||||
wc -c $1 | cut -d' ' -f1
|
||||
}
|
||||
|
||||
wraperr(){
|
||||
$@ && rc=0 || rc=$?
|
||||
if [ $rc -eq 0 ]
|
||||
then
|
||||
ok 2>&1
|
||||
else
|
||||
error "Command failed: \"$@\"" 2>&1
|
||||
error "Return code: $rc" 2>&1
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
50
ci/docker/run-tests
Executable file
50
ci/docker/run-tests
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# source cli lib
|
||||
source /usr/local/clilib
|
||||
|
||||
status "Preparing XDG_RUNTIME_DIR"
|
||||
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-dir
|
||||
mkdir -p $XDG_RUNTIME_DIR
|
||||
|
||||
# setup exit trap
|
||||
function finish {
|
||||
status "Changing ownership of /app directory"
|
||||
perms=$(stat -c '%u:%g' /app)
|
||||
wraperr chown -R $perms /app
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
status "Loading venv"
|
||||
source /venv/bin/activate
|
||||
echo $VIRTUAL_ENV
|
||||
|
||||
status "Changing directory to /app"
|
||||
wraperr cd /app
|
||||
|
||||
status "Installing pip depenencies"
|
||||
wraperr pip install -r requirements.txt
|
||||
|
||||
status "Installing dev dependencies"
|
||||
wraperr pip install -r requirements.dev.
|
||||
|
||||
# TODO: fix later
|
||||
exit 0
|
||||
|
||||
status "Preparing data trees for tests..."
|
||||
wraperr bash -c "cd tests/_support_data; ./gen-data.sh"
|
||||
|
||||
status "Running tests itself"
|
||||
wraperr python3 -m pytest .\
|
||||
-v \
|
||||
-n auto \
|
||||
--ignore=tests/_support_data \
|
||||
--color=yes \
|
||||
--cov . \
|
||||
--cov-config .coveragerc \
|
||||
--cov-report term-missing \
|
||||
--cov-report html
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user