blob: c9889498e18cc62e6e7c9fa106bbe3e7f3ad6360 [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
Yegappan Lakshmanan7f4a6282021-12-25 11:20:30 +00008# Cancels all previous workflow runs for pull requests that have not completed.
9concurrency:
10 # The concurrency group contains the workflow name and the branch name for
11 # pull requests or the commit hash for any other events.
12 group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
13 cancel-in-progress: true
14
Alex311df6b2022-09-26 15:52:46 +010015permissions:
16 contents: read # to fetch code (actions/checkout)
17
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010018jobs:
19 linux:
Philip Hb2137032022-08-25 15:21:24 +010020 runs-on: ubuntu-20.04
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010021
22 env:
23 CC: ${{ matrix.compiler }}
24 TEST: test
25 SRCDIR: ./src
26 LEAK_CFLAGS: -DEXITFREE
Philip H533c3062022-08-28 19:41:36 +010027 CFLAGS: -Wno-deprecated-declarations
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010028 LOG_DIR: ${{ github.workspace }}/logs
29 TERM: xterm
30 DISPLAY: ':99'
Bram Moolenaar9aff9702020-12-21 13:37:28 +010031 DEBIAN_FRONTEND: noninteractive
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010032
33 strategy:
34 fail-fast: false
35 matrix:
36 features: [tiny, small, normal, huge]
37 compiler: [clang, gcc]
38 extra: [none]
39 include:
40 - features: tiny
41 compiler: clang
42 extra: nogui
43 - features: tiny
44 compiler: gcc
45 extra: nogui
46 - features: normal
47 shadow: ./src/shadow
48 - features: huge
49 coverage: true
50 - features: huge
51 compiler: gcc
52 coverage: true
53 extra: testgui
James McCoy2e258bd2021-10-05 19:44:04 +010054 uchar: true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010055 - features: huge
56 compiler: clang
57 extra: asan
58 - features: huge
59 compiler: gcc
60 coverage: true
61 extra: unittests
62 - features: normal
63 compiler: gcc
64 extra: vimtags
65
66 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010067 - name: Checkout repository from github
68 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010069
70 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010071 run: |
ichizok10504762022-01-15 13:37:14 +000072 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010073 gettext \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010074 libgtk2.0-dev \
75 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020076 libtool-bin \
ichizok10504762022-01-15 13:37:14 +000077 )
78 if ${{ matrix.features == 'huge' }}; then
79 PKGS+=( \
80 autoconf \
81 lcov \
82 libcanberra-dev \
83 libperl-dev \
84 python-dev \
85 python3-dev \
86 liblua5.3-dev \
87 lua5.3 \
88 ruby-dev \
89 tcl-dev \
90 cscope \
91 libsodium-dev \
92 )
93 fi
94 sudo apt update && sudo apt install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +010095
Philip Hd2edee52022-04-16 20:04:30 +010096 - name: Install gcc-11
97 if: matrix.compiler == 'gcc'
98 run: |
99 sudo add-apt-repository ppa:ubuntu-toolchain-r/test
100 sudo apt install -y gcc-11
101 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
102 sudo update-alternatives --set gcc /usr/bin/gcc-11
103
Philip Hbd01f472022-09-07 13:30:19 +0100104 - name: Install clang-15
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100105 if: matrix.compiler == 'clang'
106 run: |
107 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
108 . /etc/lsb-release
Philip Hbd01f472022-09-07 13:30:19 +0100109 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-15 main"
110 sudo apt install -y clang-15 llvm-15
111 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
112 sudo update-alternatives --set clang /usr/bin/clang-15
113 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-15 100
114 sudo update-alternatives --install /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-15 100
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100115
116 - name: Set up environment
117 run: |
118 mkdir -p "${LOG_DIR}"
119 mkdir -p "${HOME}/bin"
120 echo "${HOME}/bin" >> $GITHUB_PATH
121 (
122 echo "LINUX_VERSION=$(uname -r)"
123 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
124 echo "SND_DUMMY_DIR=${HOME}/snd-dummy"
125 echo "TMPDIR=${{ runner.temp }}"
126
127 case "${{ matrix.features }}" in
128 tiny|small)
129 echo "TEST=testtiny"
130 if ${{ contains(matrix.extra, 'nogui') }}; then
131 echo "CONFOPT=--disable-gui"
132 fi
133 ;;
134 normal)
135 ;;
136 huge)
137 echo "TEST=scripttests test_libvterm"
138 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
139 ;;
140 esac
141
142 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100143 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100144 echo "LDFLAGS=--coverage"
145 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100146 if ${{ matrix.uchar == true }}; then
147 CFLAGS="$CFLAGS -funsigned-char"
148 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100149 if ${{ contains(matrix.extra, 'testgui') }}; then
150 echo "TEST=-C src testgui"
151 fi
152 if ${{ contains(matrix.extra, 'unittests') }}; then
153 echo "TEST=unittests"
154 fi
155 if ${{ contains(matrix.extra, 'asan') }}; then
156 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
157 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
158 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
159 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
160 fi
161 if ${{ contains(matrix.extra, 'vimtags') }}; then
162 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
163 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100164 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100165 ) >> $GITHUB_ENV
166
167 - name: Set up system
168 run: |
169 if [[ ${CC} = clang ]]; then
170 # Use llvm-cov instead of gcov when compiler is clang.
171 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
172 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100173 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
174 sudo usermod -a -G audio "${USER}"
175 sudo bash ci/setup-xvfb.sh
176
177 - name: Cache snd-dummy
Philip H2ff7e7e2022-06-17 21:27:38 +0100178 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100179 with:
180 path: ${{ env.SND_DUMMY_DIR }}
181 key: linux-${{ env.LINUX_VERSION }}-snd-dummy
182
183 - name: Set up snd-dummy
184 run: |
185 if [[ ! -e ${SND_DUMMY_DIR}/snd-dummy.ko ]]; then
186 bash ci/build-snd-dummy.sh
187 fi
188 cd "${SND_DUMMY_DIR}"
189 sudo insmod soundcore.ko
190 sudo insmod snd.ko
191 sudo insmod snd-pcm.ko
192 sudo insmod snd-dummy.ko
193
194 - name: Check autoconf
195 if: contains(matrix.extra, 'unittests')
196 run: |
197 make -C src autoconf
198
199 - name: Set up shadow dir
200 if: matrix.shadow
201 run: |
202 make -C src shadow
203 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
204 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
205
206 - name: Configure
207 run: |
208 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
209 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100210 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
211 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000212 if [[ ${CC} = clang ]]; then
213 # Suppress some warnings produced by clang 12 and later.
214 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
215 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100216
217 - name: Build
218 if: (!contains(matrix.extra, 'unittests'))
219 run: |
220 make ${SHADOWOPT} -j${NPROC}
221
222 - name: Check version
223 if: (!contains(matrix.extra, 'unittests'))
224 run: |
225 "${SRCDIR}"/vim --version
226 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
227 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
228
229 - name: Test
230 timeout-minutes: 20
231 run: |
232 do_test() { sg audio "sg $(id -gn) '$*'"; }
233 do_test make ${SHADOWOPT} ${TEST}
234
ichizok0d47ad42022-01-11 13:05:26 +0000235 # - name: Coveralls
ichizok41ee5b12022-02-12 10:13:13 +0000236 # if: matrix.coverage && github.event_name != 'pull_request'
ichizok0d47ad42022-01-11 13:05:26 +0000237 # env:
238 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
239 # COVERALLS_PARALLEL: true
240 # TRAVIS_JOB_ID: ${{ github.run_id }}
241 # run: |
242 # sudo apt-get install -y python3-setuptools python3-wheel
243 # sudo -H pip3 install pip -U
244 # # needed for https support for coveralls building cffi only works with gcc, not with clang
245 # CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
246 # ~/.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 +0100247
ichizok0d47ad42022-01-11 13:05:26 +0000248 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000249 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100250 run: |
251 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000252 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
253
254 - name: Codecov
ichizok41ee5b12022-02-12 10:13:13 +0000255 if: matrix.coverage
Philip H6a434e92022-09-21 19:41:54 +0100256 uses: codecov/codecov-action@v3.1.1
ichizok0d47ad42022-01-11 13:05:26 +0000257 with:
ichizok41ee5b12022-02-12 10:13:13 +0000258 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100259
260 - name: ASan logs
261 if: contains(matrix.extra, 'asan') && !cancelled()
262 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000263 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000264 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100265 false # in order to fail a job
266 done
267
ichizok0d47ad42022-01-11 13:05:26 +0000268 # coveralls:
Philip Hb2137032022-08-25 15:21:24 +0100269 # runs-on: ubuntu-20.04
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200270 #
ichizok0d47ad42022-01-11 13:05:26 +0000271 # needs: linux
272 # if: always() && github.event_name != 'pull_request'
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200273 #
ichizok0d47ad42022-01-11 13:05:26 +0000274 # steps:
275 # - name: Parallel finished
276 # env:
277 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
278 # run: |
279 # 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 +0100280
281 macos:
282 runs-on: macos-latest
283
284 env:
ichizok48c01962021-12-11 17:34:19 +0000285 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100286 TEST: test
287 SRCDIR: ./src
288 LEAK_CFLAGS: -DEXITFREE
289 TERM: xterm
290
291 strategy:
292 fail-fast: false
293 matrix:
ichizok48c01962021-12-11 17:34:19 +0000294 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100295
296 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100297 - name: Checkout repository from github
298 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100299
300 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000301 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100302 env:
303 HOMEBREW_NO_AUTO_UPDATE: 1
304 run: |
305 brew install lua
306 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
307
308 - name: Set up environment
309 run: |
310 (
311 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
312 case "${{ matrix.features }}" in
313 tiny)
314 echo "TEST=testtiny"
315 echo "CONFOPT=--disable-gui"
316 ;;
ichizok48c01962021-12-11 17:34:19 +0000317 normal)
318 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100319 huge)
320 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
321 ;;
322 esac
323 ) >> $GITHUB_ENV
324
325 - name: Configure
326 run: |
327 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
328 # Append various warning flags to CFLAGS.
329 # BSD sed needs backup extension specified.
330 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
331 # On macOS, the entity of gcc is clang.
332 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000333 # Suppress some warnings produced by clang 12 and later.
334 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
335 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
336 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100337
338 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100339 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100340 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100341 run: |
342 make -j${NPROC}
343
344 - name: Check version
345 run: |
346 "${SRCDIR}"/vim --version
347 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
348 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
349
350 - name: Test
351 timeout-minutes: 20
352 run: |
353 make ${TEST}
354
355 windows:
Philip H361f9d22022-06-14 11:35:21 +0100356 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100357
358 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100359 # Interfaces
360 # Lua
361 LUA_VER: 54
362 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000363 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100364 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
365 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
366 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100367 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
368 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100369 # Python 2
370 PYTHON_VER: 27
371 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100372 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100373 # Python 3
Philip H18f75932022-02-12 10:53:07 +0000374 PYTHON3_VER: 310
375 PYTHON3_VER_DOT: '3.10'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100376 # Other dependencies
377 # winpty
378 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
379 # Escape sequences
380 COL_RED: "\x1b[31m"
381 COL_GREEN: "\x1b[32m"
382 COL_YELLOW: "\x1b[33m"
383 COL_RESET: "\x1b[m"
384
385 strategy:
386 fail-fast: false
387 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100388 include:
K.Takata2da11a42022-09-10 13:03:12 +0100389 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
390 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
391 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
392 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
393 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
394 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
395 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
396 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100397
398 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200399 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100400 id: init
401 shell: bash
402 run: |
403 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100404
405 if [ "${{ matrix.arch }}" = "x64" ]; then
406 cygreg=registry
407 pyreg=
408 echo "VCARCH=amd64" >> $GITHUB_ENV
409 echo "WARCH=x64" >> $GITHUB_ENV
410 echo "BITS=64" >> $GITHUB_ENV
411 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100412 else
K.Takata2da11a42022-09-10 13:03:12 +0100413 cygreg=registry32
414 pyreg=-32
415 echo "VCARCH=x86" >> $GITHUB_ENV
416 echo "WARCH=ia32" >> $GITHUB_ENV
417 echo "BITS=32" >> $GITHUB_ENV
418 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100419 fi
K.Takata2da11a42022-09-10 13:03:12 +0100420
421 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
422 if [ "${{ matrix.features }}" != "TINY" ]; then
423 if [ "${{ matrix.arch }}" = "x86" ]; then
424 choco install python2 --forcex86
425 else
426 choco install python2
427 fi
428 fi
429 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100430 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
431
432 - uses: msys2/setup-msys2@v2
433 if: matrix.toolchain == 'mingw'
434 with:
Philip H361f9d22022-06-14 11:35:21 +0100435 update: true
436 install: tar
437 pacboy: >-
438 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100439 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100440 release: false
441
Philip Hbfaa24f2022-06-01 21:26:34 +0100442 - name: Checkout repository from github
443 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100444
445 - name: Create a list of download URLs
446 shell: cmd
447 run: |
448 type NUL > urls.txt
449 echo %LUA_RELEASE%>> urls.txt
450 echo %WINPTY_URL%>> urls.txt
451
452 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100453 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100454 with:
455 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100456 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100457
458 - name: Download dependencies
459 shell: cmd
460 run: |
461 path C:\Program Files\7-Zip;%path%
462 if not exist downloads mkdir downloads
463
464 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100465 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100466 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
467
468 echo %COL_GREEN%Download winpty%COL_RESET%
469 call :downloadfile %WINPTY_URL% downloads\winpty.zip
470 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100471 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
472 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100473
474 goto :eof
475
476 :downloadfile
477 :: call :downloadfile <URL> <localfile>
478 if not exist %2 (
479 curl -f -L %1 -o %2
480 )
481 if ERRORLEVEL 1 (
482 rem Retry once.
483 curl -f -L %1 -o %2 || exit 1
484 )
485 goto :eof
486
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100487 - name: Build (MSVC)
488 if: matrix.toolchain == 'msvc'
489 shell: cmd
490 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100491 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100492 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100493 if "${{ matrix.VIMDLL }}"=="yes" (
494 set GUI=yes
495 ) else (
496 set GUI=${{ matrix.GUI }}
497 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100498 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000499 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100500 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100501 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100502 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
503 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
504 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
505 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000506 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100507 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100508 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100509 )
510
511 - name: Build (MinGW)
512 if: matrix.toolchain == 'mingw'
513 shell: msys2 {0}
514 run: |
515 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100516 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
517 GUI=yes
518 else
519 GUI=${{ matrix.GUI }}
520 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100521 if [ "${{ matrix.features }}" = "HUGE" ]; then
522 mingw32-make -f Make_ming.mak -j2 \
523 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100524 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100525 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100526 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
527 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000528 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100529 else
530 mingw32-make -f Make_ming.mak -j2 \
531 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100532 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100533 STATIC_STDCPLUS=yes
534 fi
535
ichizok0cd3e942022-02-14 11:36:57 +0000536 - name: Check version
537 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000538 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100539 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
540 if "${{ matrix.GUI }}"=="yes" (
541 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
542 type version.txt
543 echo.
544 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
545 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
546 type version.txt
547 del version.txt
548 ) else (
549 src\vim --version || exit 1
550 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
551 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
552 )
ichizok0cd3e942022-02-14 11:36:57 +0000553
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100554 #- name: Prepare Artifact
555 # shell: cmd
556 # run: |
557 # mkdir artifacts
558 # copy src\*vim.exe artifacts
559 # copy src\vim*.dll artifacts
560 #
561 #- name: Upload Artifact
562 # uses: actions/upload-artifact@v1
563 # with:
564 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
565 # path: ./artifacts
566
ichizok0cd3e942022-02-14 11:36:57 +0000567 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100568 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100569 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100570 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100571 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100572 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
573 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100574
ichizok0cd3e942022-02-14 11:36:57 +0000575 echo %COL_GREEN%Test gVim:%COL_RESET%
576 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100577 if "${{ matrix.GUI }}"=="yes" (
578 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
579 ) else (
580 @rem Run only tiny tests.
581 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100582 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100583
K.Takata2da11a42022-09-10 13:03:12 +0100584 - name: Test and show the result of testing Vim
585 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
586 shell: cmd
587 timeout-minutes: 15
588 run: |
589 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
590 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000591
K.Takata2da11a42022-09-10 13:03:12 +0100592 echo %COL_GREEN%Test Vim:%COL_RESET%
593 cd src\testdir
594 nmake -nologo -f Make_mvc.mak clean
595 if "${{ matrix.GUI }}"=="no" (
596 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
597 ) else (
598 @rem Run only tiny tests.
599 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100600 )
ichizok41ee5b12022-02-12 10:13:13 +0000601
602 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000603 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000604 shell: msys2 {0}
605 run: |
606 cd src
607 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000608
K.Takata2da11a42022-09-10 13:03:12 +0100609 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000610 if: matrix.coverage
Philip Hd3eafdd2022-09-24 13:00:53 +0100611 uses: codecov/codecov-action@v3.1.1
ichizok41ee5b12022-02-12 10:13:13 +0000612 with:
613 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000614 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}