Skip to content

Commit 97b674d

Browse files
author
Jorge Aparicio
committed
add CI
1 parent 4a87609 commit 97b674d

File tree

7 files changed

+138
-19
lines changed

7 files changed

+138
-19
lines changed

.travis.yml

+39-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
cache: cargo
2+
dist: trusty
23
language: rust
4+
rust: nightly
5+
services: docker
36
sudo: required
4-
rust: stable
7+
8+
env:
9+
global:
10+
- secure: Ugv5ArwniODKreVleFFhSfjfWQmKUd+MbvpPseiTBqgIaMSrz4G92FL7plo/Qdn8lecQRDJTb1Li76DxnNlwTiwrvpc85iGyNS2AJUv/xWqvzXq424mLpvoqSKNjRcDotIHIHJ7VHjTRP79ScSPMQwdEXHfv7YgGHIQ+1nQUVJ7mxQQVeUtV/Qsm1CwNQy8oQiDVKa57/mEisNlWILeAgSloQIVLmin2nH6kTO/sW5DanagLhgqZ3YjQw7WNZvkPYuQmH9x/Sa8h8zs3OjGZ+3qRNxKMk0gn/TuyDwdznrJA3RBns39lmV2IMv963QJNcWPacNeSgEBlEU+vh4rKxA39dm2b4NZfiUBJApRLDFGu7aT6nkc77Km7z77XQ4cf8T51Fnr0rr3BvIKobZsIo8I4jm12cMbGmAqHs5Sk/cySguPEjUqH/KC5MNH2uxEa+HaGw7wUWUVO0wXbXq+0aYFz+o/rE0e3hQnQPJiefe5Wzjc/7kjls9aQgbFU7KO0u/0FtEraqlimrCvBFWx/6rDJs2Sx7KNqG9/gbMANaZGE36gFMnf/bdeX+tIl9g5XgLJFcD9AJ0XX5/DibY0xsgHmeEdxN+BOfm8m41WJ6ycFdsPWbMi7UrDU/+QxYRD9e7l0ihOoOqvQeU5GYfMfmuQ+B3bl+v6BFwyYaHZLQww=
11+
- TARGET=x86_64-unknown-linux-gnu
512

613
install:
7-
- export PATH="$PATH:$HOME/.cargo/bin"
8-
- command -v mdbook || cargo install mdbook
9-
- command -v ghp || cargo install ghp
14+
- if [ $TRAVIS_PULL_REQUEST != false ] ; then
15+
curl https://sh.rustup.rs -sSf |
16+
sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION;
17+
18+
source ~/.cargo/env;
19+
20+
rustup component add rust-src;
21+
fi
1022

1123
script:
12-
- mdbook build
24+
- if [ $TRAVIS_PULL_REQUEST != false ] ; then
25+
if [[ $TRAVIS_OS_NAME = linux ]]; then
26+
sh ci/run-docker.sh $TARGET || exit 1;
27+
else
28+
sh ci/run.sh || exit 1;
29+
fi;
30+
31+
chmod -R a+r $HOME/.cargo;
32+
fi
1333

