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