-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
115 lines (109 loc) · 5.49 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
sudo: false
language: generic
cache: cargo
matrix:
include:
- env: LANGUAGE=Rust STARTING_DIR="api/" CLIPPY=true DEPLOY=true DEPLOY_FILE="$TRAVIS_BUILD_DIR/../sudoku-backend-$TRAVIS_TAG"
language: rust
rust: nightly
- env: LANGUAGE=Ruby STARTING_DIR="api/" DEPLOY=true DEPLOY_FILE="$TRAVIS_BUILD_DIR/../sudoku-backend-man-$TRAVIS_TAG.tbz2"
language: ruby
rvm: "2.2"
- env: LANGUAGE=Rust-doc STARTING_DIR="api/" DEPLOY=true DEPLOY_FILE="$TRAVIS_BUILD_DIR/../sudoku-backend-doc-$TRAVIS_TAG.tbz2"
language: rust
rust: nightly
before_install:
- if [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]; then
openssl aes-256-cbc -K $encrypted_cbe65774419e_key -iv $encrypted_cbe65774419e_iv -in gh_rsa.enc -out gh_rsa -d;
fi
install:
- if [ "$LANGUAGE" == "Ruby" ]; then gem install ronn; fi
script:
- cd "$STARTING_DIR"
-
- if [ "$LANGUAGE" == "Rust" ]; then cargo build --verbose; fi
- if [ "$LANGUAGE" == "Rust" ]; then cargo test --verbose; fi
- if [ "$LANGUAGE" == "Rust" ] && [ "$DEPLOY" ] && [ "$TRAVIS_TAG" ]; then cargo build --verbose --release; fi
-
- if [ "$LANGUAGE" == "Rust" ] && [ "$CLIPPY" ]; then
cargo install -f clippy;
cargo clippy;
fi || true
-
# Diesel denies warnings, even in documentation, which produces them, meaning we can *not* build the documentation w/o patching that out
- if [ "$LANGUAGE" == "Rust-doc" ]; then
sed "s;#!\[deny;//;" -i "$HOME/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/diesel-1.3.2/src/lib.rs";
cargo doc;
fi
-
- if [ "$LANGUAGE" == "Ruby" ]; then
mkdir man; pushd man;
cp ../sudoku-backend.md sudoku-backend.md;
ronn --organization="Galactim" sudoku-backend.md;
popd;
fi
after_success:
- if [ "$LANGUAGE" == "Rust" ] && [ "$DEPLOY" ] && [ "$TRAVIS_TAG" ]; then
cp target/release/sudoku-backend "$DEPLOY_FILE";
strip --strip-all --remove-section=.comment --remove-section=.note "$DEPLOY_FILE";
fi
- if [ "$LANGUAGE" == "Rust-doc" ] && ( [ "$TRAVIS_BRANCH" = "master" ] || [ "$TRAVIS_BRANCH" = "develop" ] ) && [ "$TRAVIS_SECURE_ENV_VARS" = "true" ] && [ "$TRAVIS_COMMIT_RANGE" ] && ! [ "$TRAVIS_TAG" ]; then
(
echo "Update docs for commits $TRAVIS_COMMIT_RANGE";
echo;
git log "$TRAVIS_COMMIT_RANGE" --pretty=oneline;
) >> "$TRAVIS_BUILD_DIR/../DOC_UPDATE_MSG";
mkdir -p ~/.ssh && cp "$TRAVIS_BUILD_DIR/gh_rsa" ~/.ssh/id_rsa && chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa;
git clone -b backend-doc "git@github.com:$TRAVIS_REPO_SLUG.git" "$TRAVIS_BUILD_DIR-backend-doc";
mkdir -p target;
cp -rf target/doc/* "$TRAVIS_BUILD_DIR-backend-doc";
pushd "$TRAVIS_BUILD_DIR-backend-doc";
git config --global user.email "nabijaczleweli@gmail.com";
git config --global user.name "Nabijaczleweli Autouploader Bot";
git config --global push.default simple;
git add -- *;
git commit -F "$TRAVIS_BUILD_DIR/../DOC_UPDATE_MSG";
git push;
popd;
fi
- if [ "$LANGUAGE" == "Rust-doc" ] && [ "$TRAVIS_TAG" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "true" ]; then
cp -r target/doc "$TRAVIS_BUILD_DIR/../sudoku-backend-doc-$TRAVIS_TAG";
pushd "$TRAVIS_BUILD_DIR/..";
tar -caf "sudoku-backend-doc-$TRAVIS_TAG.tbz2" "sudoku-backend-doc-$TRAVIS_TAG";
rm -rf "sudoku-backend-doc-$TRAVIS_TAG";
popd;
fi
- if [ "$LANGUAGE" == "Ruby" ] && [ "$TRAVIS_SECURE_ENV_VARS" == "true" ] && [ "$TRAVIS_COMMIT_RANGE" ] && [ "$(git diff "$TRAVIS_COMMIT_RANGE" "$TRAVIS_BUILD_DIR/api/sudoku-backend.md" | wc -l)" != "0" ] && ! [ "$TRAVIS_TAG" ]; then
(
echo "Update Rust manual for commits $TRAVIS_COMMIT_RANGE";
echo;
git log $TRAVIS_COMMIT_RANGE --pretty=oneline;
) >> $TRAVIS_BUILD_DIR/../MAN_UPDATE_MSG;
mkdir -p ~/.ssh && cp "$TRAVIS_BUILD_DIR/gh_rsa" ~/.ssh/id_rsa && chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa;
git clone -b backend-man git@github.com:$TRAVIS_REPO_SLUG.git "$TRAVIS_BUILD_DIR-backend-man";
cp -f man/* "$TRAVIS_BUILD_DIR-backend-man";
pushd "$TRAVIS_BUILD_DIR-backend-man";
git config --global user.email "nabijaczleweli@gmail.com";
git config --global user.name "Nabijaczleweli Autouploader Bot";
git config --global push.default simple;
git add *;
git commit -F $TRAVIS_BUILD_DIR/../MAN_UPDATE_MSG;
git push;
popd;
fi
- if [ "$LANGUAGE" == "Ruby" ] && [ "$TRAVIS_TAG" ]; then
cp -r man "$TRAVIS_BUILD_DIR/../sudoku-backend-man-$TRAVIS_TAG";
pushd "$TRAVIS_BUILD_DIR/..";
tar -caf "sudoku-backend-man-$TRAVIS_TAG.tbz2" "sudoku-backend-man-$TRAVIS_TAG";
rm -rf "sudoku-backend-man-$TRAVIS_TAG";
popd;
fi
deploy:
provider: releases
api_key:
secure: "KA9GWkx7UfBIWEqY88SxtAdMGKJV7X3ft+pRCiNfLpxOeTiFTeHAFfnGQl1PmoV0jfsSDuU+PIxMxODKquuv67AzljCqZXXnV/azZJTfVtTpY/Ya+0/GFKROV4O0TcgvK4rEJ9QVvOYLanDJtDk0aYAMpSTok0vhF/GXxlqNnYKNjTEFoaBUkA4MGmy7fV15Mb6FNJUY/vQ4SIksv8jhj6NROHNVLqz131s2blYi3/QUbfpAF93LrQ+2g4c6bp58m2YiCsmeRAO+148y6Z9r4gA0/XmbsJx6Ah+qOb1FHHYwNNTNoRybyDrLpSBjSnj7c5pwBFa8NvppxVNxYK8Yl9M3haYuq7eR9CUtyuBv/hLNC49Y06CF5llnTwTVj8sdrsvUkTNvteiLRyENrOgY598ZBQKvrfwNRYeewU3SXvkJt+CoUTn+seZYorftf2aUqZEm9n/WldLysPg/ocEHvTGx8oQHLfeEaEFV/Yl6NKxkIzUWWHKcF6qZnwz4Qs5TRwWZApeILiG8n1bGM9utqOIZfRqn7wBPKYs49NM1/Cs6kWnmBw4hXssshqNMlGC0k/wP/xRo5gDBrfT8k/IYFBt+Q3F9eiidx+eoWnAqSAxzc37ed5H7xzOX+nrmNy1FQTJpFigeCw6L5jJQ0JNAr0zLq1BrX04VmOam31L1HkI="
file: "$DEPLOY_FILE"
skip_cleanup: true
on:
tags: true
condition: $DEPLOY = true