forked from GoogleCloudPlatform/gcpdiag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (51 loc) · 1.93 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
VERSION=$(shell sed -n 's/^current_version\s*=\s*//p' <.bumpversion.cfg)
DIST_NAME=gcpdiag-$(VERSION)
SHELL=/bin/bash
test:
pytest -o log_level=DEBUG --cov-config=.coveragerc --cov=gcpdiag --forked
test_async_api:
python -m unittest gcpdiag.async_queries.api.api_slowtest
test-mocked:
# run gcpdiag-mocked and verify that the exit status is what we expect
bin/gcpdiag-mocked lint --auth-adc --project=gcpdiag-gke1-aaaa; \
EXIT_CODE=$$?; \
if [ $$EXIT_CODE != 2 ]; then echo "incorrect exit code $$EXIT_CODE" >&2; exit 1; fi; \
exit 0
snapshots:
pytest --snapshot-update --forked
version:
@echo $(VERSION)
build:
rm -f dist/gcpdiag
pyinstaller --workpath=.pyinstaller.build pyinstaller.spec
bump-version:
bumpversion --commit minor
tarfile:
# TODO: replace with something based on setuptools?
rm -rf dist-tmp
mkdir -p dist-tmp/$(DIST_NAME)/bin
cp Pipfile Pipfile.lock README.md dist-tmp/$(DIST_NAME)
cp bin/gcpdiag dist-tmp/$(DIST_NAME)/bin
chmod +x dist-tmp/$(DIST_NAME)/bin/gcpdiag
cp --parents gcpdiag/queries/client_secrets.json dist-tmp/$(DIST_NAME)
find gcpdiag -name '*.py' -exec cp --parents '{}' dist-tmp/$(DIST_NAME) ';'
chmod -R a+rX dist-tmp
mkdir -p dist
tar -C dist-tmp -czf dist/gcpdiag-$(VERSION).tar.gz --owner=0 --group=0 gcpdiag-$(VERSION)
rm -rf dist-tmp
release:
# Make sure we are using the latest submitted code.
git fetch
git checkout origin/master
# Remove '-test' in the version.
# Note: this will fail if we have already a release tag, in which case
# you should first increase the minor version with a code review.
bumpversion --commit --tag --tag-message "Release v{new_version}" release
# push to the release branch and tag the release
git merge -s ours origin/release
git push origin HEAD:release
git push --tags
# increment the version (and add back '-test')
bumpversion --commit minor
git push origin HEAD:refs/for/master
.PHONY: test coverage-report version build bump-version tarfile release