blob: 2a1a218bb45e8ea94c7dc4bb8d369e053e663161 [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 Moolenaarb5b77372020-12-18 13:31:31 +0100217 uses: codecov/codecov-action@v1
218 with:
219 flags: ${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
220 fail_ci_if_error: true
221 working-directory: ${{ env.SRCDIR }}
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:
232 runs-on: ubuntu-latest
233
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:
296 LANG: 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:
369 - name: Initalize
370 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 )