Skip to content

Commit e380ff2

Browse files
committed
Added travis ci support based on the f4 hals ci config
1 parent a175de6 commit e380ff2

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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

tools/check.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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()

0 commit comments

Comments
 (0)