-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
43 lines (36 loc) · 1.24 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
PROJECT=nornir_rich
CODE_DIRS=${PROJECT} tests
IMG_URL=https://raw.githubusercontent.com/InfrastructureAsCode-ch/nornir_rich/main/docs/imgs/
# Run pytest
.PHONY: pytest
pytest:
poetry run pytest -vs tests
# Check if the python code needs to be reformatted
.PHONY: black
black:
poetry run black --check ${CODE_DIRS}
# Python type check
.PHONY: mypy
mypy:
poetry run mypy ${CODE_DIRS}
# Runn pytest, black and mypy
.PHONY: tests
tests: pytest black mypy
# use "make bump ARGS=patch" to bump the version. ARGS can be patch, minor or major.
.PHONY: bump
bump:
poetry version ${ARGS}
sed -i -E "s|\"\b[0-9]+.\b[0-9]+.\b[0-9]+\" # From Makefile|\"`poetry version -s`\" # From Makefile|g" ${PROJECT}/__init__.py
sed -i -E "s|\"\b[0-9]+.\b[0-9]+.\b[0-9]+\" # From Makefile|\"`poetry version -s`\" # From Makefile|g" tests/test_${PROJECT}.py
# Used in the pipeline to change the image urls befor publishing it on pypi.org
.PHONY: fiximageurls
fiximageurls:
sed -i "s|](docs/imgs/|](${IMG_URL}|g" README.md
# Create a new tag and push it to origin. This will triger the pipeline and a new release will be published
.PHONY: tag
tag:
git checkout main
git pull
git tag -a "v`poetry version -s`" -m "Version v`poetry version -s`"
git push --tags
git checkout -