mirror of
https://github.com/balkian/bitter.git
synced 2024-12-22 00:18:12 +00:00
Added CI and tests
This commit is contained in:
parent
0a0d8fd5f1
commit
b212a46ab7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
__pycache__
|
||||||
*.egg-info
|
*.egg-info
|
||||||
dist
|
dist
|
||||||
env
|
env
|
||||||
|
7
Dockerfile-2.7
Normal file
7
Dockerfile-2.7
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# onbuild copies . to /usr/src/app/
|
||||||
|
From python:2.7-onbuild
|
||||||
|
Maintainer J. Fernando Sánchez @balkian
|
||||||
|
|
||||||
|
RUN pip install -e "/usr/src/app/[server]"
|
||||||
|
|
||||||
|
ENTRYPOINT ["bitter"]
|
7
Dockerfile-3.4
Normal file
7
Dockerfile-3.4
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# onbuild copies . to /usr/src/app/
|
||||||
|
From python:3.4-onbuild
|
||||||
|
Maintainer J. Fernando Sánchez @balkian
|
||||||
|
|
||||||
|
RUN pip install -e "/usr/src/app/[server]"
|
||||||
|
|
||||||
|
ENTRYPOINT ["bitter"]
|
7
Dockerfile.template
Normal file
7
Dockerfile.template
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# onbuild copies . to /usr/src/app/
|
||||||
|
From python:{{PYVERSION}}-onbuild
|
||||||
|
Maintainer J. Fernando Sánchez @balkian
|
||||||
|
|
||||||
|
RUN pip install -e "/usr/src/app/[server]"
|
||||||
|
|
||||||
|
ENTRYPOINT ["bitter"]
|
@ -5,4 +5,6 @@ include README.md
|
|||||||
include bitter/VERSION
|
include bitter/VERSION
|
||||||
graft bitter/templates
|
graft bitter/templates
|
||||||
graft bitter/static
|
graft bitter/static
|
||||||
graft test
|
include tests/test*
|
||||||
|
global-exclude *.pyc
|
||||||
|
global-exclude __pycache__
|
62
Makefile
Normal file
62
Makefile
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
PYVERSIONS=3.4 2.7
|
||||||
|
PYMAIN=$(firstword $(PYVERSIONS))
|
||||||
|
NAME=bitter
|
||||||
|
REPO=balkian
|
||||||
|
VERSION=$(shell cat $(NAME)/VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
all: build run
|
||||||
|
|
||||||
|
dockerfiles: $(addprefix Dockerfile-,$(PYVERSIONS))
|
||||||
|
|
||||||
|
Dockerfile-%: Dockerfile.template
|
||||||
|
sed "s/{{PYVERSION}}/$*/" Dockerfile.template > Dockerfile-$*
|
||||||
|
|
||||||
|
build: $(addprefix build-, $(PYMAIN))
|
||||||
|
|
||||||
|
buildall: $(addprefix build-, $(PYVERSIONS))
|
||||||
|
|
||||||
|
build-%: Dockerfile-%
|
||||||
|
docker build -t '$(REPO)/$(NAME):$(VERSION)-python$*' -f Dockerfile-$* .;
|
||||||
|
|
||||||
|
test: $(addprefix test-,$(PYMAIN))
|
||||||
|
|
||||||
|
testall: $(addprefix test-,$(PYVERSIONS))
|
||||||
|
|
||||||
|
test-%: build-%
|
||||||
|
docker run --rm -w /usr/src/app/ -v $$PWD/tests/credentials.json:/usr/src/app/tests/credentials.json --entrypoint=/usr/local/bin/python -ti '$(REPO)/$(NAME):$(VERSION)-python$*' setup.py test --addopts "-vvv -s --pdb" ;
|
||||||
|
|
||||||
|
pip_test-%:
|
||||||
|
docker run --rm -v $$PWD/dist:/dist/ -ti python:$* pip install /dist/$(NAME)-$(VERSION).tar.gz ;
|
||||||
|
|
||||||
|
dist/$(NAME)-$(VERSION).tar.gz:
|
||||||
|
docker run --rm -ti -v $$PWD:/usr/src/app/ -w /usr/src/app/ python:$(PYMAIN) python setup.py sdist;
|
||||||
|
|
||||||
|
sdist: dist/$(NAME)-$(VERSION).tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
upload-%: test-%
|
||||||
|
docker push '$(REPO)/$(NAME):$(VERSION)-python$(PYMAIN)'
|
||||||
|
|
||||||
|
upload: testall $(addprefix upload-,$(PYVERSIONS))
|
||||||
|
docker tag '$(REPO)/$(NAME):$(VERSION)-python$(PYMAIN)' '$(REPO)/$(NAME):$(VERSION)'
|
||||||
|
docker tag '$(REPO)/$(NAME):$(VERSION)-python$(PYMAIN)' '$(REPO)/$(NAME)'
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@docker ps -a | awk '/$(REPO)\/$(NAME)/{ split($$2, vers, "-"); if(vers[1] != "${VERSION}"){ print $$1;}}' | xargs docker rm 2>/dev/null|| true
|
||||||
|
@docker images | awk '/$(REPO)\/$(NAME)/{ split($$2, vers, "-"); if(vers[1] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true
|
||||||
|
|
||||||
|
upload_git:
|
||||||
|
git commit -a
|
||||||
|
git tag ${VERSION}
|
||||||
|
git push --tags origin master
|
||||||
|
|
||||||
|
pip_upload:
|
||||||
|
python setup.py sdist upload ;
|
||||||
|
|
||||||
|
pip_test: $(addprefix pip_test-,$(PYVERSIONS))
|
||||||
|
|
||||||
|
run: build
|
||||||
|
docker run --rm -p 5000:5000 -ti '$(REPO)/$(NAME):$(VERSION)-python$(PYMAIN)'
|
||||||
|
|
||||||
|
.PHONY: test test-% build-% build test test_pip run
|
@ -14,9 +14,13 @@ from multiprocessing.pool import ThreadPool
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from itertools import islice, chain
|
from itertools import islice, chain
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from future.moves.itertools import zip_longest
|
|
||||||
|
try:
|
||||||
|
from itertools import izip_longest
|
||||||
|
except ImportError:
|
||||||
|
from itertools import zip_longest
|
||||||
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
from builtins import map, filter
|
from builtins import map, filter
|
||||||
|
4
setup.cfg
Normal file
4
setup.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[metadata]
|
||||||
|
description-file = README.md
|
||||||
|
[aliases]
|
||||||
|
test=pytest
|
2
setup.py
2
setup.py
@ -38,7 +38,7 @@ setup(
|
|||||||
extras_require = {
|
extras_require = {
|
||||||
'server': ['flask', 'flask-oauthlib']
|
'server': ['flask', 'flask-oauthlib']
|
||||||
},
|
},
|
||||||
test_suite="tests",
|
setup_requires=['pytest-runner',],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points="""
|
entry_points="""
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
|
Loading…
Reference in New Issue
Block a user