1434
after_success:
15-
- if [ $TRAVIS_PULL_REQUEST = false ]; then
16-
ghp -m "$(git rev-parse HEAD)" book &&
17-
git config user.name 'Jorge Aparicio' &&
18-
git config user.email '[email protected]' &&
19-
git push -fq https://[email protected]/$TRAVIS_REPO_SLUG.git gh-pages;
35+
- if [ $TARGET = x86_64-unknown-linux-gnu ] && [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then
36+
curl -LSfs https://japaric.github.io/trust/install.sh |
37+
sh -s -- --git azerupi/mdbook --tag v0.0.14 --to .;
38+
39+
./mdbook build;
40+
41+
mkdir ghp-import;
42+
43+
curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz |
44+
tar --strip-components 1 -C ghp-import -xz;
45+
46+
./ghp-import/ghp_import.py book;
47+
48+
git push -fq https://[email protected]/$TRAVIS_REPO_SLUG.git gh-pages && echo OK;
2049
fi
2150

22-
env:
23-
global:
24-
- secure: j33xtVJ5S009SlmbQaPlag2Yy2dZo1GTCgS9XoT7Gw0PXMXyaaQb5sPbOrPBVP5Um4YQKWRI04os6jmc/7jufzPvEhqHeFpeVzmOyVJ9V5zAfsMyROYrIGDpZgldpVIIamMcRWUqHt+hruUXs6Vr1Jce2TVL6CZEsxXDUo3fu2r2ijt2/EMlMo4TNf1zGls7F3ecCI6fNQxGvRaJSPyJbxDxsAO0097wS8iOwFywVReZiFjXy0AjCmd6w7OnANQqkgkMfICUPR80yBIrpalysUH0LiMaQlUer6MBdNpWgj73laP8/ua20s+NFujDlJV3Yuzaxly0X/506bCDn0T3wp66S5uYZ3z6u3AWwvoSh1t01EGME2GuoMKUW3YlB5doPfi3hyEfqj4HV8KOfcvtjl1V97cTVAkxW3VC348M8PloVUIrGRSI5mAQBGhB7VmvdHlfRP779uVugyRsZ9oP7v9+JfK9Uf8AdSHhyBJXLEbs2op/g4GaQzbiuJ38NtoXQSvjYPP+aqP57wItqZse6uAN1gdwCi+/ZMaThpravvon4nxnN8P2eNxH0J0jMBHYJ8tJp2shqcwcDdS2sZpSMoKSTrGD8qq+xvcnkyhYiQOPp+hL+S3vSRxq2P57PPBqCgrspHQKCCN8zOt4iLgVObMyrKrnugUJ3lysrz8YUaU=
2551

2652
branches:
2753
only:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ubuntu:16.04
2+
RUN apt-get update && \
3+
apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
curl \
6+
gcc \
7+
gcc-arm-none-eabi \
8+
libc6-dev
9+
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
10+
sh -s -- --git azerupi/mdbook --tag v0.0.14 --target x86_64-unknown-linux-gnu --to /usr/bin
11+
RUN curl -LSfs https://japaric.github.io/trust/install.sh | \
12+
sh -s -- --git japaric/xargo --tag v0.2.1 --target x86_64-unknown-linux-gnu --to /usr/bin

ci/install.ps1

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
If ($Env:APPVEYOR_REPO_TAG -eq 'false' -Or $Env:RUST_VERSION -eq $Env:DEPLOY_VERSION) {
2+
$Env:HOST = $Env:TARGET
3+
4+
If ($Env:TARGET -Match 'gnu') {
5+
if ($Env:TARGET -Match 'x86_64') {
6+
$Env:PATH += ';C:\msys64\mingw64\bin'
7+
} else {
8+
$Env:PATH += ';C:\msys64\mingw32\bin'
9+
}
10+
} ElseIf ($Env:TARGET -Match 'i586') {
11+
$Env:HOST = 'i686-pc-windows-msvc'
12+
}
13+
14+
[Net.ServicePointManager]::SecurityProtocol = 'Ssl3, Tls, Tls12'
15+
Start-FileDownload 'https://win.rustup.rs' 'rustup-init.exe'
16+
17+
.\rustup-init --default-host $Env:HOST --default-toolchain $Env:RUST_VERSION -y
18+
19+
$Env:PATH = 'C:\Users\appveyor\.cargo\bin;' + $Env:PATH
20+
21+
If ($Env:TARGET -ne $Env:HOST) {
22+
rustup target add $Env:TARGET
23+
}
24+
25+
rustc -Vv
26+
27+
cargo -V
28+
}

ci/run-docker.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
set -ex
2+
3+
run() {
4+
# This directory needs to exist before calling docker, otherwise docker will create it but it
5+
# will be owned by root
6+
mkdir -p target
7+
8+
docker build -t $1 ci/docker/$1
9+
docker run \
10+
--rm \
11+
--user $(id -u):$(id -g) \
12+
-e CARGO_HOME=/cargo \
13+
-e DEPLOY_VERSION=$DEPLOY_VERSION \
14+
-e TARGET=$1 \
15+
-e TRAVIS_OS_NAME=linux \
16+
-e TRAVIS_RUST_VERSION=$TRAVIS_RUST_VERSION \
17+
-e TRAVIS_TAG=$TRAVIS_TAG \
18+
-e USER=$USER \
19+
-v $HOME/.cargo:/cargo \
20+
-v `pwd`/target:/target \
21+
-v `pwd`:/checkout \
22+
-v `rustc --print sysroot`:/rust:ro \
23+
-w /checkout \
24+
-it $1 \
25+
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin ci/run.sh"
26+
}
27+
28+
if [ -z $1 ]; then
29+
for d in `ls ci/docker/`; do
30+
run $d
31+
done
32+
else
33+
run $1
34+
fi

ci/run.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
set -ex
2+
3+
test_mode() {
4+
if [ $TARGET = x86_64-unknown-linux-gnu ]; then
5+
mdbook build
6+
fi
7+
8+
for chapter in $(echo src/*); do
9+
if [ ! -f $chapter/Cargo.toml ]; then
10+
continue
11+
fi
12+
13+
cd $chapter
14+
xargo build --target thumbv7em-none-eabihf
15+
xargo build --target thumbv7em-none-eabihf --release
16+
cd ../..
17+
done
18+
}
19+
20+
run() {
21+
test_mode
22+
}
23+
24+
run

clean.sh

-6
This file was deleted.

src/17-async-io-the-future/pg/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ default-features = false
88
features = [
99
"default-exception-handler",
1010
"default-panic-fmt",
11+
"static-ram",
1112
]
1213
version = "0.3.0"

0 commit comments

Comments
 (0)