Skip to content
Snippets Groups Projects
Commit caa1be62 authored by Jorge Aparicio's avatar Jorge Aparicio
Browse files

CI: use the cross template

parent 0433e6b5
No related branches found
No related tags found
No related merge requests found
cache: cargo
dist: trusty
language: rust
rust: nightly
services: docker
sudo: required
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
matrix:
include:
- env: TARGET=thumbv6m-none-eabi
- env: TARGET=thumbv7m-none-eabi
- env: TARGET=thumbv7em-none-eabi
- env: TARGET=thumbv7em-none-eabihf
env: TARGET=x86_64-unknown-linux-gnu
- env: TARGET=thumbv7m-none-eabi
install:
- sh ci/install.sh
- source ~/.cargo/env || true
script:
- cargo generate-lockfile
- sh ci/run-docker.sh $TARGET
# Travis can't cache files that are not readable by "others"
- bash ci/script.sh
cache: cargo
before_cache:
- chmod -R a+r $HOME/.cargo
branches:
......
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libcurl4-openssl-dev \
libssh2-1
RUN curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
bash -s -- --at /usr/bin --from japaric/xargo --for x86_64-unknown-linux-gnu --tag v0.1.13
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libcurl4-openssl-dev \
libssh2-1
RUN curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
bash -s -- --at /usr/bin --from japaric/xargo --for x86_64-unknown-linux-gnu --tag v0.1.13
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libcurl4-openssl-dev \
libssh2-1
RUN curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
bash -s -- --at /usr/bin --from japaric/xargo --for x86_64-unknown-linux-gnu --tag v0.1.13
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libcurl4-openssl-dev \
libssh2-1
RUN curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
bash -s -- --at /usr/bin --from japaric/xargo --for x86_64-unknown-linux-gnu --tag v0.1.13
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
ca-certificates gcc libc6-dev
ENV PATH=$PATH:/rust/bin
set -ex
main() {
curl https://sh.rustup.rs -sSf | \
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--force \
--git japaric/cross \
--tag v0.1.4 \
--target x86_64-unknown-linux-gnu
}
main
set -ex
run() {
local target=$1
echo $target
# This directory needs to exist before calling docker, otherwise docker will create it but it
# will be owned by root
mkdir -p target
docker build -t $target ci/docker/$target
docker run \
--rm \
--user $(id -u):$(id -g) \
-e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/target \
-e HOME=/tmp \
-v $HOME/.cargo:/cargo \
-v `pwd`/target:/target \
-v `pwd`:/checkout:ro \
-v `rustc --print sysroot`:/rust:ro \
-w /checkout \
-it $target \
sh -c "PATH=\$PATH:/rust/bin ci/run.sh $target"
}
if [ -z "$1" ]; then
for d in `ls ci/docker/`; do
run $d
done
else
run $1
fi
#!/bin/bash
set -ex
case $1 in
thumbv*)
xargo build --target $1
;;
*)
cargo test --target $1
;;
esac
set -ex
main() {
cross build --target $TARGET
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
cross test --target $TARGET
fi
}
main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment