-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (65 loc) · 2.75 KB
/
Makefile
File metadata and controls
82 lines (65 loc) · 2.75 KB
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
.PHONY: init bump bump-minor update build test build_image test_image publish
pwd = $(shell pwd)
version = $(shell poetry version -s)
short_version = $(shell poetry version -s | cut -d'+' -d'-' -f1)
helm_version = $(shell cat helm/pipecheck/Chart.yaml | yq '.version')
helm_short_version = $(shell cat helm/pipecheck/Chart.yaml | yq '.version' | cut -d'+' -d'-' -f1)
init:
pip install poetry
poetry self add "poetry-dynamic-versioning[plugin]"
check-bump: init
which yq || { echo "yq not installed!"; exit 1; }
which git || { echo "git not installed!"; exit 1; }
bump: check-bump
poetry dynamic-versioning
sed -i 's/appVersion: .*/appVersion: $(short_version)/' helm/pipecheck/Chart.yaml
helm-bump-major: check-bump
$(eval helm_new_version = $(shell IFS=. read -r a b c<<<"$(helm_short_version)";echo "$$((a+1)).0.0"))
sed -i 's/version: .*/version: $(helm_new_version)/' helm/pipecheck/Chart.yaml
git commit -a -m "bump helm minor-version from $(helm_version) to $(helm_new_version)"
helm-bump: check-bump
$(eval helm_new_version = $(shell IFS=. read -r a b c<<<"$(helm_short_version)";echo "$$a.$$((b+1)).0"))
sed -i 's/version: .*/version: $(helm_new_version)/' helm/pipecheck/Chart.yaml
git commit -a -m "bump helm minor-version from $(helm_version) to $(helm_new_version)"
helm-bump-patch: check-bump
$(eval helm_new_version = $(shell IFS=. read -r a b c<<<"$(helm_short_version)";echo "$$a.$$b.$$((c+1))"))
sed -i 's/version: .*/version: $(helm_new_version)/' helm/pipecheck/Chart.yaml
git commit -a -m "bump helm minor-version from $(helm_version) to $(helm_new_version)"
release:
git push
poetry version -s | xargs -i gh release create v{}
update:
poetry update
poetry export --output requirements.txt
poetry export --with dev --output requirements.dev.txt
install: bump
poetry install
lint: install
poetry run flake8 pipecheck tests --show-source --statistics --count
format: install
poetry run isort pipecheck tests
poetry run black pipecheck tests
build: install
poetry build
test: build
poetry run pytest
publish:
@poetry config pypi-token.pypi "$(PYPI_TOKEN)"
poetry publish
build_image:
docker build -t pipecheck:$(short_version) .
test_image: build_image
docker run --rm --entrypoint '/bin/sh' \
-v $(pwd)/tests/:/usr/src/app/tests/:z \
-v $(pwd)/example.yaml:/usr/src/app/example.yaml:z \
pipecheck:$(short_version) \
-c '\
apk add --no-cache musl-dev python3-dev gcc && \
python -m pip install -r requirements.dev.txt && \
pytest -v -x ./tests -k "not ping" \
'
publish_image:
docker tag pipecheck:$(short_version) ghcr.io/mriedmann/pipecheck:$(short_version)
docker tag pipecheck:$(short_version) ghcr.io/mriedmann/pipecheck:latest
docker push ghcr.io/mriedmann/pipecheck:$(short_version)
docker push ghcr.io/mriedmann/pipecheck:latest