forked from autogoal/autogoal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
133 lines (110 loc) · 4.18 KB
/
makefile
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# ^ _ ____ ___ ^ _
# / \ _ _| |_ ___ / ___|/ _ \ / \ | |
# / _ \| | | | __/ _ \| |_ _| | | |/ _ \ | |
# / ___ \ |_| | || (_) | |_| | |_| / ___ \| |___
# /_/ \_\__,_|\__\___/ \____|\___/_/ \_\_____|
#
# Usage: make [command]
#
# ---------------------------------------------------------------------------
# The following commands can be run anywhere.
# ---------------------------------------------------------------------------
#
# help Show this information.
.PHONY: help
help:
cat makefile | grep -oP "^# \K(.*)"
# clean Remove (!) all untracked and ignored files.
.PHONY: clean
clean:
git clean -xdff
#
# ---------------------------------------------------------------------------
# The following commands must be run OUTSIDE the development environment.
# ---------------------------------------------------------------------------
#
# docker Builds the development image from scratch.
.PHONY: docker
docker:
docker build -t autogoal/autogoal:latest .
# pull Pull the development image.
.PHONY: pull
pull:
docker pull autogoal/autogoal:latest
# push Push the development image to Docker Hub.
.PHONY: push
push:
docker push autogoal/autogoal:latest
# shell Opens a shell in the development image.
.PHONY: shell
shell:
docker-compose run autogoal bash
# demo Run the demo in the development image.
.PHONY: demo
demo:
docker-compose run autogoal
# mkdocs Run the docs server in the development image.
.PHONY: mkdocs
mkdocs:
docker-compose run autogoal mkdocs serve -a 0.0.0.0:8000
# test-ci Test only the core code in a newly built image.
.PHONY: test-ci
test-ci:
docker build -t autogoal:basic -f tests/basic.dockerfile .
#
# ---------------------------------------------------------------------------
# The following commands must be run INSIDE the development environment.
# ---------------------------------------------------------------------------
#
.PHONY: ensure-dev
ensure-dev:
echo ${BUILD_ENVIRONMENT} | grep "development" >> /dev/null
.PHONY: docs-dev
docs-dev:
python3 -m illiterate --inline autogoal docs/api
python3 -m illiterate --inline tests/examples docs/examples
python3 -m illiterate --inline tests/guide docs/guide
cp Readme.md docs/index.md
# python3 -m typer_cli autogoal/__main__.py utils docs > docs/cli-api.md
# docs Compile and publish the documentation to Github.
.PHONY: docs
docs: ensure-dev docs-dev
mkdocs build
# gh-deploy Deploy docs to Github Pages
.PHONY: gh-deploy
gh-deploy: ensure-dev docs-dev
git remote add pages git@github.com:autogoal/autogoal.github.io || echo "remote exists"
mkdocs gh-deploy -r pages -b master --force
# format Format all source code inplace using `black`.
.PHONY: format
format: ensure-dev
(git status | grep "nothing to commit") && sudo black autogoal/ tests/ || echo "(!) REFUSING TO REFORMAT WITH UNCOMMITED CHANGES" && exit
git status
# anim Make CLI animations
.PHONY: anim
anim:
termtosvg -c "bash docs/shell/autogoal_cli.sh" docs/shell/autogoal_cli.svg -g 80x20 -m 100 -t window_frame_powershell
# env Setup the development environment.
.PHONY: env
env: ensure-dev
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
ln -s ${HOME}/.poetry/bin/poetry /usr/bin/poetry
poetry config virtualenvs.create false
# install Install all the development dependencies.
.PHONY: install
install: ensure-dev
poetry install
# test-core Run the core unit tests (not contrib).
.PHONY: test-core
test-core: ensure-dev
python -m pytest autogoal tests/core --doctest-modules -m "not slow" --ignore=autogoal/contrib --ignore=autogoal/datasets --ignore=autogoal/experimental --cov=autogoal --cov-report=term-missing -v
# test-full Run all unit tests including the (very) slow ones.
.PHONY: test-full
test-full: ensure-dev
python -m pytest autogoal tests/core tests/contrib --ignore=autogoal/datasets --ignore=autogoal/experimental --cov=autogoal --cov-report=term-missing -v
# cov Run the coverage analysis.
.PHONY: cov
cov: ensure-dev
python -m codecov
#