Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit df1a480

Browse files
committed
add - automatic deployment for Pypi and Dockerhub
1 parent 2d61d22 commit df1a480

File tree

6 files changed

+22
-844
lines changed

6 files changed

+22
-844
lines changed

.env.gen

Lines changed: 0 additions & 55 deletions
This file was deleted.

.env.required

Lines changed: 0 additions & 4 deletions
This file was deleted.

.travis.yml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,14 @@ language: python
22
python:
33
- "3.6"
44

5-
env:
6-
- POSTGRES_PASSWORD=postgres
7-
- PATTON_HTTP_PORT=8000
8-
- PATTON_HTTP_WORKERS=1
9-
10-
services:
11-
- postgresql
12-
- docker
13-
14-
# command to install dependencies
15-
#install: "make"
16-
17-
#addons:
18-
# apt:
19-
# packages:
20-
# - libenchant-dev
21-
22-
# command to run tests
23-
#script:
24-
# - make lint test-coverage codecov
25-
265
deploy:
276

28-
# Deploy to PyPI
29-
- provider: pypi
30-
user: $PYPI_USER
31-
password: $PYPI_PASSWD
32-
distributions: "sdist"
33-
skip_cleanup: true
7+
- provider: script
8+
execute: make upload-pypi
9+
on:
10+
branch: tag
11+
12+
- provider: script
13+
execute: make upload-docker
3414
on:
3515
branch: tag

Makefile

Lines changed: 15 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
.DEFAULT_GOAL := help
33

44

5-
# AutoEnv
6-
ifeq (${CI},) # This ensures the CI skips dotenv
7-
ENV ?= .env
8-
ENV_GEN := $(shell ./.env.gen ${ENV} .env.required)
9-
endif
10-
11-
125
# AutoDoc
136
define PRINT_HELP_PYSCRIPT
147
import re, sys
@@ -41,78 +34,18 @@ wipe: ## remove all files and changes not tracked in CVS
4134
test: install-dev ## run tests quickly with the default Python
4235
@pipenv run py.test
4336

44-
pipenv:
45-
@pip show pipenv -q || (pip install -U pipenv && echo '-----')
46-
47-
.PHONY: install
48-
install: pipenv ## install production packages
49-
@pipenv install
50-
51-
install-dev: pipenv ## install development packages
52-
@pipenv install --dev
53-
54-
.PHONY: lint
55-
lint: pipenv ## check style
56-
@pipenv check --style .
57-
58-
.PHONY: licence
59-
license: install-dev ## check license incompatibilities
60-
@pipenv run yolk -l -f License | grep 'GPL' -B 1
61-
62-
.PHONY: test-coverage
63-
test-coverage: install-dev ## check code coverage
64-
@pipenv run coverage run --source=patton -m pytest
65-
@pipenv run coverage report -m # --fail-under 80
66-
@pipenv run coverage xml -o coverage-reports/report.xml
67-
68-
69-
.PHONY: codecov
70-
codecov: ## push to codecov the coverage
71-
@pipenv run codecov
72-
73-
.PHONY: version
74-
version:
75-
@echo 0.0.3 #version
76-
77-
bump-%:
78-
@pipenv run bumpversion $*
79-
@git push
80-
@git push --tags
81-
82-
83-
.PHONY: run
84-
run: require-pipenv ## Run locally a web instance
85-
@pipenv run python main.py
86-
87-
88-
.PHONY: compose
89-
compose: ## run locally your application
90-
@docker-compose up -d --build
91-
92-
93-
.PHONY: compose-init
94-
compose-init: ## populate db
95-
@docker-compose run patton \
96-
bash -c "bash ./load_assets.sh ; python main.py -r"
97-
98-
99-
.PHONY: repl
100-
repl: require-pipenv ## Run locally a web instance
101-
@pipenv run ipython
102-
103-
104-
.PHONY: watch
105-
watch: require-ag require-entr ## Reload on code changes
106-
@ag -l -G py | entr -r make run
107-
108-
.PHONY: recreate
109-
recreate: install ## reinstalls the db
110-
@pipenv run ./load_assets.sh
111-
@pipenv run python main.py -r
112-
113-
.PHONY: docs
114-
docs: install-dev ## generate and shows documentation
115-
@pipenv run make -C docs spelling html
116-
# Replace files with .md extension with .html extension
117-
-@find ./docs/_build/ -name '*.html' -exec sed -i 's/\(\w*\)\.md\(W*\)/\1.html\2/g' {} \;
118-
@python -m webbrowser -t docs/_build/html/index.html
37+
.PHONY: upload-pypi
38+
upload-pypi:
39+
pip install --upgrade pip setuptools wheel
40+
pip install twine
41+
python setup.py sdist
42+
twine upload dist/* --skip-existing --username "$PYPI_PASSWD" --password "$PYPI_USER"
43+
44+
.PHONY: upload-docker
45+
upload-docker:
46+
docker login -u $DOCKER_USER -p $DOCKER_PASS
47+
docker build -t patton-server .
48+
docker tag patton-server ${DOCKER_USER}/patton-server:`cat VERSION`
49+
docker push ${DOCKER_USER}/patton-server:`cat VERSION`
50+
docker tag patton-server ${DOCKER_USER}/patton-server:latest
51+
docker push ${DOCKER_USER}/patton-server:latest

Pipfile

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)