blob: 19952df178168be66a54769c92ddf3c9b22e619a [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
ichizokdee78e12021-12-09 21:08:01 +000078 - name: Install clang-13
Bram Moolenaar9aff9702020-12-21 13:37:28 +010079 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
ichizokdee78e12021-12-09 21:08:01 +000083 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-13 main"
84 sudo apt-get install -y clang-13 llvm-13
85 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-13 100
86 sudo update-alternatives --set clang /usr/bin/clang-13
87 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-13 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
ichizokdee78e12021-12-09 21:08:01 +0000191 if [[ ${CC} = clang ]]; then
192 # Suppress some warnings produced by clang 12 and later.
193 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
194 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100195
196 - name: Build
197 if: (!contains(matrix.extra, 'unittests'))
198 run: |
199 make ${SHADOWOPT} -j${NPROC}
200
201 - name: Check version
202 if: (!contains(matrix.extra, 'unittests'))
203 run: |
204 "${SRCDIR}"/vim --version
205 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
206 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
207
208 - name: Test
209 timeout-minutes: 20
210 run: |
211 do_test() { sg audio "sg $(id -gn) '$*'"; }
212 do_test make ${SHADOWOPT} ${TEST}
213
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200214 # - name: Coveralls
215 # if: matrix.coverage && success() && github.event_name != 'pull_request'
216 # env:
217 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
218 # COVERALLS_PARALLEL: true
219 # TRAVIS_JOB_ID: ${{ github.run_id }}
220 # run: |
221 # sudo apt-get install -y python3-setuptools python3-wheel
222 # sudo -H pip3 install pip -U
223 # # needed for https support for coveralls building cffi only works with gcc, not with clang
224 # CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
225 # ~/.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 +0100226
227 - name: Codecov
228 if: matrix.coverage && success()
Bram Moolenaare5492602020-12-22 19:05:33 +0100229 run: |
230 cd "${SRCDIR}"
231 bash <(curl -s https://codecov.io/bash) -F "${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100232
233 - name: ASan logs
234 if: contains(matrix.extra, 'asan') && !cancelled()
235 run: |
236 for f in $(grep -lR '#[[:digit:]]* *0x[[:digit:]a-fA-F]*' "${LOG_DIR}"); do
237 asan_symbolize-11 -l "$f"
238 false # in order to fail a job
239 done
240
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200241 # coveralls:
242 # runs-on: ubuntu-18.04
243 #
244 # needs: linux
245 # if: always() && github.event_name != 'pull_request'
246 #
247 # steps:
248 # - name: Parallel finished
249 # env:
250 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
251 # run: |
252 # 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 +0100253
254 macos:
255 runs-on: macos-latest
256
257 env:
258 CC: ${{ matrix.compiler }}
259 TEST: test
260 SRCDIR: ./src
261 LEAK_CFLAGS: -DEXITFREE
262 TERM: xterm
263
264 strategy:
265 fail-fast: false
266 matrix:
267 features: [tiny, huge]
268 compiler: [clang, gcc]
269
270 steps:
271 - uses: actions/checkout@v2
272
273 - name: Install packages
274 env:
275 HOMEBREW_NO_AUTO_UPDATE: 1
276 run: |
277 brew install lua
278 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
279
280 - name: Set up environment
281 run: |
282 (
283 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
284 case "${{ matrix.features }}" in
285 tiny)
286 echo "TEST=testtiny"
287 echo "CONFOPT=--disable-gui"
288 ;;
289 huge)
290 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
291 ;;
292 esac
293 ) >> $GITHUB_ENV
294
295 - name: Configure
296 run: |
297 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
298 # Append various warning flags to CFLAGS.
299 # BSD sed needs backup extension specified.
300 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
301 # On macOS, the entity of gcc is clang.
302 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000303 # Suppress some warnings produced by clang 12 and later.
304 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
305 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
306 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100307
308 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100309 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100310 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100311 run: |
312 make -j${NPROC}
313
314 - name: Check version
315 run: |
316 "${SRCDIR}"/vim --version
317 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
318 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
319
320 - name: Test
321 timeout-minutes: 20
322 run: |
323 make ${TEST}
324
325 windows:
326 runs-on: windows-latest
327
328 env:
329 VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
330 # Interfaces
331 # Lua
332 LUA_VER: 54
333 LUA_VER_DOT: '5.4'
334 LUA_RELEASE: 5.4.0
335 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
336 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
337 LUA_DIR: D:\Lua
338 # Python 2
339 PYTHON_VER: 27
340 PYTHON_VER_DOT: '2.7'
341 # Python 3
342 PYTHON3_VER: 38
343 PYTHON3_VER_DOT: '3.8'
344 # Other dependencies
345 # winpty
346 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
347 # Escape sequences
348 COL_RED: "\x1b[31m"
349 COL_GREEN: "\x1b[32m"
350 COL_YELLOW: "\x1b[33m"
351 COL_RESET: "\x1b[m"
352
353 strategy:
354 fail-fast: false
355 matrix:
356 toolchain: [msvc, mingw]
357 arch: [x64, x86]
358 features: [HUGE, NORMAL]
359 include:
360 - arch: x64
361 vcarch: amd64
362 warch: x64
363 bits: 64
364 msystem: MINGW64
365 cygreg: registry
366 pyreg: ""
367 - arch: x86
368 vcarch: x86
369 warch: ia32
370 bits: 32
371 msystem: MINGW32
372 cygreg: registry32
373 pyreg: "-32"
374 exclude:
375 - toolchain: msvc
376 arch: x64
377 features: NORMAL
378 - toolchain: mingw
379 arch: x86
380 features: NORMAL
381
382 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200383 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100384 id: init
385 shell: bash
386 run: |
387 git config --global core.autocrlf input
388 python_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON_VER_DOT}/InstallPath/@")
389 python3_dir=$(cat "/proc/${{ matrix.cygreg }}/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}${{ matrix.pyreg }}/InstallPath/@")
390 echo "PYTHON_DIR=$python_dir" >> $GITHUB_ENV
391 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
392
393 - uses: msys2/setup-msys2@v2
394 if: matrix.toolchain == 'mingw'
395 with:
396 msystem: ${{ matrix.msystem }}
397 release: false
398
399 - uses: actions/checkout@v2
400
401 - name: Create a list of download URLs
402 shell: cmd
403 run: |
404 type NUL > urls.txt
405 echo %LUA_RELEASE%>> urls.txt
406 echo %WINPTY_URL%>> urls.txt
407
408 - name: Cache downloaded files
409 uses: actions/cache@v2
410 with:
411 path: downloads
412 key: ${{ runner.os }}-${{ matrix.bits }}-${{ hashFiles('urls.txt') }}
413
414 - name: Download dependencies
415 shell: cmd
416 run: |
417 path C:\Program Files\7-Zip;%path%
418 if not exist downloads mkdir downloads
419
420 echo %COL_GREEN%Download Lua%COL_RESET%
421 call :downloadfile %LUA${{ matrix.bits }}_URL% downloads\lua.zip
422 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
423
424 echo %COL_GREEN%Download winpty%COL_RESET%
425 call :downloadfile %WINPTY_URL% downloads\winpty.zip
426 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
427 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty.dll src\winpty${{ matrix.bits }}.dll
428 copy /Y D:\winpty\${{ matrix.warch }}\bin\winpty-agent.exe src\
429
430 goto :eof
431
432 :downloadfile
433 :: call :downloadfile <URL> <localfile>
434 if not exist %2 (
435 curl -f -L %1 -o %2
436 )
437 if ERRORLEVEL 1 (
438 rem Retry once.
439 curl -f -L %1 -o %2 || exit 1
440 )
441 goto :eof
442
443 - name: Copy src directory to src2
444 shell: cmd
445 run: |
446 xcopy src src2\ /E > nul
447
448 - name: Build (MSVC)
449 if: matrix.toolchain == 'msvc'
450 shell: cmd
451 run: |
452 call "%VCVARSALL%" ${{ matrix.vcarch }}
453 cd src
454 :: Filter out the progress bar from the build log
455 sed -e "s/@<<$/@<< | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak
456 if "${{ matrix.features }}"=="HUGE" (
457 nmake -nologo -f Make_mvc2.mak ^
458 FEATURES=${{ matrix.features }} ^
459 GUI=yes IME=yes ICONV=yes VIMDLL=yes ^
460 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
461 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
462 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
463 ) else (
464 nmake -nologo -f Make_mvc2.mak ^
465 FEATURES=${{ matrix.features }} ^
466 GUI=yes IME=yes ICONV=yes VIMDLL=yes
467 )
468 if not exist vim${{ matrix.bits }}.dll (
469 echo %COL_RED%Build failure.%COL_RESET%
470 exit 1
471 )
472
473 - name: Build (MinGW)
474 if: matrix.toolchain == 'mingw'
475 shell: msys2 {0}
476 run: |
477 cd src
478 if [ "${{ matrix.features }}" = "HUGE" ]; then
479 mingw32-make -f Make_ming.mak -j2 \
480 FEATURES=${{ matrix.features }} \
481 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
482 DYNAMIC_LUA=yes LUA=${LUA_DIR} \
483 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
484 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
485 STATIC_STDCPLUS=yes
486 else
487 mingw32-make -f Make_ming.mak -j2 \
488 FEATURES=${{ matrix.features }} \
489 GUI=yes IME=yes ICONV=yes VIMDLL=yes \
490 STATIC_STDCPLUS=yes
491 fi
492
493 #- name: Prepare Artifact
494 # shell: cmd
495 # run: |
496 # mkdir artifacts
497 # copy src\*vim.exe artifacts
498 # copy src\vim*.dll artifacts
499 #
500 #- name: Upload Artifact
501 # uses: actions/upload-artifact@v1
502 # with:
503 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
504 # path: ./artifacts
505
506 - name: Test
507 shell: cmd
508 timeout-minutes: 20
509 run: |
510 PATH %LUA_DIR%;C:\msys64\${{ matrix.msystem }}\bin;%PATH%;%PYTHON3_DIR%
511 call "%VCVARSALL%" ${{ matrix.vcarch }}
512 cd src
513 echo.
514 echo %COL_GREEN%vim version:%COL_RESET%
515 .\vim --version || exit 1
516
517 echo %COL_GREEN%Start testing vim in background.%COL_RESET%
518 start cmd /c "cd ..\src2\testdir & nmake -nologo -f Make_dos.mak VIMPROG=..\..\src\vim > nul & echo done>done.txt"
519
520 echo %COL_GREEN%Test gvim:%COL_RESET%
521 cd testdir
522 nmake -nologo -f Make_dos.mak VIMPROG=..\gvim || exit 1
523 cd ..
524
525 echo %COL_GREEN%Wait for vim tests to finish.%COL_RESET%
526 cd ..\src2\testdir
527 :: Wait about 10 minutes.
528 for /L %%i in (1,1,60) do (
529 if exist done.txt goto exitloop
530 timeout 10 > NUL 2>&1
531 if ERRORLEVEL 1 ping -n 11 localhost > NUL
532 )
533 set timeout=1
534 :exitloop
535
536 echo %COL_GREEN%Test results of vim:%COL_RESET%
537 if exist messages type messages
538 nmake -nologo -f Make_dos.mak report VIMPROG=..\..\src\vim || exit 1
539 if "%timeout%"=="1" (
540 echo %COL_RED%Timed out.%COL_RESET%
541 exit 1
542 )