Skip to content

Commit 1fdcbb6

Browse files
committed
CI: Improve test efficiency
- Remove Homebrew cache - Download latest MacVim - Install lua manually
1 parent b7d2198 commit 1fdcbb6

File tree

3 files changed

+72
-23
lines changed

3 files changed

+72
-23
lines changed

.travis.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ jobs:
2222
- THEMIS_PROFILE=vim-profile-master.txt
2323
- name: Vim MacVim latest
2424
os: osx
25-
osx_image: xcode9.4
2625
env:
26+
- VIM_VERSION=latest
2727
- THEMIS_PROFILE=vim-profile-osx.txt
28-
cache:
29-
directories:
30-
- $HOME/Library/Caches/Homebrew/
31-
- /usr/local/Homebrew/Library/Homebrew/vendor/
32-
- /usr/local/Homebrew/Library/Taps/
33-
before_cache:
34-
- brew cleanup
3528
- name: Vim Lint only
3629
os: linux
3730
env:
@@ -45,16 +38,16 @@ addons:
4538
- python-dev
4639
- python3-dev
4740
- python3-pip
48-
homebrew:
49-
packages:
50-
- macvim
51-
update: true
5241

5342
install:
5443
- rvm reset
55-
- bash scripts/install-vim.sh
56-
- export PATH=$HOME/vim/bin:$PATH
57-
# Install https://github.com/Vimjas/covimerage
44+
- |
45+
if [[ -n "${VIM_VERSION}" ]]; then
46+
bash scripts/install-lua.sh
47+
bash scripts/install-vim.sh
48+
fi
49+
- export PATH=${HOME}/bin:${PATH}
50+
# Install https://github.com/Vimjas/covimerage
5851
- pip3 install --user --upgrade pip
5952
- pip3 install --user --upgrade setuptools
6053
- pip3 install --user covimerage

scripts/install-lua.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
LUA_DIST=lua-5.3.5
6+
7+
case "${TRAVIS_OS_NAME}" in
8+
linux)
9+
LUA_TARGET=linux
10+
LUA_SHLIB=liblua.so
11+
;;
12+
osx)
13+
LUA_TARGET=macosx
14+
LUA_SHLIB=liblua5.3.dylib
15+
;;
16+
*)
17+
echo "Unknown value of \${TRAVIS_OS_NAME}: ${TRAVIS_OS_NAME}"
18+
exit 65
19+
;;
20+
esac
21+
22+
cd "${TMPDIR:-/tmp}"
23+
curl -LOs "https://www.lua.org/ftp/${LUA_DIST}.tar.gz"
24+
tar xf "${LUA_DIST}.tar.gz"
25+
cd "${LUA_DIST}"
26+
cat <<EOT >src/Makefile.shared
27+
LUA_SO= ${LUA_SHLIB}
28+
29+
\$(LUA_SO): \$(BASE_O)
30+
\$(CC) -shared -o \$@ \$^
31+
EOT
32+
echo 'include Makefile.shared' >>src/Makefile
33+
make "${LUA_TARGET}" MYCFLAGS='-fPIC -fno-common'
34+
make -C src "${LUA_SHLIB}"
35+
make install INSTALL_TOP="${HOME}/lua" TO_LIB="${LUA_SHLIB}"
36+
cd "${HOME}/lua/lib"

scripts/install-vim.sh

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,45 @@
22

33
set -ev
44

5+
: ${TMPDIR:=/tmp}
6+
57
case "${TRAVIS_OS_NAME}" in
68
linux)
7-
if [[ "${VIM_VERSION}" == "" ]]; then
9+
if [[ -z "${VIM_VERSION}" ]]; then
810
exit
911
fi
10-
git clone --depth 1 --branch "${VIM_VERSION}" https://github.com/vim/vim /tmp/vim
11-
cd /tmp/vim
12-
./configure --prefix="${HOME}/vim" --with-features=huge --enable-pythoninterp \
13-
--enable-python3interp --enable-fail-if-missing
12+
git clone --depth 1 --branch "${VIM_VERSION}" https://github.com/vim/vim "${TMPDIR}/vim"
13+
cd "${TMPDIR}/vim"
14+
./configure --prefix="${HOME}/vim" --with-features=huge --with-lua-prefix="${HOME}/lua" \
15+
--enable-luainterp --enable-pythoninterp --enable-python3interp --enable-fail-if-missing
1416
make -j2
1517
make install
18+
VIM_BIN=vim/bin/vim
1619
;;
1720
osx)
18-
# Instead of --with-override-system-vim, manually link the executable because
19-
# it prevents MacVim installation with a bottle.
20-
ln -fs "$(brew --prefix macvim)/bin/mvim" "/usr/local/bin/vim"
21+
VIM_URL=$(curl -s --retry 3 https://vim-jp.org/redirects/macvim-dev/macvim/latest.json \
22+
| sed 's@.*"redirect_url":"\([^"]*\)".*@\1@')
23+
if [[ -z "${VIM_URL}" ]]; then
24+
echo "Can't get Vim's URL"
25+
exit 64
26+
fi
27+
echo "Download from ${VIM_URL}"
28+
curl -L -s -o "${TMPDIR}/MacVim.dmg" "${VIM_URL}"
29+
hdiutil attach -quiet -mountpoint "/Volumes/MacVim" "${TMPDIR}/MacVim.dmg"
30+
cp -a "/Volumes/MacVim/MacVim.app" "${HOME}"
31+
hdiutil detach "/Volumes/MacVim"
32+
VIM_BIN=MacVim.app/Contents/MacOS/Vim
2133
;;
2234
*)
2335
echo "Unknown value of \${TRAVIS_OS_NAME}: ${TRAVIS_OS_NAME}"
2436
exit 65
2537
;;
2638
esac
39+
40+
mkdir -p "${HOME}/bin"
41+
cat <<EOT >"${HOME}/bin/vim"
42+
#!/bin/bash
43+
export LD_LIBRARY_PATH=\${HOME}/lua/lib:\${LD_LIBRARY_PATH}
44+
exec "\${HOME}/${VIM_BIN}" "\$@"
45+
EOT
46+
chmod +x "${HOME}/bin/vim"

0 commit comments

Comments
 (0)