blob: c8c4875f08ccb9d623ae20fdf85c23f9b4ec54d0 [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:
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +010036 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010037 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: |
Philip Hd2edee52022-04-16 20:04:30 +010099 sudo apt install -y gcc-11
100 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
101 sudo update-alternatives --set gcc /usr/bin/gcc-11
102
Philip H43e234e2023-02-06 20:22:48 +0000103 - name: Install clang-16
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100104 if: matrix.compiler == 'clang'
105 run: |
106 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
107 . /etc/lsb-release
Philip H43e234e2023-02-06 20:22:48 +0000108 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-16 main"
109 sudo apt install -y clang-16 llvm-16
110 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100
111 sudo update-alternatives --set clang /usr/bin/clang-16
112 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-16 100
113 sudo update-alternatives --install /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-16 100
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100114
115 - name: Set up environment
116 run: |
117 mkdir -p "${LOG_DIR}"
118 mkdir -p "${HOME}/bin"
119 echo "${HOME}/bin" >> $GITHUB_PATH
120 (
121 echo "LINUX_VERSION=$(uname -r)"
122 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
123 echo "SND_DUMMY_DIR=${HOME}/snd-dummy"
124 echo "TMPDIR=${{ runner.temp }}"
125
126 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100127 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100128 echo "TEST=testtiny"
129 if ${{ contains(matrix.extra, 'nogui') }}; then
130 echo "CONFOPT=--disable-gui"
131 fi
132 ;;
133 normal)
134 ;;
135 huge)
136 echo "TEST=scripttests test_libvterm"
137 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
138 ;;
139 esac
140
141 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100142 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100143 echo "LDFLAGS=--coverage"
144 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100145 if ${{ matrix.uchar == true }}; then
146 CFLAGS="$CFLAGS -funsigned-char"
147 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100148 if ${{ contains(matrix.extra, 'testgui') }}; then
149 echo "TEST=-C src testgui"
150 fi
151 if ${{ contains(matrix.extra, 'unittests') }}; then
152 echo "TEST=unittests"
153 fi
154 if ${{ contains(matrix.extra, 'asan') }}; then
155 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
156 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
157 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
158 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
159 fi
160 if ${{ contains(matrix.extra, 'vimtags') }}; then
161 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
162 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100163 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100164 ) >> $GITHUB_ENV
165
166 - name: Set up system
167 run: |
168 if [[ ${CC} = clang ]]; then
169 # Use llvm-cov instead of gcov when compiler is clang.
170 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
171 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100172 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
173 sudo usermod -a -G audio "${USER}"
174 sudo bash ci/setup-xvfb.sh
175
Philip H1273dfb2022-11-24 15:15:08 +0000176 # FIXME: Temporarily disabled because of build errors
177 #- name: Cache snd-dummy
178 # uses: actions/cache@v3
179 # with:
180 # path: ${{ env.SND_DUMMY_DIR }}
181 # key: linux-${{ env.LINUX_VERSION }}-snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100182
Philip H1273dfb2022-11-24 15:15:08 +0000183 #- 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
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100193
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
dundargocb5328b42022-12-17 15:47:45 +0000256 uses: codecov/codecov-action@v3
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
Philip Hd094e582022-10-16 14:53:34 +0100307 brew uninstall perl
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100308
309 - name: Set up environment
310 run: |
311 (
312 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
313 case "${{ matrix.features }}" in
314 tiny)
315 echo "TEST=testtiny"
316 echo "CONFOPT=--disable-gui"
317 ;;
ichizok48c01962021-12-11 17:34:19 +0000318 normal)
319 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100320 huge)
Philip Hd094e582022-10-16 14:53:34 +0100321 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100322 ;;
323 esac
324 ) >> $GITHUB_ENV
325
326 - name: Configure
327 run: |
328 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
329 # Append various warning flags to CFLAGS.
330 # BSD sed needs backup extension specified.
331 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
332 # On macOS, the entity of gcc is clang.
333 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000334 # Suppress some warnings produced by clang 12 and later.
335 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
336 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
337 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100338
339 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100340 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100341 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100342 run: |
343 make -j${NPROC}
344
345 - name: Check version
346 run: |
347 "${SRCDIR}"/vim --version
348 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
349 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
350
351 - name: Test
352 timeout-minutes: 20
353 run: |
354 make ${TEST}
355
356 windows:
Philip H361f9d22022-06-14 11:35:21 +0100357 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100358
359 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100360 # Interfaces
361 # Lua
362 LUA_VER: 54
363 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000364 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100365 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
366 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
367 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100368 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
369 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100370 # Python 2
371 PYTHON_VER: 27
372 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100373 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100374 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000375 PYTHON3_VER: 311
376 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100377 # Other dependencies
378 # winpty
379 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
380 # Escape sequences
381 COL_RED: "\x1b[31m"
382 COL_GREEN: "\x1b[32m"
383 COL_YELLOW: "\x1b[33m"
384 COL_RESET: "\x1b[m"
385
386 strategy:
387 fail-fast: false
388 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100389 include:
K.Takata2da11a42022-09-10 13:03:12 +0100390 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
391 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
392 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
393 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
394 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
395 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
396 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
397 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100398
399 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200400 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100401 id: init
402 shell: bash
403 run: |
K.Takata80613d62022-11-09 16:12:47 +0000404 # Show Windows version
405 cmd /c ver
406
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100407 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100408
409 if [ "${{ matrix.arch }}" = "x64" ]; then
410 cygreg=registry
411 pyreg=
412 echo "VCARCH=amd64" >> $GITHUB_ENV
413 echo "WARCH=x64" >> $GITHUB_ENV
414 echo "BITS=64" >> $GITHUB_ENV
415 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100416 else
K.Takata2da11a42022-09-10 13:03:12 +0100417 cygreg=registry32
418 pyreg=-32
419 echo "VCARCH=x86" >> $GITHUB_ENV
420 echo "WARCH=ia32" >> $GITHUB_ENV
421 echo "BITS=32" >> $GITHUB_ENV
422 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100423 fi
K.Takata2da11a42022-09-10 13:03:12 +0100424
425 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
426 if [ "${{ matrix.features }}" != "TINY" ]; then
427 if [ "${{ matrix.arch }}" = "x86" ]; then
K.Takata80613d62022-11-09 16:12:47 +0000428 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100429 else
K.Takata80613d62022-11-09 16:12:47 +0000430 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100431 fi
432 fi
433 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100434 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
435
436 - uses: msys2/setup-msys2@v2
437 if: matrix.toolchain == 'mingw'
438 with:
Philip H361f9d22022-06-14 11:35:21 +0100439 update: true
440 install: tar
441 pacboy: >-
442 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100443 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100444 release: false
445
Philip Hbfaa24f2022-06-01 21:26:34 +0100446 - name: Checkout repository from github
447 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100448
449 - name: Create a list of download URLs
450 shell: cmd
451 run: |
452 type NUL > urls.txt
453 echo %LUA_RELEASE%>> urls.txt
454 echo %WINPTY_URL%>> urls.txt
455
456 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100457 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100458 with:
459 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100460 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100461
462 - name: Download dependencies
463 shell: cmd
464 run: |
465 path C:\Program Files\7-Zip;%path%
466 if not exist downloads mkdir downloads
467
468 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100469 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100470 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
471
472 echo %COL_GREEN%Download winpty%COL_RESET%
473 call :downloadfile %WINPTY_URL% downloads\winpty.zip
474 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100475 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
476 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100477
478 goto :eof
479
480 :downloadfile
481 :: call :downloadfile <URL> <localfile>
482 if not exist %2 (
483 curl -f -L %1 -o %2
484 )
485 if ERRORLEVEL 1 (
486 rem Retry once.
487 curl -f -L %1 -o %2 || exit 1
488 )
489 goto :eof
490
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100491 - name: Build (MSVC)
492 if: matrix.toolchain == 'msvc'
493 shell: cmd
494 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100495 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100496 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100497 if "${{ matrix.VIMDLL }}"=="yes" (
498 set GUI=yes
499 ) else (
500 set GUI=${{ matrix.GUI }}
501 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100502 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000503 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100504 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100505 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100506 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
507 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
508 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
509 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000510 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100511 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100512 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100513 )
514
515 - name: Build (MinGW)
516 if: matrix.toolchain == 'mingw'
517 shell: msys2 {0}
518 run: |
519 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100520 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
521 GUI=yes
522 else
523 GUI=${{ matrix.GUI }}
524 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100525 if [ "${{ matrix.features }}" = "HUGE" ]; then
526 mingw32-make -f Make_ming.mak -j2 \
527 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100528 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100529 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100530 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
531 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000532 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100533 else
534 mingw32-make -f Make_ming.mak -j2 \
535 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100536 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100537 STATIC_STDCPLUS=yes
538 fi
539
ichizok0cd3e942022-02-14 11:36:57 +0000540 - name: Check version
541 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000542 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100543 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
544 if "${{ matrix.GUI }}"=="yes" (
545 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
546 type version.txt
547 echo.
548 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
549 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
550 type version.txt
551 del version.txt
552 ) else (
553 src\vim --version || exit 1
554 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
555 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
556 )
ichizok0cd3e942022-02-14 11:36:57 +0000557
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100558 #- name: Prepare Artifact
559 # shell: cmd
560 # run: |
561 # mkdir artifacts
562 # copy src\*vim.exe artifacts
563 # copy src\vim*.dll artifacts
564 #
565 #- name: Upload Artifact
566 # uses: actions/upload-artifact@v1
567 # with:
568 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
569 # path: ./artifacts
570
ichizok0cd3e942022-02-14 11:36:57 +0000571 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100572 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100573 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100574 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100575 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100576 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
577 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100578
ichizok0cd3e942022-02-14 11:36:57 +0000579 echo %COL_GREEN%Test gVim:%COL_RESET%
580 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100581 if "${{ matrix.GUI }}"=="yes" (
582 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
583 ) else (
584 @rem Run only tiny tests.
585 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100586 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100587
K.Takata2da11a42022-09-10 13:03:12 +0100588 - name: Test and show the result of testing Vim
589 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
590 shell: cmd
591 timeout-minutes: 15
592 run: |
593 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
594 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000595
K.Takata2da11a42022-09-10 13:03:12 +0100596 echo %COL_GREEN%Test Vim:%COL_RESET%
597 cd src\testdir
598 nmake -nologo -f Make_mvc.mak clean
599 if "${{ matrix.GUI }}"=="no" (
600 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
601 ) else (
602 @rem Run only tiny tests.
603 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100604 )
ichizok41ee5b12022-02-12 10:13:13 +0000605
606 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000607 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000608 shell: msys2 {0}
609 run: |
610 cd src
611 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000612
K.Takata2da11a42022-09-10 13:03:12 +0100613 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000614 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000615 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000616 with:
617 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000618 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}