Skip to content

Commit 94eea39

Browse files
HarkonenBadetherealprof
authored andcommitted
Tweaks to travis to run plain builds and faster cargo executions (#39)
* Tweaks to travis to run plain builds and faster cargo executions
1 parent b2111b9 commit 94eea39

File tree

2 files changed

+56
-12
lines changed

2 files changed

+56
-12
lines changed

.travis.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ rust:
33
- stable
44
- nightly
55
cache: cargo
6+
67
env:
7-
- MCU=stm32f042
8-
- MCU=stm32f030
9-
- MCU=stm32f030x6
10-
- MCU=stm32f030x8
11-
- MCU=stm32f030xc
12-
- MCU=stm32f070
13-
- MCU=stm32f070x6
14-
- MCU=stm32f070xb
15-
- MCU=stm32f072
16-
- MCU=stm32f091
8+
- COMMAND=""
9+
- COMMAND=size_check
10+
1711
matrix:
1812
allow_failures:
1913
- rust: nightly
14+
- env: COMMAND=size_check
2015
fast_finish: true
21-
script:
16+
17+
install:
2218
- rustup target add thumbv6m-none-eabi
23-
- cargo build --features=$MCU --examples --release
19+
20+
script: tools/check.py $COMMAND

tools/check.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 + ["--examples", "--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 != "device-selected" and 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()
47+

0 commit comments

Comments
 (0)