forked from benjaminbollen/maidsafe_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
133 lines (133 loc) · 6.15 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
env:
global:
- RUST_BACKTRACE=1
- PATH=$PATH:$HOME/.cargo/bin
- SAFE_MEMORY_STORE=1
language: rust
matrix:
include:
- os: linux
rust: 1.19.0
- os: linux
rust: 1.19.0-i686-unknown-linux-gnu
addons:
apt:
packages:
- gcc-multilib
- os: linux
rust: nightly-2017-07-20
- os: osx
rust: 1.19.0
sudo: false
cache:
cargo: true
before_script:
# Expected version change PR title format:
# Version change: safe_app to 0.2.2; safe_authenticator to 0.2.3; safe_core to 0.26.0;
- if [[ "$TRAVIS_COMMIT_MESSAGE" =~ [Vv]ersion[[:space:]]change.*safe_authenticator[[:space:]]to[[:space:]]([^;]+) ]]; then
SAFE_AUTHENTICATOR_VERSION=v$(cargo pkgid --manifest-path=safe_authenticator/Cargo.toml | sed -e "s/.*[:#]\(.*\)/\1/");
if [[ "v${BASH_REMATCH[1]}" != $SAFE_AUTHENTICATOR_VERSION ]]; then
echo "Version mismatch between commit message and Cargo.toml for safe_authenticator.";
false;
fi;
else
SAFE_AUTHENTICATOR_VERSION=${TRAVIS_COMMIT:0:7};
fi
- if [[ "$TRAVIS_COMMIT_MESSAGE" =~ [Vv]ersion[[:space:]]change.*safe_app[[:space:]]to[[:space:]]([^;]+) ]]; then
SAFE_APP_VERSION=v$(cargo pkgid --manifest-path=safe_app/Cargo.toml | sed -e "s/.*[:#]\(.*\)/\1/");
if [[ "v${BASH_REMATCH[1]}" != $SAFE_APP_VERSION ]]; then
echo "Version mismatch between commit message and Cargo.toml for safe_app.";
false;
fi;
else
SAFE_APP_VERSION=${TRAVIS_COMMIT:0:7};
fi
- curl -sSL https://github.com/maidsafe/QA/raw/master/travis/cargo_install.sh > cargo_install.sh
- bash cargo_install.sh cargo-prune;
- if [[ "$TRAVIS_RUST_VERSION" == 1.19.0 && $TRAVIS_EVENT_TYPE = pull_request ]]; then
bash cargo_install.sh rustfmt 0.9.0;
elif [[ "$TRAVIS_RUST_VERSION" =~ nightly && $TRAVIS_EVENT_TYPE = pull_request ]]; then
bash cargo_install.sh clippy 0.0.144;
fi
script:
- if [[ "$TRAVIS_RUST_VERSION" =~ 1.19.0 && $TRAVIS_EVENT_TYPE = pull_request ]]; then
(
set -x;
if [[ "$TRAVIS_RUST_VERSION" == 1.19.0 ]]; then
echo "--- Check format ---" &&
cargo fmt --all -- --write-mode=diff;
fi &&
echo "--- Test ffi_utils ---" &&
cargo test --verbose --release --manifest-path=ffi_utils/Cargo.toml &&
echo "--- Check compilation against actual routing ---" &&
cargo check --verbose --release --manifest-path=safe_core/Cargo.toml &&
cargo check --verbose --features=testing --release --lib --tests --manifest-path=safe_core/Cargo.toml &&
cargo check --verbose --features=testing --release --lib --tests --manifest-path=safe_authenticator/Cargo.toml &&
cargo check --verbose --features=testing --release --lib --tests --manifest-path=safe_app/Cargo.toml &&
echo "--- Test against mock ---" &&
cargo test --verbose --release --features=use-mock-routing --manifest-path=safe_core/Cargo.toml &&
cargo test --verbose --release --features=use-mock-routing --manifest-path=safe_authenticator/Cargo.toml &&
cargo test --verbose --release --features=use-mock-routing --manifest-path=safe_app/Cargo.toml;
);
elif [[ $TRAVIS_EVENT_TYPE = pull_request ]]; then
(
set -x;
cd ffi_utils && cargo clippy --profile=test &&
echo "--- Test build for real network ---" &&
cd ../safe_core && cargo clippy --profile=test --features=testing &&
cd ../safe_authenticator && cargo clippy --profile=test --features=testing &&
cd ../safe_app && cargo clippy --profile=test --features=testing &&
echo "--- Test build for mock-routing ---" &&
cd ../safe_core && cargo clippy --profile=test --features=use-mock-routing &&
cd ../safe_authenticator && cargo clippy --profile=test --features=use-mock-routing &&
cd ../safe_app && cargo clippy --profile=test --features=use-mock-routing;
)
fi
after_script:
- if [[ $TRAVIS_EVENT_TYPE = pull_request && -n $(git diff --shortstat 2> /dev/null | tail -n1) ]]; then
echo "Working tree is dirty after building. Probably Cargo.lock should be updated.";
git status;
travis_terminate 1;
fi
before_cache:
- cargo prune
before_deploy:
- mkdir -p target/deploy
- if [[ "$TRAVIS_RUST_VERSION" =~ i686 ]]; then
ARCH=x86;
else
ARCH=x64;
fi
# We need to use `-x` on OS X since `strip` fails to remove global symbols from release builds on OS X.
- if [[ "$TRAVIS_OS_NAME" = linux ]]; then
SUFFIX=so;
else
SUFFIX=dylib STRIP_ARG=-x;
fi
# Build for mock.
- cargo build --verbose --release --features=use-mock-routing --manifest-path=safe_authenticator/Cargo.toml
- cargo build --verbose --release --features=use-mock-routing --manifest-path=safe_app/Cargo.toml
- strip $STRIP_ARG target/release/libsafe_authenticator.$SUFFIX target/release/libsafe_app.$SUFFIX
- zip -j target/deploy/safe_authenticator-mock-$SAFE_AUTHENTICATOR_VERSION-$TRAVIS_OS_NAME-$ARCH.zip target/release/libsafe_authenticator.$SUFFIX
- zip -j target/deploy/safe_app-mock-$SAFE_APP_VERSION-$TRAVIS_OS_NAME-$ARCH.zip target/release/libsafe_app.$SUFFIX
# Build for production.
- cargo build --verbose --release --manifest-path=safe_authenticator/Cargo.toml
- cargo build --verbose --release --manifest-path=safe_app/Cargo.toml
- strip $STRIP_ARG target/release/libsafe_authenticator.$SUFFIX target/release/libsafe_app.$SUFFIX
- zip -j target/deploy/safe_authenticator-$SAFE_AUTHENTICATOR_VERSION-$TRAVIS_OS_NAME-$ARCH.zip target/release/libsafe_authenticator.$SUFFIX
- zip -j target/deploy/safe_app-$SAFE_APP_VERSION-$TRAVIS_OS_NAME-$ARCH.zip target/release/libsafe_app.$SUFFIX
deploy:
provider: s3
access_key_id: AKIAIA2TXTG7EV5VIG2Q
secret_access_key:
secure: qEDay6TCAy3tBLqLYFOx9OjAdoRl010paK2//teFETfwUfJA/RtNSfkp1yrgx+kZ3FO8cthdDnwR3zjM3pkCL+5mGkQMAgvRY7rcEB5H1VyO4jkZRoB4n/yUu5jB4dHdeeRWTOJxNOOPA0G1Q65LLkJql2JGoJatqE3pBmJm0X8=
bucket: safe-client-libs
local-dir: target/deploy
acl: public_read
region: eu-west-2
skip_cleanup: true
on:
branch: master
tags: false
condition: $TRAVIS_RUST_VERSION =~ 1.19.0 && $TRAVIS_EVENT_TYPE = push
after_deploy: rm -rf target/deploy