blob: 01cc16a571228f75474a017245450063071d4d09 [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: |
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
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100128 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100129 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
Philip H1273dfb2022-11-24 15:15:08 +0000177 # FIXME: Temporarily disabled because of build errors
178 #- name: Cache snd-dummy
179 # uses: actions/cache@v3
180 # with:
181 # path: ${{ env.SND_DUMMY_DIR }}
182 # key: linux-${{ env.LINUX_VERSION }}-snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100183
Philip H1273dfb2022-11-24 15:15:08 +0000184 #- name: Set up snd-dummy
185 # run: |
186 # if [[ ! -e ${SND_DUMMY_DIR}/snd-dummy.ko ]]; then
187 # bash ci/build-snd-dummy.sh
188 # fi
189 # cd "${SND_DUMMY_DIR}"
190 # sudo insmod soundcore.ko
191 # sudo insmod snd.ko
192 # sudo insmod snd-pcm.ko
193 # sudo insmod snd-dummy.ko
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100194
195 - name: Check autoconf
196 if: contains(matrix.extra, 'unittests')
197 run: |
198 make -C src autoconf
199
200 - name: Set up shadow dir
201 if: matrix.shadow
202 run: |
203 make -C src shadow
204 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
205 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
206
207 - name: Configure
208 run: |
209 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
210 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100211 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
212 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000213 if [[ ${CC} = clang ]]; then
214 # Suppress some warnings produced by clang 12 and later.
215 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
216 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100217
218 - name: Build
219 if: (!contains(matrix.extra, 'unittests'))
220 run: |
221 make ${SHADOWOPT} -j${NPROC}
222
223 - name: Check version
224 if: (!contains(matrix.extra, 'unittests'))
225 run: |
226 "${SRCDIR}"/vim --version
227 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
228 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
229
230 - name: Test
231 timeout-minutes: 20
232 run: |
233 do_test() { sg audio "sg $(id -gn) '$*'"; }
234 do_test make ${SHADOWOPT} ${TEST}
235
ichizok0d47ad42022-01-11 13:05:26 +0000236 # - name: Coveralls
ichizok41ee5b12022-02-12 10:13:13 +0000237 # if: matrix.coverage && github.event_name != 'pull_request'
ichizok0d47ad42022-01-11 13:05:26 +0000238 # env:
239 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
240 # COVERALLS_PARALLEL: true
241 # TRAVIS_JOB_ID: ${{ github.run_id }}
242 # run: |
243 # sudo apt-get install -y python3-setuptools python3-wheel
244 # sudo -H pip3 install pip -U
245 # # needed for https support for coveralls building cffi only works with gcc, not with clang
246 # CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
247 # ~/.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 +0100248
ichizok0d47ad42022-01-11 13:05:26 +0000249 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000250 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100251 run: |
252 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000253 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
254
255 - name: Codecov
ichizok41ee5b12022-02-12 10:13:13 +0000256 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000257 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000258 with:
ichizok41ee5b12022-02-12 10:13:13 +0000259 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100260
261 - name: ASan logs
262 if: contains(matrix.extra, 'asan') && !cancelled()
263 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000264 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000265 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100266 false # in order to fail a job
267 done
268
ichizok0d47ad42022-01-11 13:05:26 +0000269 # coveralls:
Philip Hb2137032022-08-25 15:21:24 +0100270 # runs-on: ubuntu-20.04
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200271 #
ichizok0d47ad42022-01-11 13:05:26 +0000272 # needs: linux
273 # if: always() && github.event_name != 'pull_request'
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200274 #
ichizok0d47ad42022-01-11 13:05:26 +0000275 # steps:
276 # - name: Parallel finished
277 # env:
278 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
279 # run: |
280 # 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 +0100281
282 macos:
283 runs-on: macos-latest
284
285 env:
ichizok48c01962021-12-11 17:34:19 +0000286 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100287 TEST: test
288 SRCDIR: ./src
289 LEAK_CFLAGS: -DEXITFREE
290 TERM: xterm
291
292 strategy:
293 fail-fast: false
294 matrix:
ichizok48c01962021-12-11 17:34:19 +0000295 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100296
297 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100298 - name: Checkout repository from github
299 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100300
301 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000302 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100303 env:
304 HOMEBREW_NO_AUTO_UPDATE: 1
305 run: |
306 brew install lua
307 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
Philip Hd094e582022-10-16 14:53:34 +0100308 brew uninstall perl
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100309
310 - name: Set up environment
311 run: |
312 (
313 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
314 case "${{ matrix.features }}" in
315 tiny)
316 echo "TEST=testtiny"
317 echo "CONFOPT=--disable-gui"
318 ;;
ichizok48c01962021-12-11 17:34:19 +0000319 normal)
320 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100321 huge)
Philip Hd094e582022-10-16 14:53:34 +0100322 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100323 ;;
324 esac
325 ) >> $GITHUB_ENV
326
327 - name: Configure
328 run: |
329 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
330 # Append various warning flags to CFLAGS.
331 # BSD sed needs backup extension specified.
332 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
333 # On macOS, the entity of gcc is clang.
334 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000335 # Suppress some warnings produced by clang 12 and later.
336 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
337 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
338 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100339
340 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100341 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100342 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100343 run: |
344 make -j${NPROC}
345
346 - name: Check version
347 run: |
348 "${SRCDIR}"/vim --version
349 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
350 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
351
352 - name: Test
353 timeout-minutes: 20
354 run: |
355 make ${TEST}
356
357 windows:
Philip H361f9d22022-06-14 11:35:21 +0100358 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100359
360 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100361 # Interfaces
362 # Lua
363 LUA_VER: 54
364 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000365 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100366 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
367 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
368 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100369 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
370 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100371 # Python 2
372 PYTHON_VER: 27
373 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100374 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100375 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000376 PYTHON3_VER: 311
377 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100378 # Other dependencies
379 # winpty
380 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
381 # Escape sequences
382 COL_RED: "\x1b[31m"
383 COL_GREEN: "\x1b[32m"
384 COL_YELLOW: "\x1b[33m"
385 COL_RESET: "\x1b[m"
386
387 strategy:
388 fail-fast: false
389 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100390 include:
K.Takata2da11a42022-09-10 13:03:12 +0100391 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
392 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
393 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
394 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
395 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
396 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
397 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
398 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100399
400 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200401 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100402 id: init
403 shell: bash
404 run: |
K.Takata80613d62022-11-09 16:12:47 +0000405 # Show Windows version
406 cmd /c ver
407
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100408 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100409
410 if [ "${{ matrix.arch }}" = "x64" ]; then
411 cygreg=registry
412 pyreg=
413 echo "VCARCH=amd64" >> $GITHUB_ENV
414 echo "WARCH=x64" >> $GITHUB_ENV
415 echo "BITS=64" >> $GITHUB_ENV
416 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100417 else
K.Takata2da11a42022-09-10 13:03:12 +0100418 cygreg=registry32
419 pyreg=-32
420 echo "VCARCH=x86" >> $GITHUB_ENV
421 echo "WARCH=ia32" >> $GITHUB_ENV
422 echo "BITS=32" >> $GITHUB_ENV
423 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100424 fi
K.Takata2da11a42022-09-10 13:03:12 +0100425
426 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
427 if [ "${{ matrix.features }}" != "TINY" ]; then
428 if [ "${{ matrix.arch }}" = "x86" ]; then
K.Takata80613d62022-11-09 16:12:47 +0000429 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100430 else
K.Takata80613d62022-11-09 16:12:47 +0000431 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100432 fi
433 fi
434 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100435 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
436
437 - uses: msys2/setup-msys2@v2
438 if: matrix.toolchain == 'mingw'
439 with:
Philip H361f9d22022-06-14 11:35:21 +0100440 update: true
441 install: tar
442 pacboy: >-
443 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100444 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100445 release: false
446
Philip Hbfaa24f2022-06-01 21:26:34 +0100447 - name: Checkout repository from github
448 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100449
450 - name: Create a list of download URLs
451 shell: cmd
452 run: |
453 type NUL > urls.txt
454 echo %LUA_RELEASE%>> urls.txt
455 echo %WINPTY_URL%>> urls.txt
456
457 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100458 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100459 with:
460 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100461 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100462
463 - name: Download dependencies
464 shell: cmd
465 run: |
466 path C:\Program Files\7-Zip;%path%
467 if not exist downloads mkdir downloads
468
469 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100470 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100471 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
472
473 echo %COL_GREEN%Download winpty%COL_RESET%
474 call :downloadfile %WINPTY_URL% downloads\winpty.zip
475 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100476 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
477 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100478
479 goto :eof
480
481 :downloadfile
482 :: call :downloadfile <URL> <localfile>
483 if not exist %2 (
484 curl -f -L %1 -o %2
485 )
486 if ERRORLEVEL 1 (
487 rem Retry once.
488 curl -f -L %1 -o %2 || exit 1
489 )
490 goto :eof
491
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100492 - name: Build (MSVC)
493 if: matrix.toolchain == 'msvc'
494 shell: cmd
495 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100496 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100497 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100498 if "${{ matrix.VIMDLL }}"=="yes" (
499 set GUI=yes
500 ) else (
501 set GUI=${{ matrix.GUI }}
502 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100503 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000504 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100505 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100506 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100507 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
508 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
509 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
510 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000511 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100512 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100513 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100514 )
515
516 - name: Build (MinGW)
517 if: matrix.toolchain == 'mingw'
518 shell: msys2 {0}
519 run: |
520 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100521 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
522 GUI=yes
523 else
524 GUI=${{ matrix.GUI }}
525 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100526 if [ "${{ matrix.features }}" = "HUGE" ]; then
527 mingw32-make -f Make_ming.mak -j2 \
528 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100529 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100530 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100531 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
532 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000533 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100534 else
535 mingw32-make -f Make_ming.mak -j2 \
536 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100537 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100538 STATIC_STDCPLUS=yes
539 fi
540
ichizok0cd3e942022-02-14 11:36:57 +0000541 - name: Check version
542 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000543 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100544 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
545 if "${{ matrix.GUI }}"=="yes" (
546 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
547 type version.txt
548 echo.
549 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
550 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
551 type version.txt
552 del version.txt
553 ) else (
554 src\vim --version || exit 1
555 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
556 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
557 )
ichizok0cd3e942022-02-14 11:36:57 +0000558
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100559 #- name: Prepare Artifact
560 # shell: cmd
561 # run: |
562 # mkdir artifacts
563 # copy src\*vim.exe artifacts
564 # copy src\vim*.dll artifacts
565 #
566 #- name: Upload Artifact
567 # uses: actions/upload-artifact@v1
568 # with:
569 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
570 # path: ./artifacts
571
ichizok0cd3e942022-02-14 11:36:57 +0000572 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100573 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100574 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100575 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100576 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100577 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
578 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100579
ichizok0cd3e942022-02-14 11:36:57 +0000580 echo %COL_GREEN%Test gVim:%COL_RESET%
581 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100582 if "${{ matrix.GUI }}"=="yes" (
583 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
584 ) else (
585 @rem Run only tiny tests.
586 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100587 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100588
K.Takata2da11a42022-09-10 13:03:12 +0100589 - name: Test and show the result of testing Vim
590 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
591 shell: cmd
592 timeout-minutes: 15
593 run: |
594 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
595 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000596
K.Takata2da11a42022-09-10 13:03:12 +0100597 echo %COL_GREEN%Test Vim:%COL_RESET%
598 cd src\testdir
599 nmake -nologo -f Make_mvc.mak clean
600 if "${{ matrix.GUI }}"=="no" (
601 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
602 ) else (
603 @rem Run only tiny tests.
604 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100605 )
ichizok41ee5b12022-02-12 10:13:13 +0000606
607 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000608 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000609 shell: msys2 {0}
610 run: |
611 cd src
612 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000613
K.Takata2da11a42022-09-10 13:03:12 +0100614 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000615 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000616 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000617 with:
618 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000619 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}