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