From 342ba2dd81fefe1c6305af57187302aaea9249bf Mon Sep 17 00:00:00 2001
From: Jorge Aparicio <japaricious@gmail.com>
Date: Tue, 27 Sep 2016 17:32:08 -0500
Subject: [PATCH] Travis CI

---
 .travis.yml                                | 27 ++++++++++++++++++++++
 ci/docker/thumbv6m-none-eabi/Dockerfile    |  5 ++++
 ci/docker/thumbv7em-none-eabi/Dockerfile   |  5 ++++
 ci/docker/thumbv7em-none-eabihf/Dockerfile |  5 ++++
 ci/docker/thumbv7m-none-eabi/Dockerfile    |  5 ++++
 ci/run-docker.sh                           | 22 ++++++++++++++++++
 ci/run.sh                                  | 14 +++++++++++
 thumbv6m-none-eabi.json                    |  9 ++++++++
 thumbv7em-none-eabi.json                   |  8 +++++++
 thumbv7em-none-eabihf.json                 |  9 ++++++++
 thumbv7m-none-eabi.json                    |  8 +++++++
 11 files changed, 117 insertions(+)
 create mode 100644 .travis.yml
 create mode 100644 ci/docker/thumbv6m-none-eabi/Dockerfile
 create mode 100644 ci/docker/thumbv7em-none-eabi/Dockerfile
 create mode 100644 ci/docker/thumbv7em-none-eabihf/Dockerfile
 create mode 100644 ci/docker/thumbv7m-none-eabi/Dockerfile
 create mode 100755 ci/run-docker.sh
 create mode 100755 ci/run.sh
 create mode 100644 thumbv6m-none-eabi.json
 create mode 100644 thumbv7em-none-eabi.json
 create mode 100644 thumbv7em-none-eabihf.json
 create mode 100644 thumbv7m-none-eabi.json

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..9e67af7
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,27 @@
+dist: trusty
+languages: rust
+rust: nightly
+services: docker
+sudo: required
+
+matrix:
+  include:
+    - env: TARGET=x86_64-unknown-linux-gnu
+    - env: TARGET=thumbv6m-none-eabi
+    - env: TARGET=thumbv7m-none-eabi
+    - env: TARGET=thumbv7em-none-eabi
+    - env: TARGET=thumbv7em-none-eabihf
+
+script:
+  - cargo generate-lockfile
+  - sh ci/run-docker.sh $TARGET
+
+branches:
+  only:
+    - auto
+    - try
+
+notifications:
+  email:
+    on_success: never
+  webhooks: https://homu.herokuapp.com/travis
diff --git a/ci/docker/thumbv6m-none-eabi/Dockerfile b/ci/docker/thumbv6m-none-eabi/Dockerfile
new file mode 100644
index 0000000..25bf548
--- /dev/null
+++ b/ci/docker/thumbv6m-none-eabi/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:16.04
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+    ca-certificates curl libcurl4-openssl-dev libssh2-1
+ENV PATH=$PATH:/rust/bin
diff --git a/ci/docker/thumbv7em-none-eabi/Dockerfile b/ci/docker/thumbv7em-none-eabi/Dockerfile
new file mode 100644
index 0000000..25bf548
--- /dev/null
+++ b/ci/docker/thumbv7em-none-eabi/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:16.04
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+    ca-certificates curl libcurl4-openssl-dev libssh2-1
+ENV PATH=$PATH:/rust/bin
diff --git a/ci/docker/thumbv7em-none-eabihf/Dockerfile b/ci/docker/thumbv7em-none-eabihf/Dockerfile
new file mode 100644
index 0000000..25bf548
--- /dev/null
+++ b/ci/docker/thumbv7em-none-eabihf/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:16.04
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+    ca-certificates curl libcurl4-openssl-dev libssh2-1
+ENV PATH=$PATH:/rust/bin
diff --git a/ci/docker/thumbv7m-none-eabi/Dockerfile b/ci/docker/thumbv7m-none-eabi/Dockerfile
new file mode 100644
index 0000000..25bf548
--- /dev/null
+++ b/ci/docker/thumbv7m-none-eabi/Dockerfile
@@ -0,0 +1,5 @@
+FROM ubuntu:16.04
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+    ca-certificates curl libcurl4-openssl-dev libssh2-1
+ENV PATH=$PATH:/rust/bin
diff --git a/ci/run-docker.sh b/ci/run-docker.sh
new file mode 100755
index 0000000..85b2c28
--- /dev/null
+++ b/ci/run-docker.sh
@@ -0,0 +1,22 @@
+set -ex
+
+run() {
+    echo $1
+
+    docker build -t rust ci/docker/$1
+    docker run \
+           -v `rustc --print sysroot`:/rust:ro \
+           -v `pwd`:/checkout:ro \
+           -e CARGO_TARGET_DIR=/tmp/target \
+           -w /checkout \
+           -it rust \
+           ci/run.sh $1
+}
+
+if [ -z "$1" ]; then
+    for d in `ls ci/docker/`; do
+        run $d
+    done
+else
+    run $1
+fi
diff --git a/ci/run.sh b/ci/run.sh
new file mode 100755
index 0000000..c1f2a5a
--- /dev/null
+++ b/ci/run.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -ex
+
+case $1 in
+    thumbv*)
+        curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
+            bash -s -- --at /usr/bin --from japaric/xargo --tag v0.1.9
+        xargo build --target $1
+    ;;
+    *)
+        cargo test --target $1
+    ;;
+esac
diff --git a/thumbv6m-none-eabi.json b/thumbv6m-none-eabi.json
new file mode 100644
index 0000000..4a31e30
--- /dev/null
+++ b/thumbv6m-none-eabi.json
@@ -0,0 +1,9 @@
+{
+    "arch": "arm",
+    "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
+    "features": "+strict-align",
+    "llvm-target": "thumbv6m-none-eabi",
+    "os": "none",
+    "target-endian": "little",
+    "target-pointer-width": "32"
+}
diff --git a/thumbv7em-none-eabi.json b/thumbv7em-none-eabi.json
new file mode 100644
index 0000000..ce49c83
--- /dev/null
+++ b/thumbv7em-none-eabi.json
@@ -0,0 +1,8 @@
+{
+    "arch": "arm",
+    "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
+    "llvm-target": "thumbv7em-none-eabi",
+    "os": "none",
+    "target-endian": "little",
+    "target-pointer-width": "32"
+}
diff --git a/thumbv7em-none-eabihf.json b/thumbv7em-none-eabihf.json
new file mode 100644
index 0000000..bb0b87e
--- /dev/null
+++ b/thumbv7em-none-eabihf.json
@@ -0,0 +1,9 @@
+{
+    "arch": "arm",
+    "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
+    "features": "+vfp4",
+    "llvm-target": "thumbv7em-none-eabihf",
+    "os": "none",
+    "target-endian": "little",
+    "target-pointer-width": "32"
+}
diff --git a/thumbv7m-none-eabi.json b/thumbv7m-none-eabi.json
new file mode 100644
index 0000000..313a5e6
--- /dev/null
+++ b/thumbv7m-none-eabi.json
@@ -0,0 +1,8 @@
+{
+    "arch": "arm",
+    "data-layout": "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64",
+    "llvm-target": "thumbv7m-none-eabi",
+    "os": "none",
+    "target-endian": "little",
+    "target-pointer-width": "32"
+}
-- 
GitLab