18
18
#
19
19
# So, it's complicated.
20
20
21
+ # Exit immediately if a command exits with a non-zero status.
21
22
set -e
22
23
24
+ echo " "
25
+
26
+ # We use `travis_fold` commands to hide chunks of the Travis-CI log. Follow the
27
+ # usage documentation below and put `travis_fold_start`/`travis_fold_end` pairs
28
+ # _inside_ `if` blocks to reduce the log noise. (For example, after `set -x`,
29
+ # `if` statements print out as `+ false`, which is not very useful.)
30
+
31
+ # Usage: travis_fold_start <fold-name> <title> [<verbose>]
32
+ #
33
+ # Start a fold with a name and title and (optionally) enable Bash verbose
34
+ # logging.
35
+ #
36
+ # <fold-name> string to use with travis_fold_end to close the fold
37
+ # <title> string that appears alone when the fold is closed
38
+ # <verbose> (optional) if non-empty, enables Bash verbose echoing
39
+ #
40
+ function travis_fold_start() {
41
+ echo " travis_fold:start:$1 "
42
+ echo -e " \033[33;1m$2 \033[0m"
43
+ if [ -n " $3 " ]; then
44
+ set -x
45
+ fi
46
+ }
47
+
48
+ # Usage: travis_fold_end <fold-name>
49
+ #
50
+ # End a fold started with the given name and disable Bash verbose logging in
51
+ # case it was enabled by `travis_fold_start`.
52
+ #
53
+ # <fold-name> string that should have been used with travis_fold_start to
54
+ # open the fold
55
+ #
56
+ function travis_fold_end() {
57
+ set +x
58
+ echo " "
59
+ echo " travis_fold:end:$1 "
60
+ }
61
+
23
62
# Helpful context.
24
63
64
+ travis_fold_start env " Environment variables"
25
65
echo " TRAVIS_ALLOW_FAILURE: $TRAVIS_ALLOW_FAILURE "
26
66
echo " TRAVIS_BRANCH: $TRAVIS_BRANCH "
27
67
echo " TRAVIS_BUILD_ID: $TRAVIS_BUILD_ID "
@@ -72,42 +112,27 @@ else
72
112
is_release_build=false
73
113
fi
74
114
echo " is_release_build: $is_release_build "
75
-
76
- # Start being verbose. We use Travis "fold" commands to provide a bit more
77
- # context, partially because in `set -x` mode the "if" statements just print
78
- # out as `+ false`.
79
-
80
- function travis_start_fold() {
81
- echo -e " \ntravis_fold:start:$1 \033[33;1m$2 \033[0m"
82
- set -x
83
- }
84
-
85
- function travis_end_fold() {
86
- set +x
87
- echo -e " \ntravis_fold:end:$1 \r"
88
- }
89
-
90
- echo " "
115
+ travis_fold_end env
91
116
92
117
# The special tag "continuous" is used to maintain a GitHub "release" that
93
118
# tracks `master`. If we've been triggered for that, that means that something
94
119
# *else* was triggered that caused the continuous deployment code to fire.
95
120
# So we should do nothing.
96
121
97
- travis_start_fold continuous_abort " Abort if special continuous release tag?"
98
122
if [[ " $TRAVIS_TAG " == continuous ]] ; then
123
+ echo -e " \033[34;1mThis is a 'continuous' release. Exiting.\033[0m"
99
124
exit 0
100
125
fi
101
- travis_end_fold continuous_abort
102
126
103
- # Pre-build setup.
127
+ # Install dependencies
104
128
105
- travis_start_fold pre_build " Pre-build setup for OS = $TRAVIS_OS_NAME "
106
129
if [[ " $TRAVIS_OS_NAME " == osx ]]; then
130
+ travis_fold_start install_deps " Install dependencies" verbose
107
131
export OPENSSL_INCLUDE_DIR=$( brew --prefix openssl) /include
108
132
export OPENSSL_LIB_DIR=$( brew --prefix openssl) /lib
109
133
export DEP_OPENSSL_INCLUDE=$( brew --prefix openssl) /include
110
134
export PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig
135
+ travis_fold_end install_deps
111
136
elif [[ " $TRAVIS_OS_NAME " == linux ]] ; then
112
137
if $is_docker_build ; then
113
138
: # Don't need the deps here; all the action is in the container.
@@ -119,6 +144,7 @@ elif [[ "$TRAVIS_OS_NAME" == linux ]] ; then
119
144
# https://unix.stackexchange.com/questions/315502/how-to-disable-apt-daily-service-on-ubuntu-cloud-vm-image
120
145
# . We adopt the workaround from the StackExchange post.
121
146
147
+ travis_fold_start install_deps " Install dependencies" verbose
122
148
sudo systemctl stop apt-daily.timer
123
149
sudo systemctl stop apt-daily.service
124
150
sudo systemctl kill --kill-who=all apt-daily.service
@@ -130,47 +156,55 @@ elif [[ "$TRAVIS_OS_NAME" == linux ]] ; then
130
156
sudo add-apt-repository -y ppa:k-peter/tectonic-ci
131
157
sudo apt-get update
132
158
sudo apt-get install -y libharfbuzz-dev
159
+ travis_fold_end install_deps
133
160
fi
134
161
fi
135
162
136
- travis_end_fold pre_build
137
-
138
163
# Check that the code is properly rustfmt'd and clippy'd.
139
164
140
- travis_start_fold check_rustfmt_clippy " Maybe rustfmt and clippy? ($is_main_build )"
141
165
if $is_main_build ; then
142
- rustup component add rustfmt clippy
166
+ travis_fold_start cargo_fmt " cargo fmt" verbose
167
+ rustup component add rustfmt
143
168
cargo fmt --all -- --check
169
+ travis_fold_end cargo_fmt
170
+ travis_fold_start cargo_clippy " cargo clippy" verbose
171
+ rustup component add clippy
144
172
cargo clippy --all --all-targets --all-features -- --deny warnings
173
+ travis_fold_end cargo_clippy
145
174
fi
146
- travis_end_fold check_rustfmt_clippy
147
175
148
176
# OK, the biggie: does it compile and pass the test suite?
149
177
150
- travis_start_fold build_and_test " Build and test"
151
178
if $is_docker_build ; then
179
+ travis_fold_start docker_build " docker build" verbose
152
180
docker build -t ttci-$IMAGE dist/docker/$IMAGE /
181
+ travis_fold_end docker_build
182
+ travis_fold_start docker_test " docker test" verbose
153
183
docker run -v $( pwd) :/tectonic ttci-$IMAGE
184
+ travis_fold_end docker_test
154
185
else
186
+ travis_fold_start cargo_build " cargo build" verbose
155
187
cargo build --verbose
188
+ travis_fold_end cargo_build
189
+ travis_fold_start cargo_test " cargo test" verbose
156
190
cargo test
191
+ travis_fold_end cargo_test
157
192
fi
158
- travis_end_fold build_and_test
159
193
160
194
# OK! If we got this far, we think we made a functional set of (debug-mode)
161
195
# Tectonic artifacts for this build matrix element.
162
196
163
197
# The main build is equipped to test code coverage.
164
198
165
- travis_start_fold coverage " Maybe analyze code coverage? ($is_main_build )"
166
199
if $is_main_build ; then
200
+ travis_fold_start cargo_kcov " cargo kcov" verbose
167
201
sudo apt-get install -y kcov
168
202
cargo install --force cargo-kcov
169
203
cargo test --no-run
170
204
env RUNNING_COVERAGE=1 cargo kcov --no-clean-rebuild
171
205
bash <( curl -s https://codecov.io/bash)
206
+ travis_fold_end cargo_kcov
172
207
fi
173
- travis_end_fold coverage
174
208
175
209
# If we're a "continuous deployment" build, we should push up artifacts for
176
210
# the "continuous" pseudo-release. Right now, all we do is make an AppImage
@@ -179,9 +213,9 @@ travis_end_fold coverage
179
213
# the build matrix to contribute various artifacts, we're going to need to
180
214
# take a different tactic.
181
215
182
- travis_start_fold continuous_deployment " Maybe continuous deployment activities? ($is_continuous_deployment_build )"
183
216
if $is_continuous_deployment_build ; then
184
217
if $is_main_build ; then
218
+ travis_fold_start continuous " Continuous deployment" verbose
185
219
# Careful! For the code coverage, we use "-C link-dead-code", which we
186
220
# don't want for release artifacts. (Which are built with `cargo build
187
221
# --release` inside dist/appimage/build.sh.) But if we ever add other
@@ -195,18 +229,18 @@ if $is_continuous_deployment_build; then
195
229
UPDATE_INFORMATION=" gh-releases-zsync|$repo_info |continuous|tectonic-*.AppImage.zsync" \
196
230
dist/appimage/build.sh
197
231
bash ./upload.sh dist/appimage/tectonic-* .AppImage*
232
+ travis_fold_end continuous
198
233
fi
199
234
200
235
# TODO: Do something with the Linux static build?
201
236
fi
202
- travis_end_fold continuous_deployment
203
237
204
238
# If we're a release build, we should create and upload official release
205
239
# artifacts, etc.
206
240
207
- travis_start_fold release " Maybe release activities? ($is_release_build )"
208
241
if $is_release_build ; then
209
242
if $is_main_build ; then
243
+ travis_fold_start release " Release deployment" verbose
210
244
# Careful! See the warning above.
211
245
unset RUSTFLAGS
212
246
@@ -220,8 +254,8 @@ if $is_release_build; then
220
254
-in dist/deploy_key.enc -out /tmp/deploy_key -d
221
255
chmod 600 /tmp/deploy_key
222
256
bash dist/arch/deploy.sh
257
+ travis_fold_end release
223
258
fi
224
259
225
260
# TODO: Do something with the Linux static build?
226
261
fi
227
- travis_end_fold release
0 commit comments