Skip to content

Commit bb4b6bf

Browse files
Mohammad Mahdi MalmasiMohammad Mahdi Malmasi
authored andcommitted
stubs_configs_check CI job name changed
1 parent 9c27b12 commit bb4b6bf

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

.github/workflows/stubs_configs_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- '!master'
88

99
jobs:
10-
build:
10+
check_stubs_configs_file:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout source code

scripts/python/check_stubs_configs.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
import fnmatch
13
import sys
24
import json
35
import re
@@ -50,6 +52,7 @@ def check_config_keys_and_values(service_config: dict) -> None:
5052
stubs_configs_file_path = sys.argv[1]
5153
protos_output_folder = sys.argv[2].split('/')[1]
5254
protos_folder = sys.argv[3].split('/')[1]
55+
print(f'protos folder: {protos_folder}')
5356

5457
# read stubs configs file
5558
stubs_json_dict = json.loads(open(stubs_configs_file_path, 'r').read())
@@ -83,5 +86,21 @@ def check_config_keys_and_values(service_config: dict) -> None:
8386
implemented_services.append(service_config['name'])
8487

8588

89+
proto_files = []
90+
for root, dirnames, filenames in os.walk(protos_folder):
91+
for filename in fnmatch.filter(filenames, '*.proto'):
92+
proto_files.append(os.path.join(root, filename))
93+
94+
for proto_file in proto_files:
95+
with open(proto_file, 'r') as f:
96+
proto_file_text = f.read()
97+
if 'service' not in proto_file_text:
98+
continue
99+
100+
service_name = re.search(r'service\s+(.+)\s*{', proto_file_text).group(1).strip()
101+
if service_name not in implemented_services:
102+
raise Exception(f'{service_name} is not added in stubs configs!')
103+
104+
86105
print('\n\nstubs configs file is valid ✅')
87-
exit(0)
106+
exit(0)

0 commit comments

Comments
 (0)