summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: d60037c3e314213e18d27c5c5817d16007a2e305 (plain)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
language: c

env:
  global:
    - BUILD=yes TEST=test CONFOPT= LEAK_CFLAGS="-DEXITFREE" SHADOWOPT= SRCDIR=./src CHECK_AUTOCONF=no LOG_DIR="$TRAVIS_BUILD_DIR/logs"

_anchors:
  envs:
    - &tiny-nogui
      FEATURES=tiny TEST=testtiny CONFOPT="--disable-gui"
    - &tiny
      FEATURES=tiny TEST=testtiny
    - &small
      FEATURES=small TEST=testtiny
    - &normal
      FEATURES=normal
    - &linux-huge
      FEATURES=huge TEST="scripttests test_libvterm"
      CONFOPT="--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
    - &osx-huge # macOS build
      FEATURES=huge
      CONFOPT="--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
    - &unittests
      BUILD=no TEST=unittests FEATURES=huge CHECK_AUTOCONF=yes
    - &coverage
      CFLAGS="--coverage -DUSE_GCOV_FLUSH" LDFLAGS=--coverage
    - &asan # ASAN build
      SANITIZER_CFLAGS="-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
      ASAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/asan" UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/src/testdir/lsan-suppress.txt"
    - &shadowopt
      SHADOWOPT="-C src/shadow" SRCDIR=./src/shadow

  linux: &linux
    os: linux
    dist: bionic
    addons:
      apt:
        packages: &apt-packages
          - autoconf
          - clang
          - lcov
          - gettext
          - libcanberra-dev
          - libperl-dev
          - python-dev
          - python3-dev
          - liblua5.3-dev
          - lua5.3
          - ruby-dev
          - tcl-dev
          - cscope
          - libgtk2.0-dev
          - desktop-file-utils
          - libtool-bin
    services:
      - xvfb
    before_install:
      - rvm reset
      # Use llvm-cov instead of gcov when compiler is clang.
      - |
        if [[ "${CC}" = "clang" ]]; then
          ln -sf "$(command -v llvm-cov)" /home/travis/bin/gcov
        fi
      # Setup lua5.3 manually since its package doesn't provide alternative.
      # https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
      - |
        if [[ "${CONFOPT}" =~ luainterp ]]; then
          sudo update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 10
        fi
    before_script:
      - sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
      # It appears we can load "snd-dummy" on only amd64.
      - |
        if [[ "${TRAVIS_CPU_ARCH}" = amd64 ]]; then
          sudo bash ci/load-snd-dummy.sh || true
        fi
      - sudo usermod -a -G audio $USER
      - do_test() { sg audio "sg $(id -gn) '$*'"; }

  osx: &osx
    os: osx
    before_script:
      - do_test() { "$@"; }

  homebrew: &osx-homebrew
    addons:
      homebrew:
        packages:
          - lua
        update: true
    cache:
      directories:
        - /usr/local/Homebrew/Library/Homebrew/vendor/
        - /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/
    before_install:
      - rvm reset
      # Lua is not installed on macOS
      - export LUA_PREFIX=/usr/local

  coverage: &eval-coverage
    # needed for https support for coveralls building cffi only works with gcc,
    # not with clang
    - CC=gcc pip install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
    - ~/.local/bin/coveralls -b "${SRCDIR}" -x .xs -e "${SRCDIR}"/if_perl.c -e "${SRCDIR}"/xxd -e "${SRCDIR}"/libvterm --encodings utf-8
    - (cd "${SRCDIR}" && bash <(curl -s https://codecov.io/bash))

  asan_symbolize: &asan_symbolize
    # Update pyenv to fix the error "/opt/pyenv/libexec/pyenv: line 43: cd: asan_symbolize-6.0: Not a directory".
    # https://github.com/pyenv/pyenv/issues/580
    - (cd "${PYENV_ROOT}" && git fetch -p origin && git checkout "$(git rev-list --tags -n1)") &>/dev/null || true
    - for f in $(grep -l '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*); do asan_symbolize-11 -l "$f"; done

branches:
  except:
    - /^v[0-9]/

script:
  - mkdir -p "$LOG_DIR"
  - NPROC=$(getconf _NPROCESSORS_ONLN)
  - set -o errexit
  - echo -e "\\033[33;1mConfiguring Vim\\033[0m" && echo -en "travis_fold:start:configure\\r\\033[0K"
  - |
    if [[ "${CHECK_AUTOCONF}" = "yes" ]] && [[ "${CC}" = "gcc" ]]; then
      make -C src autoconf
    fi
  - |
    if [[ -n "${SHADOWOPT}" ]]; then
      make -C src shadow
    fi
  # "./configure" changes its working directory into "$SRCDIR".
  - ./configure --with-features=${FEATURES} ${CONFOPT} --enable-fail-if-missing
  - echo -en "travis_fold:end:configure\\r\\033[0K"
  - echo -e "\\033[33;1mBuilding Vim\\033[0m" && echo -en "travis_fold:start:build\\r\\033[0K"
  - |
    if [[ "${BUILD}" = "yes" ]]; then
      # Append various warning flags to CFLAGS.
      # BSD sed needs backup extension specified.
      sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
      if [[ "${TRAVIS_OS_NAME}" = "osx" ]] || [[ "${CC}" = "clang-11" ]]; then
        # On macOS, the entity of gcc is clang.
        sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
      else
        sed -i.bak -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
      fi
      make ${SHADOWOPT} -j${NPROC}
    fi
  - echo -en "travis_fold:end:build\\r\\033[0K"
  - set +o errexit
  # Show Vim version and also if_xx versions.
  - |
    if [[ "${BUILD}" = "yes" ]]; then
      "${SRCDIR}"/vim --version
      "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
      "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
    fi
  - echo -e "\\033[33;1mTesting Vim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
  - do_test make ${SHADOWOPT} ${TEST} && FOLD_MARKER=travis_fold
  - echo -en "${FOLD_MARKER}:end:test\\r\\033[0K"
  - |
    # Not all sanitizers will cause the tests to fail.  This helps since we can
    # see all the failures instead of just the first one, but we still want the
    # test phase to fail if any sanitizer issues are detected.
    if [[ -n "${ASAN_OPTIONS}" ]]; then
      if grep -q '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "$LOG_DIR"/*; then
        false
      fi
    fi

# Instead of using all environments with both compilers on both systems,
# exclude some builds on mac os x and linux.
# On mac os x "tiny" is always without GUI, use 2 compilers in 2 environments.
# Linux: 2 compilers on some of the environments + gcc on os390
jobs:
  include:
    #- <<: *osx
    #  name: tiny-nogui/clang
    #  compiler: clang
    #  env: *tiny-nogui
    #- <<: *osx
    #  name: tiny-nogui/gcc
    #  compiler: gcc
    #  env: *tiny-nogui
    #- <<: *osx
    #  <<: *osx-homebrew
    #  name: huge/clang
    #  compiler: clang
    #  env: *osx-huge
    #- <<: *osx
    #  <<: *osx-homebrew
    #  name: huge/gcc
    #  compiler: gcc
    #  env: *osx-huge
    #- <<: *linux
    #  name: tiny-nogui/clang
    #  compiler: clang
    #  env: *tiny-nogui
    #- <<: *linux
    #  name: tiny-nogui/gcc
    #  compiler: gcc
    #  env: *tiny-nogui
    #- <<: *linux
    #  name: tiny/clang
    #  compiler: clang
    #  env: *tiny
    #- <<: *linux
    #  name: tiny/gcc
    #  compiler: gcc
    #  env: *tiny
    #- <<: *linux
    #  name: small/gcc
    #  compiler: gcc
    #  env: *small
    #- <<: *linux
    #  name: normal+shadow/clang
    #  compiler: clang
    #  env:
    #    - *normal
    #    - *shadowopt
    #- <<: *linux
    #  name: normal+shadow/gcc
    #  compiler: gcc
    #  env:
    #    - *normal
    #    - *shadowopt
    - <<: *linux
      arch: s390x
      name: huge/gcc-s390x
      compiler: gcc
      env: *linux-huge
      services: []
    - <<: *linux
      arch: arm64
      name: huge/gcc-arm64
      compiler: gcc
      env: *linux-huge
      services: []
    #- <<: *linux
    #  name: huge+coverage/clang
    #  compiler: clang
    #  env:
    #    - *linux-huge
    #    - *coverage
    #  after_success: *eval-coverage
    #- <<: *linux
    #  name: huge+coverage/gcc
    #  compiler: gcc
    #  env:
    #    - *linux-huge
    #    - *coverage
    #  after_success: *eval-coverage
    #- <<: *linux # ASAN
    #  name: huge+asan/clang
    #  compiler: clang-11
    #  addons:
    #    apt:
    #      sources:
    #        - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
    #          key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
    #      packages:
    #        - *apt-packages
    #        - clang-11
    #  env:
    #    - *linux-huge
    #    - *asan
    #  after_failure: *asan_symbolize
    #- <<: *linux
    #  name: huge-testgui+coverage/gcc
    #  compiler: gcc
    #  env:
    #    - *linux-huge
    #    - *coverage
    #    - TEST="-C src testgui"
    #  after_success: *eval-coverage
    #- <<: *linux
    #  name: unittests+coverage/gcc
    #  compiler: gcc
    #  env:
    #    - *unittests
    #    - *coverage
    #  after_success: *eval-coverage
    #- <<: *linux
    #  name: vimtags/gcc
    #  compiler: gcc
    #  env:
    #    - *normal
    #    - TEST="-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"

# vim:set sts=2 sw=2 tw=0 et: