blob: 9127455bc1120fa317f467265cb27ef3248daee5 [file] [log] [blame]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +01001name: GitHub CI
2
Bram Moolenaarb5b77372020-12-18 13:31:31 +01003on:
4 push:
5 branches: ['**']
6 pull_request:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +01007
8jobs:
9 linux:
Bram Moolenaar0fa09672021-02-13 17:08:33 +010010 runs-on: ubuntu-18.04
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010011
12 env:
13 CC: ${{ matrix.compiler }}
14 TEST: test
15 SRCDIR: ./src
16 LEAK_CFLAGS: -DEXITFREE
17 LOG_DIR: ${{ github.workspace }}/logs
18 TERM: xterm
19 DISPLAY: ':99'
Bram Moolenaar9aff9702020-12-21 13:37:28 +010020 DEBIAN_FRONTEND: noninteractive
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010021
22 strategy:
23 fail-fast: false
24 matrix:
25 features: [tiny, small, normal, huge]
26 compiler: [clang, gcc]
27 extra: [none]
28 include:
29 - features: tiny
30 compiler: clang
31 extra: nogui
32 - features: tiny
33 compiler: gcc
34 extra: nogui
35 - features: normal
36 shadow: ./src/shadow
37 - features: huge
38 coverage: true
39 - features: huge
40 compiler: gcc
41 coverage: true
42 extra: testgui
43 - features: huge
44 compiler: clang
45 extra: asan
46 - features: huge
47 compiler: gcc
48 coverage: true
49 extra: unittests
50 - features: normal
51 compiler: gcc
52 extra: vimtags
53
54 steps:
55 - uses: actions/checkout@v2
56
57 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010058 run: |
59 sudo apt-get install -y \
60 autoconf \
61 lcov \
62 gettext \
63 libcanberra-dev \
64 libperl-dev \
65 python-dev \
66 python3-dev \
67 liblua5.3-dev \
68 lua5.3 \
69 ruby-dev \
70 tcl-dev \
71 cscope \
72 libgtk2.0-dev \
73 desktop-file-utils \
74 libtool-bin
Bram Moolenaar9aff9702020-12-21 13:37:28 +010075
76 - name: Install clang-11
77 if: matrix.compiler == 'clang'
78 run: |
79 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
80 . /etc/lsb-release
81 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-11 main"
82 sudo apt-get install -y clang-11
83 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100
84 sudo update-alternatives --set clang /usr/bin/clang-11
85 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-11 100
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010086
87 - name: Set up environment
88 run: |
89 mkdir -p "${LOG_DIR}"
90 mkdir -p "${HOME}/bin"
91 echo "${HOME}/bin" >> $GITHUB_PATH
92 (
93 echo "LINUX_VERSION=$(uname -r)"
94 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
95 echo "SND_DUMMY_DIR=${HOME}/snd-dummy"
96 echo "TMPDIR=${{ runner.temp }}"
97
98 case "${{ matrix.features }}" in
99 tiny|small)
100 echo "TEST=testtiny"
101 if ${{ contains(matrix.extra, 'nogui') }}; then
102 echo "CONFOPT=--disable-gui"
103 fi
104 ;;
105 normal)
106 ;;
107 huge)
108 echo "TEST=scripttests test_libvterm"
109 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
110 ;;
111 esac
112
113 if ${{ matrix.coverage == true }}; then
114 echo "CFLAGS=--coverage -DUSE_GCOV_FLUSH"
115 echo "LDFLAGS=--coverage"
116 fi
117 if ${{ contains(matrix.extra, 'testgui') }}; then
118 echo "TEST=-C src testgui"
119 fi
120 if ${{ contains(matrix.extra, 'unittests') }}; then
121 echo "TEST=unittests"
122 fi
123 if ${{ contains(matrix.extra, 'asan') }}; then
124 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
125 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
126 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
127 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
128 fi
129 if ${{ contains(matrix.extra, 'vimtags') }}; then
130 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
131 fi
132 ) >> $GITHUB_ENV
133
134 - name: Set up system
135 run: |
136 if [[ ${CC} = clang ]]; then
137 # Use llvm-cov instead of gcov when compiler is clang.
138 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
139 fi
140 # Setup lua5.3 manually since its package doesn't provide alternative.
141 # https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
142 if [[ ${CONFOPT} =~ luainterp ]]; then
143 sudo update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 10
144 fi
145 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
146 sudo usermod -a -G audio "${USER}"
147 sudo bash ci/setup-xvfb.sh
148
149 - name: Cache snd-dummy
150 uses: actions/cache@v2
151 with:
152 path: ${{ env.SND_DUMMY_DIR }}
153 key: linux-${{ env.LINUX_VERSION }}-snd-dummy
154
155 - name: Set up snd-dummy
156 run: |
157 if [[ ! -e ${SND_DUMMY_DIR}/snd-dummy.ko ]]; then
158 bash ci/build-snd-dummy.sh
159 fi
160 cd "${SND_DUMMY_DIR}"
161 sudo insmod soundcore.ko
162 sudo insmod snd.ko
163 sudo insmod snd-pcm.ko
164 sudo insmod snd-dummy.ko
165
166 - name: Check autoconf
167 if: contains(matrix.extra, 'unittests')
168 run: |
169 make -C src autoconf
170
171 - name: Set up shadow dir
172 if: matrix.shadow
173 run: |
174 make -C src shadow
175 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
176 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
177
178 - name: Configure
179 run: |
180 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
181 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100182 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
183 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100184
185 - name: Build
186 if: (!contains(matrix.extra, 'unittests'))
187 run: |
188 make ${SHADOWOPT} -j${NPROC}
189
190 - name: Check version
191 if: (!contains(matrix.extra, 'unittests'))
192 run: |
193 "${SRCDIR}"/vim --version
194 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
195 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
196
197 - name: Test
198 timeout-minutes: 20
199 run: |
200 do_test() { sg audio "sg $(id -gn) '$*'"; }
201 do_test make ${SHADOWOPT} ${TEST}
202
203 - name: Coveralls
Bram Moolenaarb5b77372020-12-18 13:31:31 +0100204 if: matrix.coverage && success() && github.event_name != 'pull_request'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100205 env:
206 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
207 COVERALLS_PARALLEL: true
208 TRAVIS_JOB_ID: ${{ github.run_id }}
209 run: |
Bram Moolenaar0fa09672021-02-13 17:08:33 +0100210 sudo apt-get install -y python3-setuptools python3-wheel
211 sudo -H pip3 install pip -U
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100212 # needed for https support for coveralls building cffi only works with gcc, not with clang
213 CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
214 ~/.local/bin/coveralls -b "${SRCDIR}" -x .xs -e "${SRCDIR}"/if_perl.c -e "${SRCDIR}"/xxd -e "${SRCDIR}"/libvterm --encodings utf-8
215
216 - name: Codecov
217 if: matrix.coverage && success()
Bram Moolenaare5492602020-12-22 19:05:33 +0100218 run: |
219 cd "${SRCDIR}"
220 bash <(curl -s https://codecov.io/bash) -F "${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100221
222 - name: ASan logs
223 if: contains(matrix.extra, 'asan') && !cancelled()
224 run: |
225 for f in $(grep -lR '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "${LOG_DIR}"); do
226 asan_symbolize-11 -l "$f"
227 false # in order to fail a job
228 done
229
230 coveralls:
Bram Moolenaar0fa09672021-02-13 17:08:33 +0100231 runs-on: ubuntu-18.04
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100232
233 needs: linux
Bram Moolenaar6e562fc2020-12-18 16:29:25 +0100234 if: always() && github.event_name != 'pull_request'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100235
236 steps:
237 - name: Parallel finished
238 env:
239 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
240 run: |
241 curl -k "https://coveralls.io/webhook?repo_token=${COVERALLS_REPO_TOKEN}" -d "payload[build_num]=${GITHUB_RUN_ID}&payload[status]=done"
242
243 macos:
244 runs-on: macos-latest
245
246 env:
247 CC: ${{ matrix.compiler }}
248 TEST: test
249 SRCDIR: ./src
250 LEAK_CFLAGS: -DEXITFREE
251 TERM: xterm
252
253 strategy:
254 fail-fast: false
255 matrix:
256 features: [tiny, huge]
257 compiler: [clang, gcc]
258
259 steps:
260 - uses: actions/checkout@v2
261
262 - name: Install packages
263 env:
264 HOMEBREW_NO_AUTO_UPDATE: 1
265 run: |
266 brew install lua
267 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
268
269 - name: Set up environment
270 run: |
271 (
272 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
273 case "${{ matrix.features }}" in
274 tiny)
275 echo "TEST=testtiny"
276 echo "CONFOPT=--disable-gui"
277 ;;
278 huge)
279 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
280 ;;
281 esac
282 ) >> $GITHUB_ENV
283
284 - name: Configure
285 run: |
286 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
287 # Append various warning flags to CFLAGS.
288 # BSD sed needs backup extension specified.
289 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
290 # On macOS, the entity of gcc is clang.
291 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
292
293 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100294 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100295 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100296 run: |
297 make -j${NPROC}
298
299 - name: Check version
300 run: |
301 "${SRCDIR}"/vim --version
302 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
303 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
304
305 - name: Test
306 timeout-minutes: 20
307 run: |
308 make ${TEST}
309
310 windows:
311 runs-on: windows-latest
312
313 env:
314 VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
315 # Interfaces
316 # Lua
317 LUA_VER: 54
318 LUA_VER_DOT: '5.4'
319 LUA_RELEASE: 5.4.0
320 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
321 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
322 LUA_DIR: D:\Lua
323 # Python 2
324 PYTHON_VER: 27
325 PYTHON_VER_DOT: '2.7'
326 # Python 3
327 PYTHON3_VER: 38
328 PYTHON3_VER_DOT: '3.8'
329 # Other dependencies
330 # winpty
331 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
332 # Escape sequences
333 COL_RED: "\x1b[31m"
334 COL_GREEN: "\x1b[32m"
335 COL_YELLOW: "\x1b[33m"
336 COL_RESET: "\x1b[m"
337
338 strategy:
339 fail-fast: false
340 matrix:
341 toolchain: [msvc, mingw]
342 arch: [x64, x86]
343 features: [HUGE, NORMAL]
344 include:
345 - arch: x64
346 vcarch: amd64
347 warch: x64
348 bits: 64
349 msystem: MINGW64
350 cygreg: registry
351 pyreg: ""
352 - arch: x86
353 vcarch: x86
354 warch: ia32
355 bits: 32
356 msystem: MINGW32
357 cygreg: registry32
358 pyreg: "-32"
359 exclude:
360 - toolchain: msvc
361 arch: x64
362 features: NORMAL
363 - toolchain: mingw
364 arch: x86
365 features: NORMAL
366
367 steps:
368 - name: Initalize
369 id: init
370 shell: bash
371 run: |
372 git config --global core.autocrlf input
373 python_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON_VER_DOT}/InstallPath/@")
374 python3_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}${{ matrix.pyreg }}/InstallPath/@")
375 echo "PYTHON_DIR=$python_dir" >> $GITHUB_ENV
376 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
377
378 - uses: msys2/setup-msys2@v2
379 if: matrix.toolchain == 'mingw'
380 with:
381 msystem: ${{ matrix.msystem }}
382 release: false
383
384 - uses: actions/checkout@v2
385
386 - name: Create a list of download URLs
387 shell: cmd
388 run: |
389 type NUL > urls.txt
390 echo %LUA_RELEASE%>> urls.txt
391 echo %WINPTY_URL%>> urls.txt
392
393 - name: Cache downloaded files
394 uses: actions/cache@v2
395 with:
396 path: downloads
397 key: ${{ runner.os }}-${{ matrix.bits }}-${{ hashFiles('urls.txt') }}
398
399 - name: Download dependencies
400 shell: cmd
401 run: |
402 path C:\Program Files\7-Zip;%path%
403 if not exist downloads mkdir downloads
404
405 echo %COL_GREEN%Download Lua%COL_RESET%
406 call :downloadfile %LUA${{ matrix.bits }}_URL% downloads\lua.zip
407 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
408
409 echo %COL_GREEN%Download winpty%COL_RESET%
410 call :downloadfile %WINPTY_URL% downloads\winpty.zip
411 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
412 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty.dll src\winpty${{ matrix.bits }}.dll
413 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty-agent.exe src\
414
415 goto :eof
416
417 :downloadfile
418 :: call :downloadfile <URL> <localfile>
419 if not exist %2 (
420 curl -f -L %1 -o %2
421 )
422 if ERRORLEVEL 1 (
423 rem Retry once.
424 curl -f -L %1 -o %2 || exit 1
425 )
426 goto :eof
427
428 - name: Copy src directory to src2
429 shell: cmd
430 run: |
431 xcopy src src2\ /E > nul
432
433 - name: Build (MSVC)
434 if: matrix.toolchain == 'msvc'
435 shell: cmd
436 run: |
437 call "%VCVARSALL%" ${{ matrix.vcarch }}
438 cd src
439 :: Filter out the progress bar from the build log
440 sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak
441 if "${{ matrix.features }}"=="HUGE" (
442 nmake -nologo -f Make_mvc2.mak ^
443 FEATURES=${{ matrix.features }} ^
444 GUI=yes IME=yes ICONV=yes VIMDLL=yes ^
445 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
446 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
447 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
448 ) else (
449 nmake -nologo -f Make_mvc2.mak ^
450 FEATURES=${{ matrix.features }} ^
451 GUI=yes IME=yes ICONV=yes VIMDLL=yes
452 )
453 if not exist vim${{ matrix.bits }}.dll (
454 echo %COL_RED%Build failure.%COL_RESET%
455 exit 1
456 )
457
458 - name: Build (MinGW)
459 if: matrix.toolchain == 'mingw'
460 shell: msys2 {0}
461 run: |
462 cd src
463 if [ "${{ matrix.features }}" = "HUGE" ]; then
464 mingw32-make -f Make_ming.mak -j2 \
465 FEATURES=${{ matrix.features }} \
466 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
467 DYNAMIC_LUA=yes LUA=${LUA_DIR} \
468 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
469 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
470 STATIC_STDCPLUS=yes
471 else
472 mingw32-make -f Make_ming.mak -j2 \
473 FEATURES=${{ matrix.features }} \
474 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
475 STATIC_STDCPLUS=yes
476 fi
477
478 #- name: Prepare Artifact
479 # shell: cmd
480 # run: |
481 # mkdir artifacts
482 # copy src\*vim.exe artifacts
483 # copy src\vim*.dll artifacts
484 #
485 #- name: Upload Artifact
486 # uses: actions/upload-artifact@v1
487 # with:
488 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
489 # path: ./artifacts
490
491 - name: Test
492 shell: cmd
493 timeout-minutes: 20
494 run: |
495 PATH %LUA_DIR%;C:\msys64\${{ matrix.msystem }}\bin;%PATH%;%PYTHON3_DIR%
496 call "%VCVARSALL%" ${{ matrix.vcarch }}
497 cd src
498 echo.
499 echo %COL_GREEN%vim version:%COL_RESET%
500 .\vim --version || exit 1
501
502 echo %COL_GREEN%Start testing vim in background.%COL_RESET%
503 start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt"
504
505 echo %COL_GREEN%Test gvim:%COL_RESET%
506 cd testdir
507 nmake -nologo -f Make_dos.mak VIMPROG=..\gvim || exit 1
508 cd ..
509
510 echo %COL_GREEN%Wait for vim tests to finish.%COL_RESET%
511 cd ..\src2\testdir
512 :: Wait about 10 minutes.
513 for /L %%i in (1,1,60) do (
514 if exist done.txt goto exitloop
515 timeout 10 > NUL 2>&1
516 if ERRORLEVEL 1 ping -n 11 localhost > NUL
517 )
518 set timeout=1
519 :exitloop
520
521 echo %COL_GREEN%Test results of vim:%COL_RESET%
522 if exist messages type messages
523 nmake -nologo -f Make_dos.mak report VIMPROG=..\..\src\vim || exit 1
524 if "%timeout%"=="1" (
525 echo %COL_RED%Timed out.%COL_RESET%
526 exit 1
527 )