Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (52 loc) · 2.54 KB
/
Copy pathMakefile
File metadata and controls
63 lines (52 loc) · 2.54 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
# Copyright (c) 2022 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
SHELL := /bin/bash
COMPARE_AGAINST_BRANCH=origin/master
lint:
docker run -t --rm --volume $$(pwd):/workspace --workdir /workspace bufbuild/buf:1.31.0 lint
breaking:
docker run -t --rm --volume $$(pwd):/workspace --workdir /workspace bufbuild/buf:1.31.0 breaking \
--against ".git#branch=$(COMPARE_AGAINST_BRANCH)"
governance: check_governance_package_name_all check_governance_version_comment_all check_governance_anonymousschema_all
check_governance_package_name:
@test -n "$(FILE_PATH)" || (echo "FILE_PATH is not set" ; exit 1)
@grep -zoqP 'package accelbyte(\.[^.\n]+)(\.[^.\n]+)?(\.[^.\n]+)(\.v[0-9]+)?;' $(FILE_PATH); \
if [ $$? -ne 0 ]; then \
echo "[FAIL] $(FILE_PATH)"; \
echo -e "\tthe proto file should have package with the following pattern:"; \
echo -e "\t..."; \
echo -e "\tpackage accelbyte.<service_name>[.subproject].<feature>[.version];"; \
echo -e "\t..."; \
exit 1; \
else \
echo "[OK] $(FILE_PATH)"; \
fi
check_governance_package_name_all:
@echo "Checking package name on all .proto file"
@find asyncapi -type f -iname '*.proto' | xargs -I '{}' make -s check_governance_package_name FILE_PATH='{}'
check_governance_version_comment:
@test -n "$(FILE_PATH)" || (echo "FILE_PATH is not set" ; exit 1)
@grep -zoqP 'package .*;(\r\n|\r|\n)// Version v\d+.\d+.\d+' $(FILE_PATH); \
if [ $$? -ne 0 ]; then \
echo "[FAIL] $(FILE_PATH)"; \
echo -e "\tthe proto file should have version comment with the following pattern:"; \
echo -e "\t..."; \
echo -e "\tpackage accelbyte.service.feature;"; \
echo -e "\t// Version v1.0.0"; \
echo -e "\t..."; \
exit 1; \
else \
echo "[OK] $(FILE_PATH)"; \
fi
check_governance_version_comment_all:
@echo "Checking version comment on all .proto file"
@find asyncapi -type f -iname '*.proto' | xargs -I '{}' make -s check_governance_version_comment FILE_PATH='{}'
check_governance_anonymousschema:
@test -n "$(FILE_PATH)" || (echo "FILE_PATH is not set" ; exit 1)
@echo "# $(FILE_PATH)"
@awk 'BEGIN { status = 0; } /^message AnonymousSchema[0-9]+/ && !/Message name is kept for backward compatibility/ { status = 100; print; } END { exit status }' \
"$(FILE_PATH)"
check_governance_anonymousschema_all:
@echo "Checking anonymousschema on all .proto file"
@find asyncapi -type f -iname '*.proto' | xargs -I '{}' make -s check_governance_anonymousschema FILE_PATH='{}'