Skip to content

Commit c9dd80c

Browse files
author
Junfeng Li
committed
Update CI script.
- Do not use zip. - For Windows, use gnu toolchain, which will eliminate appveyor and MSVC dependencies. - Change integration tests logging level. - Only cat logs when tests failed. - Use docker command availability to decide whether to run integration tests. - Fix compatible with Windows. libc on Windows does not have `waitpid`. - Echo as error when exited unexpectedly.
1 parent e83a640 commit c9dd80c

File tree

12 files changed

+36
-140
lines changed

12 files changed

+36
-140
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
matrix:
1515
include:
1616
# Linux
17-
- env: INTEGRATION_TEST=1 TARGETS=i686-unknown-linux-musl:x86_64-unknown-linux-musl:i686-pc-windows-gnu:x86_64-pc-windows-gnu
17+
- env: TARGETS=i686-unknown-linux-musl:x86_64-unknown-linux-musl:i686-pc-windows-gnu:x86_64-pc-windows-gnu
1818

1919
# OSX
2020
- env: TARGETS=x86_64-apple-darwin
@@ -47,7 +47,7 @@ deploy:
4747
api_key:
4848
secure: Dr/oCr65KsSjcDk21+CS7cZ/UR/ktncwDLsQIF/UyFC0bCP5MFbQ76Cz7Dy460hMtjCiy/X4QukxtiF0oeaOvi1szbo29s1KYjc9xPVhI1roQUyGghkGzo+V5Ncum3pwKF1Mb/kotikh2QSFQJYA3o32HhMNVb+1bApD+bwyAsGlnlAYYWQy+EcIDByhG9B4HB2pScoblyPmbgQPftc/E3ldKkm4iPNiNNa9T/rlXazNOkuiAqbRR/qBI4sSVAFFvfzvEcva4k5X8wzWfdsiDk9HKnNL7iDzdMMExSOoIKoet6jK3E3f2VbwD7tRw+We2cB+EBrW7xtkcck/BbEtnXhiWpt+Gg4qxXjZ6RVXgVw9tH0CGp2FjZ6B2DQ/chtgzIzLE+iuhJwhRqJ+7IW7LgNrnEsi6QelCiNKsm0aqXEpU5BVoBXxBegJHgHhunkKPpqmhYps5KsH4RPzrduqk2LHlYriwaGumcEnOVXzoJJs0NE6RaFzwl5cxmiKxC8tl1/dE4w2WmYM8n3yMmfbCd520bTQbvOe68k/8iV7gqZmOnWX//PLJ6Zf+v7T0yhaFC8Oj8ueWUCCSd7TAC3rHxd52BVZnQF1xXosiiN2PyWGZGbxaO1Qh7UbF1Xk+ot2pwEsP5Q8h155DlYJ/3mMzLvSi6Cp+78YKsoFlpfDy6w=
4949
file_glob: true
50-
file: $CRATE_NAME-$TRAVIS_TAG-*
50+
file: bin/$CRATE_NAME-$TRAVIS_TAG-*
5151
overwrite: true
5252
on:
5353
tags: true

INSTALL.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ Obviously you need [neovim](https://github.com/neovim/neovim#install-from-packag
44

55
# 2. Install dependencies
66

7-
For Windows user, [Microsoft Visual C++ 2015 runtime] is needed.
8-
9-
[Microsoft Visual C++ 2015 runtime]: https://www.microsoft.com/en-us/download/details.aspx?id=52685
7+
None.
108

119
# 3. Install this plugin
1210
Choose steps matching your plugin manager.

appveyor.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

ci/before_deploy.ps1

Lines changed: 0 additions & 8 deletions
This file was deleted.

ci/before_deploy.sh

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
1-
# This script takes care of building your crate and packaging it for release
2-
31
set -ex
42

53
package() {
6-
local TARGET=$1 \
7-
src=$(pwd) \
8-
stage=
9-
10-
case $TRAVIS_OS_NAME in
11-
linux)
12-
stage=$(mktemp -d)
13-
;;
14-
osx)
15-
stage=$(mktemp -d -t tmp)
16-
;;
17-
esac
18-
19-
test -f Cargo.lock || cargo generate-lockfile
20-
21-
cross build --target $TARGET --release
22-
cp target/$TARGET/release/$BIN_NAME $stage/
23-
24-
cd $stage
25-
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
26-
cd $src
4+
BIN_NAME_TAG=$CRATE_NAME-$TRAVIS_TAG-$TARGET
5+
if [[ $TARGET =~ .*windows.* ]]; then
6+
BIN_NAME_TAG=$BIN_NAME_TAG.exe
7+
fi
278

28-
rm -rf $stage
9+
cp -f target/$TARGET/release/$BIN_NAME bin/$BIN_NAME_TAG
2910
}
3011

