Skip to content

Commit 5e78697

Browse files
author
Jorge Aparicio
committed
Travis CI: expand to test and deploy for Linux and Mac
1 parent f23a5f2 commit 5e78697

File tree

5 files changed

+156
-18
lines changed

5 files changed

+156
-18
lines changed

.travis.yml

Lines changed: 101 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,106 @@
1+
sudo: false
2+
13
language: rust
2-
rust:
3-
- stable
4-
- beta
5-
- nightly
6-
matrix:
7-
allow_failure:
8-
- rust: nightly
4+
95
env:
106
global:
11-
secure: l3/qEC4krRerllLQzni8j5AjngFi6pluWvBWj//1mJLoIEYwxlQ9mYxEdd9BqccWWFn3K0bVYCVC/64+tP6sRfLkZCe2gPUtwe7ITwCDbapUxmkiRObVJCs5yMQZt6idyhHUDKAXKgNCrusfI2BM3tKGBfRK7Cnn/R/7p/U9+q7D1sgJtUKp6ypVzK6A3jLNp3dFLFI19a5KmbZMVsaa7tOhtdDJjjr7ebsc9z7HMW5/OItiWU3FSauVQQlUMaCiEgFuIG7H7OnBAYWB/gNEtLuwfLqU9UjtWk/njNNRnmJ7m3y5HbQhv5H5F5mJUOq9XFlPLwPwyTeVztSGdQm6k8Pp2pgKBUjY27afBl9BWU+msmN6k0oXfhvIebiBPe/x2udiKeFik1xqOOEU1q9dF0sZiuPxCSM1n7tgWklJ8epgaRQaMPPQw9pO/2H5/ynHCJqBlw6WcdiqWtwAyyr/GEx62u/cg5IVkqb7KLmYsWzjS8wYG4CYs1eIxCw2xPZxP0FGuUXvxTBUPipFze6Z7FqxVauXtVe2D7c1P4738HZP660rmR0GYtHtKLny1QxCCK9sxd9JmcezFCSz4YeQ1od9xc0OzGJ2ullKNGizmGfYmgL6X8faNylLIEdaiHAcY16xV3L0g3fXL1Qg360UHQyj7GIv+0nqQnf+H9xRTTU=
12-
addons:
13-
apt:
14-
packages:
15-
- nodejs
16-
- npm
7+
- PROJECT_NAME=mdBook
8+
9+
matrix:
10+
include:
11+
# Stable channel
12+
- os: osx
13+
env: TARGET=i686-apple-darwin
14+
rust: stable
15+
- os: linux
16+
env: TARGET=i686-unknown-linux-gnu
17+
rust: stable
18+
addons:
19+
apt:
20+
packages: &i686_unknown_linux_gnu
21+
- gcc-multilib
22+
- os: osx
23+
env: TARGET=x86_64-apple-darwin
24+
rust: stable
25+
- os: linux
26+
env: TARGET=x86_64-unknown-linux-gnu
27+
rust: stable
28+
addons:
29+
apt:
30+
packages:
31+
- nodejs
32+
- npm
33+
- os: linux
34+
env: TARGET=x86_64-unknown-linux-musl
35+
rust: stable
36+
# Beta channel
37+
- os: osx
38+
env: TARGET=i686-apple-darwin
39+
rust: beta
40+
- os: linux
41+
env: TARGET=i686-unknown-linux-gnu
42+
rust: beta
43+
addons:
44+
apt:
45+
packages: *i686_unknown_linux_gnu
46+
- os: osx
47+
env: TARGET=x86_64-apple-darwin
48+
rust: beta
49+
- os: linux
50+
env: TARGET=x86_64-unknown-linux-gnu
51+
rust: beta
52+
- os: linux
53+
env: TARGET=x86_64-unknown-linux-musl
54+
rust: beta
55+
# Nightly channel
56+
- os: osx
57+
env: TARGET=i686-apple-darwin
58+
rust: nightly
59+
- os: linux
60+
env: TARGET=i686-unknown-linux-gnu
61+
rust: nightly
62+
addons:
63+
apt:
64+
packages: *i686_unknown_linux_gnu
65+
- os: osx
66+
env: TARGET=x86_64-apple-darwin
67+
rust: nightly
68+
- os: linux
69+
env: TARGET=x86_64-unknown-linux-gnu
70+
rust: nightly
71+
- os: linux
72+
env: TARGET=x86_64-unknown-linux-musl
73+
rust: nightly
74+
1775
install:
18-
- npm install stylus nib
76+
- sh ci/install.sh
77+
78+
script:
79+
- sh ci/script.sh
80+
1981
after_success:
20-
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh
82+
- test $TRAVIS_PULL_REQUEST == "false" &&
83+
test $TRAVIS_BRANCH == "master" &&
84+
test $TARGET == "x86_64-unknown-linux-gnu" &&
85+
test $TRAVIS_RUST_VERSION = "stable" &&
86+
npm install stylus nib &&
87+
bash deploy.sh
88+
89+
before_deploy:
90+
- sh ci/before_deploy.sh
91+
92+
deploy:
93+
provider: releases
94+
api_key:
95+
secure: Z1k7WqX7z+tT4+SzTh4tBBzf11VaADB4AWuEczHtylaEb/0hRs8gaiHCNSVHm/QTp0QPWQR2Vw7uKMhVuxG7I8X7h31j3A7ulYBh/iVk0DVIrtrn2Q4WOED9CpoXLuLtk2nxo9MBViFW7mw4nJe9H2Tn9o/9oEYBuwzekvW5mh4muqUuCVTr8eQVYbs3jbC9pQy5oYjOLeUnlL9Cey5VN/nAhzAtyFP+6lIMri0PKit4JtkFou/O1MEpFYlP3VGC2lFiWuByocPKBT/L45FecS9qoHq+i6+ZCPDH2eu46nuYsDbLKAkPdGvf1MdPBPwoj0vSnZbgaTisQ4hIoBngQQQPZlPaGtcdd6g6asxSfnbA9cQhClI5oZJmg+ksxQE+peE8pnbmZ10Ix0PpIkkfWdQeMdUUCQarOTkTK54Munw+X+kp1lH19j6+krQPLBYr95fPRd4b5tWsJD2+pb/UOYFEEJxMNoUHyLCrtdCO7imOwrSUcv51+Z8UudqfPpKQeszrJcntL4owip35r3sF5TsE9YfW5qssLC164IylvP32y1AcfL1jqg8b+zrqLZKanjvDOJ1dtHHuwKqxcwf7PhAf0YjAtVSH9OIYcDzmDa0EMLrq7EK0fs6NAeb5qt6CML7pZrRS3fmOxN53Fbmj81qm6TmjQjDe4dmZlELgNow=
96+
file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz
97+
# don't delete the artifacts from previous phases
98+
skip_cleanup: true
99+
# deploy when a new tag is pushed
100+
on:
101+
condition: $TRAVIS_RUST_VERSION = stable
102+
tags: true
103+
104+
notifications:
105+
email:
106+
on_success: never

