Try running docker build commands
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
parent
4b7f292beb
commit
c41d31a8cd
5
.laminar
5
.laminar
|
@ -29,11 +29,6 @@ then
|
|||
|
||||
#green "Dump of docker-env:"
|
||||
#cat ../docker-env
|
||||
|
||||
|
||||
# TODO: fix later
|
||||
exit 0
|
||||
|
||||
cd ci
|
||||
|
||||
#green "Dump docker-compose config:"
|
||||
|
|
30
ci/docker-compose.yml
Normal file
30
ci/docker-compose.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
sut:
|
||||
build:
|
||||
context: docker
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
PYTHON_TAG: ${PYTHON:-3}-bullseye
|
||||
volumes:
|
||||
# Project data
|
||||
- type: bind
|
||||
source: ../
|
||||
target: /app
|
||||
read_only: false
|
||||
# pip cache
|
||||
- type: volume
|
||||
source: pip-cache
|
||||
target: /root/.cache/pip
|
||||
volume:
|
||||
nocopy: true
|
||||
|
||||
# environment file to passthrough environment from laminar - generated by laminar init template
|
||||
# automatically-generated docker-env is situated in parent of repo dir (two levels up)
|
||||
env_file: ${ENVFILE:-../../docker-env}
|
||||
# make it faster
|
||||
tmpfs: /tmp
|
||||
|
||||
volumes:
|
||||
pip-cache: # cache for pip
|
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
|
||||
|
3
ci/static-docker-env
Normal file
3
ci/static-docker-env
Normal file
|
@ -0,0 +1,3 @@
|
|||
# This is just dummy file which would be replaced by one generated in CI pipeline
|
||||
PYTHON=3
|
||||
|
5
requirements.dev.txt
Normal file
5
requirements.dev.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
-r requirements.txt
|
||||
pytest==6.2.5
|
||||
pyinstaller==4.5.1
|
||||
pytest-xdist==2.3.0
|
||||
pytest-cov==2.12.1
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
gitdb==4.0.9
|
||||
GitPython==3.1.27
|
||||
smmap==5.0.0
|
Loading…
Reference in New Issue
Block a user