File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed
Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ language : rust
2+ rust :
3+ - stable
4+ - nightly
5+ cache : cargo
6+
7+ env :
8+ - COMMAND=""
9+ - COMMAND=size_check
10+
11+ matrix :
12+ allow_failures :
13+ - rust : nightly
14+ - env : COMMAND=size_check
15+ fast_finish : true
16+
17+ install :
18+ - rustup target add thumbv7em-none-eabihf
19+
20+ script : tools/check.py $COMMAND
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env python3
2+
3+ import json
4+ import subprocess
5+ import sys
6+
7+
8+ def run_inner (args ):
9+ print ("Running `{}`..." .format (" " .join (args )))
10+ ret = subprocess .call (args ) == 0
11+ print ("" )
12+ return ret
13+
14+
15+ def run (mcu , cargo_cmd ):
16+ if mcu == "" :
17+ return run_inner (cargo_cmd )
18+ else :
19+ return run_inner (cargo_cmd + ["--features={}" .format (mcu )])
20+
21+
22+ def main ():
23+ cargo_meta = json .loads (
24+ subprocess .check_output ("cargo metadata --no-deps --format-version=1" ,
25+ shell = True ,
26+ universal_newlines = True )
27+ )
28+
29+ crate_info = cargo_meta ["packages" ][0 ]
30+
31+ features = ["{},rt" .format (x )
32+ for x in crate_info ["features" ].keys ()
33+ if x != "rt" ]
34+
35+ if 'size_check' in sys .argv :
36+ cargo_cmd = ['cargo' , 'build' , '--release' ]
37+ else :
38+ cargo_cmd = ['cargo' , 'check' ]
39+
40+ if not all (map (lambda f : run (f , cargo_cmd ),
41+ features )):
42+ sys .exit (- 1 )
43+
44+
45+ if __name__ == "__main__" :
46+ main ()
You can’t perform that action at this time.
0 commit comments