Browse Source

Tweaks to travis to run plain builds and faster cargo executions (#39)

* Tweaks to travis to run plain builds and faster cargo executions
trying.tmp
Tom 4 years ago committed by Daniel Egger
parent
commit
94eea3924b
  1. 21
      .travis.yml
  2. 47
      tools/check.py

21
.travis.yml

@ -3,21 +3,18 @@ rust:
- stable
- nightly
cache: cargo
env:
- MCU=stm32f042
- MCU=stm32f030
- MCU=stm32f030x6
- MCU=stm32f030x8
- MCU=stm32f030xc
- MCU=stm32f070
- MCU=stm32f070x6
- MCU=stm32f070xb
- MCU=stm32f072
- MCU=stm32f091
- COMMAND=""
- COMMAND=size_check
matrix:
allow_failures:
- rust: nightly
- env: COMMAND=size_check
fast_finish: true
script:
install:
- rustup target add thumbv6m-none-eabi
- cargo build --features=$MCU --examples --release
script: tools/check.py $COMMAND

47
tools/check.py

@ -0,0 +1,47 @@
#! /usr/bin/env python3
import json
import subprocess
import sys
def run_inner(args):
print("Running `{}`...".format(" ".join(args)))
ret = subprocess.call(args) == 0
print("")
return ret
def run(mcu, cargo_cmd):
if mcu == "":
return run_inner(cargo_cmd)
else:
return run_inner(cargo_cmd + ["--examples", "--features={}".format(mcu)])
def main():
cargo_meta = json.loads(
subprocess.check_output("cargo metadata --no-deps --format-version=1",
shell=True,
universal_newlines=True)
)
crate_info = cargo_meta["packages"][0]
features = [""] + ["{} rt".format(x)
for x in crate_info["features"].keys()
if x != "device-selected" and x != "rt"]
if 'size_check' in sys.argv:
cargo_cmd = ['cargo', 'build', '--release']
else:
cargo_cmd = ['cargo', 'check']
if not all(map(lambda f: run(f, cargo_cmd),
features)):
sys.exit(-1)
if __name__ == "__main__":
main()
Loading…
Cancel
Save