-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
109 lines (91 loc) · 2.71 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# https://taskfile.dev
version: '3'
dotenv: ['.env']
tasks:
default:
desc: print task list
cmds:
- task --list-all
mqtt:
desc: start mqtt server
cmds:
- sudo docker rm mqtt-dev --force || true
- sudo docker run --name mqtt-dev -d -p 1883:1883 -e MOSQUITTO_USERNAME=admin -e MOSQUITTO_PASSWORD=admin docker.io/shanisma/paho-mqtt:1.6.2
redis:
desc: start redis server
cmds:
- sudo docker rm redis-dev --force || true
- sudo docker run --name redis-dev -d -p 6379:6379 redis:6.0.10-alpine
pg:
desc: start postgres
cmds:
- sudo docker rm postgres-dev --force || true
- sudo docker run --name postgres-dev -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres postgres -c log_statement=all
celery:
desc: start celery worker
cmds:
- celery -A project worker -l info
up-db:
desc: run db initialization
cmds:
- task pg
- sleep 5
- find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
- find . -path "*/migrations/*.pyc" -delete
- python init.py
build-dev:
desc: build docker image dev
cmds:
- sudo docker build -t {{.IMAGE}}:{{.TAG}} .
- sudo docker tag {{.IMAGE}}:{{.TAG}} {{.IMAGE}}:latest
- sudo docker push {{.IMAGE}}:{{.TAG}}
- sudo docker push {{.IMAGE}}:latest
vars:
IMAGE: docker.io/shanisma/og-core
TAG: 0.0.10
start-api:
desc: start api
cmds:
- task up-db
- python manage.py runserver 0.0.0.0:8001
test-core:
desc: run /core/tests py files
cmds:
- python ${PWD}/core/tests/test_base_controller.py
- python ${PWD}/core/tests/test_base_time_range_controller.py
test-api:
desc: test apis
cmds:
- python manage.py test glbl
- python manage.py test sprinkler
- python manage.py test water
- python manage.py test light
test:
desc: run all test
cmds:
- task up-db
- test-core
- test-api
pf:
desc: freeze Python requirements.txt
cmds:
- pipenv run pip freeze > requirements.txt
r:
desc: get urls for reverse usage
cmds:
- task up-db
- python get_routes.py
o:
desc: generate openapi schema
cmds:
- wget http://0.0.0.0:8001/\?format\=openapi -O _.json
- cat _.json | jq "." > openapi-schema.json
- rm _.json
py-sdk:
desc: generate python sdk og-core-api
cmds:
- openapi-generator-cli generate -i openapi-schema.json -g python -o ../og-py-openapi-client --package-name "og_client"
js-sdk:
desc: generate javascript sdk og-core-api
cmds:
- openapi-generator-cli generate -i openapi-schema.json -g javascript -o ../og-ts-openapi-client