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