mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
moved tox to testenv
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
/build/
|
/build/
|
||||||
/dist/
|
/dist/
|
||||||
/kvmd.egg-info/
|
/kvmd.egg-info/
|
||||||
/.tox/
|
/testenv/.tox/
|
||||||
/.mypy_cache/
|
/testenv/.mypy_cache/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
|
|||||||
31
Makefile
31
Makefile
@@ -22,13 +22,14 @@ all:
|
|||||||
cat Makefile
|
cat Makefile
|
||||||
|
|
||||||
|
|
||||||
run-no-cache:
|
tox: _testenv
|
||||||
make run TESTENV_OPTS=--no-cache
|
- docker run --rm \
|
||||||
|
--volume `pwd`:/kvmd \
|
||||||
|
-it $(TESTENV_IMAGE) bash -c "cd kvmd && tox -c testenv/tox.ini"
|
||||||
|
|
||||||
|
|
||||||
run:
|
run: _testenv
|
||||||
sudo modprobe loop
|
sudo modprobe loop
|
||||||
docker build $(TESTENV_OPTS) --rm --tag $(TESTENV_IMAGE) -f testenv/Dockerfile .
|
|
||||||
- docker run --rm \
|
- docker run --rm \
|
||||||
--volume `pwd`/kvmd:/kvmd:ro \
|
--volume `pwd`/kvmd:/kvmd:ro \
|
||||||
--volume `pwd`/web:/usr/share/kvmd/web: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
|
- 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:
|
shell:
|
||||||
make run TESTENV_CMD=/bin/bash
|
make run TESTENV_CMD=/bin/bash
|
||||||
|
|
||||||
@@ -60,11 +65,6 @@ release:
|
|||||||
make push
|
make push
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
|
|
||||||
tox:
|
|
||||||
tox
|
|
||||||
|
|
||||||
|
|
||||||
bump:
|
bump:
|
||||||
bumpversion minor
|
bumpversion minor
|
||||||
|
|
||||||
@@ -76,9 +76,16 @@ push:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build site dist pkg src *.egg-info kvmd-*.tar.gz
|
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
|
make -C hid clean
|
||||||
|
|
||||||
|
|
||||||
clean-all: clean
|
clean-all: _testenv clean
|
||||||
rm -rf .tox .mypy_cache
|
- 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 .
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
FROM base/archlinux
|
FROM base/archlinux
|
||||||
|
|
||||||
|
RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
|
||||||
|
|
||||||
RUN pacman -Syu --noconfirm \
|
RUN pacman -Syu --noconfirm \
|
||||||
&& pacman -S --noconfirm \
|
&& pacman -S --noconfirm \
|
||||||
git \
|
git \
|
||||||
@@ -10,6 +12,8 @@ RUN pacman -Syu --noconfirm \
|
|||||||
expac \
|
expac \
|
||||||
jshon \
|
jshon \
|
||||||
sudo \
|
sudo \
|
||||||
|
systemd \
|
||||||
|
pkgconf \
|
||||||
&& pacman -Sc --noconfirm
|
&& pacman -Sc --noconfirm
|
||||||
|
|
||||||
RUN useradd -r -d / packer \
|
RUN useradd -r -d / packer \
|
||||||
@@ -33,20 +37,23 @@ COPY testenv/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
|
|||||||
RUN pacman -Syy \
|
RUN pacman -Syy \
|
||||||
&& user-packer -S --noconfirm \
|
&& user-packer -S --noconfirm \
|
||||||
customizepkg \
|
customizepkg \
|
||||||
|
&& mkdir /.npm \
|
||||||
|
&& chmod 777 /.npm \
|
||||||
&& user-packer -S --noconfirm \
|
&& user-packer -S --noconfirm \
|
||||||
python \
|
python \
|
||||||
python-pip \
|
python-pip \
|
||||||
python-systemd \
|
python-systemd \
|
||||||
nginx-mainline \
|
nginx-mainline \
|
||||||
|
lua51-cjson \
|
||||||
ustreamer \
|
ustreamer \
|
||||||
socat \
|
socat \
|
||||||
lua51-cjson \
|
htmlhint \
|
||||||
|
eslint \
|
||||||
|
&& rm -rf /.npm \
|
||||||
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
|
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
|
||||||
&& pacman -Sc --noconfirm
|
&& pacman -Sc --noconfirm
|
||||||
|
|
||||||
COPY testenv/requirements.txt requirements.txt
|
COPY testenv/requirements.txt requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
RUN dd if=/dev/zero of=/root/loop.img bs=1024 count=1048576
|
|
||||||
|
|
||||||
CMD /bin/bash
|
CMD /bin/bash
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ pyyaml
|
|||||||
pyserial
|
pyserial
|
||||||
setproctitle
|
setproctitle
|
||||||
systemd-python
|
systemd-python
|
||||||
bumpversion
|
|
||||||
tox
|
tox
|
||||||
|
|||||||
@@ -4,35 +4,36 @@ skipsdist = True
|
|||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python3.7
|
basepython = python3.7
|
||||||
|
changedir = /kvmd
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
commands = flake8 kvmd genmap.py
|
commands = flake8 --config=testenv/tox.ini kvmd genmap.py
|
||||||
deps =
|
deps =
|
||||||
flake8
|
flake8
|
||||||
flake8-double-quotes
|
flake8-double-quotes
|
||||||
-rtestenv/requirements.txt
|
-rrequirements.txt
|
||||||
|
|
||||||
[testenv:pylint]
|
[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 =
|
deps =
|
||||||
pylint
|
pylint
|
||||||
-rtestenv/requirements.txt
|
-rrequirements.txt
|
||||||
|
|
||||||
[testenv:mypy]
|
[testenv:mypy]
|
||||||
commands = mypy kvmd genmap.py
|
commands = mypy --config-file=testenv/mypy.ini --cache-dir=testenv/.mypy_cache kvmd genmap.py
|
||||||
deps =
|
deps =
|
||||||
mypy
|
mypy
|
||||||
-rtestenv/requirements.txt
|
-rrequirements.txt
|
||||||
|
|
||||||
[testenv:vulture]
|
[testenv:vulture]
|
||||||
commands = vulture kvmd genmap.py vulture-wl.py
|
commands = vulture kvmd genmap.py testenv/vulture-wl.py
|
||||||
deps =
|
deps =
|
||||||
vulture
|
vulture
|
||||||
-rtestenv/requirements.txt
|
-rrequirements.txt
|
||||||
|
|
||||||
[testenv:eslint]
|
[testenv:eslint]
|
||||||
whitelist_externals = 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]
|
[testenv:htmlhint]
|
||||||
whitelist_externals = htmlhint
|
whitelist_externals = htmlhint
|
||||||
Reference in New Issue
Block a user