summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile31
-rw-r--r--testenv/Dockerfile13
-rw-r--r--testenv/eslintrc.yaml (renamed from eslintrc.yaml)0
-rw-r--r--testenv/mypy.ini (renamed from mypy.ini)0
-rw-r--r--testenv/pylintrc (renamed from pylintrc)0
-rw-r--r--testenv/requirements.txt1
-rw-r--r--testenv/tox.ini (renamed from tox.ini)19
-rw-r--r--testenv/vulture-wl.py (renamed from vulture-wl.py)0
9 files changed, 41 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index 1ed37632..ca39aeff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
/build/
/dist/
/kvmd.egg-info/
-/.tox/
-/.mypy_cache/
+/testenv/.tox/
+/testenv/.mypy_cache/
*.pyc
*.swp
diff --git a/Makefile b/Makefile
index 04d6ac06..fa7a440b 100644
--- a/Makefile
+++ b/Makefile
@@ -22,13 +22,14 @@ all:
cat Makefile
-run-no-cache:
- make run TESTENV_OPTS=--no-cache
+tox: _testenv
+ - docker run --rm \
+ --volume `pwd`:/kvmd \
+ -it $(TESTENV_IMAGE) bash -c "cd kvmd && tox -c testenv/tox.ini"
-run:
+run: _testenv
sudo modprobe loop
- docker build $(TESTENV_OPTS) --rm --tag $(TESTENV_IMAGE) -f testenv/Dockerfile .
- docker run --rm \
--volume `pwd`/kvmd:/kvmd:ro \
--volume `pwd`/web:/usr/share/kvmd/web:ro \
@@ -43,6 +44,10 @@ run:
- docker run --rm --device=$(TESTENV_LOOP):/dev/kvmd-msd -it $(TESTENV_IMAGE) losetup -d /dev/kvmd-msd
+run-no-cache:
+ make run TESTENV_OPTS=--no-cache
+
+
shell:
make run TESTENV_CMD=/bin/bash
@@ -60,11 +65,6 @@ release:
make push
make clean
-
-tox:
- tox
-
-
bump:
bumpversion minor
@@ -76,9 +76,16 @@ push:
clean:
rm -rf build site dist pkg src *.egg-info kvmd-*.tar.gz
- find -name __pycache__ | xargs rm -rf
+ find kvmd -name __pycache__ | xargs rm -rf
+ rm -rf __pycache__
make -C hid clean
-clean-all: clean
- rm -rf .tox .mypy_cache
+clean-all: _testenv clean
+ - docker run --rm \
+ --volume `pwd`:/kvmd \
+ -it $(TESTENV_IMAGE) bash -c "cd kvmd && rm -rf testenv/{.tox,.mypy_cache}"
+
+
+_testenv:
+ docker build $(TESTENV_OPTS) --rm --tag $(TESTENV_IMAGE) -f testenv/Dockerfile .
diff --git a/testenv/Dockerfile b/testenv/Dockerfile
index 90573038..59106908 100644
--- a/testenv/Dockerfile
+++ b/testenv/Dockerfile
@@ -1,5 +1,7 @@
FROM base/archlinux
+RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
+
RUN pacman -Syu --noconfirm \
&& pacman -S --noconfirm \
git \
@@ -10,6 +12,8 @@ RUN pacman -Syu --noconfirm \
expac \
jshon \
sudo \
+ systemd \
+ pkgconf \
&& pacman -Sc --noconfirm
RUN useradd -r -d / packer \
@@ -33,20 +37,23 @@ COPY testenv/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
RUN pacman -Syy \
&& user-packer -S --noconfirm \
customizepkg \
+ && mkdir /.npm \
+ && chmod 777 /.npm \
&& user-packer -S --noconfirm \
python \
python-pip \
python-systemd \
nginx-mainline \
+ lua51-cjson \
ustreamer \
socat \
- lua51-cjson \
+ htmlhint \
+ eslint \
+ && rm -rf /.npm \
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
&& pacman -Sc --noconfirm
COPY testenv/requirements.txt requirements.txt
RUN pip install -r requirements.txt
-RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
-
CMD /bin/bash
diff --git a/eslintrc.yaml b/testenv/eslintrc.yaml
index 8c3d07f9..8c3d07f9 100644
--- a/eslintrc.yaml
+++ b/testenv/eslintrc.yaml
diff --git a/mypy.ini b/testenv/mypy.ini
index df6699a4..df6699a4 100644
--- a/mypy.ini
+++ b/testenv/mypy.ini
diff --git a/pylintrc b/testenv/pylintrc
index 3adf052d..3adf052d 100644
--- a/pylintrc
+++ b/testenv/pylintrc
diff --git a/testenv/requirements.txt b/testenv/requirements.txt
index 54109c60..63aa4112 100644
--- a/testenv/requirements.txt
+++ b/testenv/requirements.txt
@@ -6,5 +6,4 @@ pyyaml
pyserial
setproctitle
systemd-python
-bumpversion
tox
diff --git a/tox.ini b/testenv/tox.ini
index 5eb99473..6d71a64c 100644
--- a/tox.ini
+++ b/testenv/tox.ini
@@ -4,35 +4,36 @@ skipsdist = True
[testenv]
basepython = python3.7
+changedir = /kvmd
[testenv:flake8]
-commands = flake8 kvmd genmap.py
+commands = flake8 --config=testenv/tox.ini kvmd genmap.py
deps =
flake8
flake8-double-quotes
- -rtestenv/requirements.txt
+ -rrequirements.txt
[testenv:pylint]
-commands = pylint --output-format=colorized --reports=no kvmd genmap.py
+commands = pylint --rcfile=testenv/pylintrc --output-format=colorized --reports=no kvmd genmap.py
deps =
pylint
- -rtestenv/requirements.txt
+ -rrequirements.txt
[testenv:mypy]
-commands = mypy kvmd genmap.py
+commands = mypy --config-file=testenv/mypy.ini --cache-dir=testenv/.mypy_cache kvmd genmap.py
deps =
mypy
- -rtestenv/requirements.txt
+ -rrequirements.txt
[testenv:vulture]
-commands = vulture kvmd genmap.py vulture-wl.py
+commands = vulture kvmd genmap.py testenv/vulture-wl.py
deps =
vulture
- -rtestenv/requirements.txt
+ -rrequirements.txt
[testenv:eslint]
whitelist_externals = eslint
-commands = eslint --config=eslintrc.yaml --color --ext .js web/js
+commands = eslint --config=testenv/eslintrc.yaml --color --ext .js web/js
[testenv:htmlhint]
whitelist_externals = htmlhint
diff --git a/vulture-wl.py b/testenv/vulture-wl.py
index 03e19ef6..03e19ef6 100644
--- a/vulture-wl.py
+++ b/testenv/vulture-wl.py