-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.py
38 lines (29 loc) · 942 Bytes
/
ci.py
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
import subprocess
import glob
def run_all_python_files(files):
for file in files:
print("Running", file)
exit_code = run_python_script(file)
if exit_code != 0:
print(f"Error in {file}. Exiting with status code {exit_code}.")
return exit_code
return 0
def run_python_script(file_path):
try:
subprocess.check_output(
["python3", file_path],
stderr=subprocess.STDOUT,
universal_newlines=True
)
return 0
except subprocess.CalledProcessError as e:
print(f"Exception in {file_path}: {e.output}")
return e.returncode
if __name__ == "__main__":
python_files = glob.glob('day_*/*.py')
print("Fichiers Python trouvés :")
for file in python_files:
print(file)
exit_code = run_all_python_files(python_files)
print(f"Exiting with status code {exit_code}.")
exit(exit_code)