3112
release_tag() {
32-
case $TRAVIS_OS_NAME in
33-
linux)
34-
cross build --target $TARGET --release
35-
cp --force target/$TARGET/release/$BIN_NAME bin/
36-
;;
37-
osx)
38-
make release
39-
;;
40-
esac
13+
cp -f target/$TARGET/release/$BIN_NAME bin/
4114

4215
git config --global user.email "[email protected]"
4316
git config --global user.name "Travis CI"
@@ -54,12 +27,12 @@ release_tag() {
5427

5528
TARGETS=(${TARGETS//:/ })
5629
for TARGET in "${TARGETS[@]}"; do
30+
BIN_NAME=$CRATE_NAME
5731
if [[ $TARGET =~ .*windows.* ]]; then
58-
BIN_NAME=$CRATE_NAME.exe
59-
else
60-
BIN_NAME=$CRATE_NAME
32+
BIN_NAME=$BIN_NAME.exe
6133
fi
6234

63-
release_tag $TARGET
64-
package $TARGET
35+
cross build --release --target $TARGET
36+
release_tag
37+
package
6538
done

ci/script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ set -o xtrace
55

66
make test
77

8-
if [[ ${INTEGRATION_TEST:-0} == 1 ]]; then
8+
if command -v docker > /dev/null ; then
99
make integration-test-docker
1010
fi

install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if ($ENV:PROCESSOR_ARCHITECTURE -eq "AMD64") {
99
$filename = $filename + 'i686'
1010
}
1111

12-
$filename = $filename + '-pc-windows-msvc.exe'
12+
$filename = $filename + '-pc-windows-gnu.exe'
1313
$url = $url + $filename
1414

1515
$path = "bin\$name.exe"

install.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ name=languageclient
1212

1313
function try_curl() {
1414
command -v curl > /dev/null && \
15-
curl -fL $1 | tar -xzf - && \
16-
mv -f $name bin/
15+
curl --fail --location $1 --output bin/$name
1716
}
1817

1918
function try_wget() {
2019
command -v wget > /dev/null && \
21-
wget -O - $1 | tar -xzf - && \
22-
mv -f $name bin/
20+
wget --output-document=bin/$name $1
2321
}
2422

2523
function download() {
@@ -41,8 +39,8 @@ function try_build() {
4139
arch=$(uname -sm)
4240
binary=""
4341
case "${arch}" in
44-
Linux\ *64) download $name-$version-x86_64-unknown-linux-musl.tar.gz ;;
45-
Linux\ *86) download $name-$version-i686-unknown-linux-musl.tar.gz ;;
46-
Darwin\ *64) download $name-$version-x86_64-apple-darwin.tar.gz ;;
42+
Linux\ *64) download $name-$version-x86_64-unknown-linux-musl ;;
43+
Linux\ *86) download $name-$version-i686-unknown-linux-musl ;;
44+
Darwin\ *64) download $name-$version-x86_64-apple-darwin ;;
4745
*) echo "No pre-built binary available for ${arch}."; try_build ;;
4846
esac

plugin/LanguageClient.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function! s:HandleMessage(job, lines, event) abort
108108
endif
109109
elseif a:event == 'exit'
110110
if a:lines !=# '0'
111-
echomsg 'LanguageClient exited with: ' . string(a:lines)
111+
call s:Echoerr('languageclient exited with: ' . string(a:lines))
112112
endif
113113
else
114114
if $LANGUAGECLIENT_DEBUG

src/languageclient.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,16 @@ impl ILanguageClient for Arc<Mutex<State>> {
138138
line = line.strip();
139139
if line.is_empty() {
140140
count_empty_lines += 1;
141-
if count_empty_lines > 3 {
142-
let child_id = self.get(|state| match state.child_ids.get(&languageId) {
143-
Some(id) => Ok(*id),
144-
None => Err(format_err!("Failed to get child id")),
145-
})?;
146-
147-
let mut status: libc::c_int = 0;
148-
unsafe { libc::waitpid(child_id as i32, &mut status, libc::WNOHANG) };
149-
if status != 0 {
150-
if let Err(err) = self.cleanup(languageId.clone()) {
151-
error!("Error in cleanup: {:?}", err);
152-
}
153-
154-
let message = format!("Language server ({}) exited unexpectedly!", languageId);
155-
if let Err(err) = self.echoerr(&message) {
156-
error!("Error in echoerr: {:?}", err);
157-
};
158-
return Err(format_err!("{}", message));
141+
if count_empty_lines > 5 {
142+
if let Err(err) = self.cleanup(languageId.clone()) {
143+
error!("Error in cleanup: {:?}", err);
159144
}
145+
146+
let message = format!("Language server ({}) exited unexpectedly!", languageId);
147+
if let Err(err) = self.echoerr(&message) {
148+
error!("Error in echoerr: {:?}", err);
149+
};
150+
return Err(format_err!("{}", message));
160151
}
161152

162153
let mut buf = vec![0; content_length];

0 commit comments

Comments
 (0)