3
3
import subprocess
4
4
import sys
5
5
6
+ # Libraries that are not meant to be checked in CI by default
7
+ DEFAULT_IGNORED_LIBRARIES = (
8
+ "keyboard" ,
9
+ "mouse"
10
+ )
11
+
6
12
7
13
def run_platformio (example_path , boards ):
8
14
return subprocess .call (
9
15
["platformio" , "ci" , example_path ] + ["--board=" + b for b in boards ]
10
16
)
11
17
12
18
13
- def collect_examples (libs_dir ):
19
+ def collect_examples (libs_dir , ignored_libraries = None ):
20
+ ignored_libraries = ignored_libraries or []
14
21
examples = []
15
22
for lib in os .listdir (libs_dir ):
23
+ if lib .lower () in ignored_libraries :
24
+ print (f"Skipping examples from the `{ lib } ` library..." )
25
+ continue
16
26
lib_dir = os .path .join (libs_dir , lib )
17
27
examples_dir = os .path .join (lib_dir , "examples" )
18
28
if os .path .isdir (examples_dir ):
@@ -27,6 +37,9 @@ def collect_examples(libs_dir):
27
37
parser .add_argument (
28
38
"-b" , "--board" , action = "append" , help = "board ID used for PlatformIO project"
29
39
)
40
+ parser .add_argument (
41
+ "-i" , "--ignore-library" , action = "append" , help = "Library name to ignore when collecting project examples"
42
+ )
30
43
31
44
32
45
def main ():
@@ -35,8 +48,12 @@ def main():
35
48
if boards is None :
36
49
boards = ["nucleo_f401re" ]
37
50
51
+ ignored_libraries = args .ignore_library
52
+ if ignored_libraries is None :
53
+ ignored_libraries = DEFAULT_IGNORED_LIBRARIES
54
+
38
55
libs_dir = os .path .join (os .environ ["GITHUB_WORKSPACE" ], "libraries" )
39
- if any (run_platformio (example , boards ) for example in collect_examples (libs_dir )):
56
+ if any (run_platformio (example , boards ) for example in collect_examples (libs_dir , ignored_libraries )):
40
57
sys .exit (1 )
41
58
42
59
0 commit comments