ci/before_deploy.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# `before_deploy` phase: here we package the build artifacts
2+
3+
set -ex
4+
5+
cargo build --target $TARGET --release
6+
7+
mkdir staging
8+
9+
cp target/$TARGET/release/mdbook staging
10+
11+
cd staging
12+
13+
tar czf ../${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz *

ci/install.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# `install` phase: install stuff needed for the `script` phase
2+
3+
set -ex
4+
5+
case $TARGET in
6+
# Install standard libraries needed for cross compilation
7+
i686-apple-darwin | \
8+
i686-unknown-linux-gnu | \
9+
x86_64-unknown-linux-musl)
10+
case $TRAVIS_RUST_VERSION in
11+
stable)
12+
# e.g. 1.6.0
13+
version=$(rustc -V | cut -d' ' -f2)
14+
;;
15+
*)
16+
version=$TRAVIS_RUST_VERSION
17+
;;
18+
esac
19+
tarball=rust-std-${version}-${TARGET}
20+
21+
curl -Os http://static.rust-lang.org/dist/${tarball}.tar.gz
22+
23+
tar xzf ${tarball}.tar.gz
24+
25+
${tarball}/install.sh --prefix=$(rustc --print sysroot)
26+
27+
rm -r ${tarball}
28+
rm ${tarball}.tar.gz
29+
;;
30+
# Nothing to do for native builds
31+
*)
32+
;;
33+
esac

ci/script.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# `script` phase: you usually build, test and generate docs in this phase
2+
3+
set -ex
4+
5+
cargo build --target $TARGET --verbose
6+
cargo test --target $TARGET --verbose

deploy.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ cargo doc
1515

1616
echo -e "${CYAN}Running mdbook build${NC}"
1717
# Run mdbook to generate the book
18-
target/debug/mdbook build book-example/
18+
target/$TARGET/debug/mdbook build book-example/
1919

2020
echo -e "${CYAN}Copying book to target/doc${NC}"
2121
# Copy files from rendered book to doc root
22-
cp -R book-example/book/* target/doc/
22+
cp -R book-example/book/* target/$TARGET/doc/
2323

24-
cd target/doc
24+
cd target/$TARGET/doc
2525

2626
echo -e "${CYAN}Initializing Git${NC}"
2727
git init

0 commit comments

Comments
 (0)