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