blob: d91e9cc855a3a216112f5d09c6a34e3f11fb20fc [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
ichizok01722702023-04-21 17:46:57 +010094 sudo apt-get update && sudo apt-get 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: |
ichizok01722702023-04-21 17:46:57 +010099 sudo apt-get install -y gcc-11
Philip Hd2edee52022-04-16 20:04:30 +0100100 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"
ichizok01722702023-04-21 17:46:57 +0100109 sudo apt-get install -y clang-16 llvm-16
Philip H43e234e2023-02-06 20:22:48 +0000110 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)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100123 echo "TMPDIR=${{ runner.temp }}"
124
125 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100126 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100127 echo "TEST=testtiny"
128 if ${{ contains(matrix.extra, 'nogui') }}; then
129 echo "CONFOPT=--disable-gui"
130 fi
131 ;;
132 normal)
133 ;;
134 huge)
135 echo "TEST=scripttests test_libvterm"
136 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
137 ;;
138 esac
139
140 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100141 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100142 echo "LDFLAGS=--coverage"
143 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100144 if ${{ matrix.uchar == true }}; then
145 CFLAGS="$CFLAGS -funsigned-char"
146 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100147 if ${{ contains(matrix.extra, 'testgui') }}; then
148 echo "TEST=-C src testgui"
149 fi
150 if ${{ contains(matrix.extra, 'unittests') }}; then
151 echo "TEST=unittests"
152 fi
153 if ${{ contains(matrix.extra, 'asan') }}; then
154 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
155 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
156 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
157 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
158 fi
159 if ${{ contains(matrix.extra, 'vimtags') }}; then
160 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
161 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100162 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100163 ) >> $GITHUB_ENV
164
165 - name: Set up system
166 run: |
167 if [[ ${CC} = clang ]]; then
168 # Use llvm-cov instead of gcov when compiler is clang.
169 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
170 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100171 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
172 sudo usermod -a -G audio "${USER}"
173 sudo bash ci/setup-xvfb.sh
174
ichizok01722702023-04-21 17:46:57 +0100175 - name: Set up snd-dummy
176 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
177 env:
178 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
179 run: |
180 cd /lib/modules/${{ env.LINUX_VERSION }}
181 sudo apt-get install -d -y linux-modules-extra-${{ env.LINUX_VERSION }}
182 sudo dpkg -x /var/cache/apt/archives/linux-modules-extra-${{ env.LINUX_VERSION }}*.deb "${DEST_DIR}"
183 tar -cC "${DEST_DIR}"/lib/modules/${{ env.LINUX_VERSION }} kernel/sound | sudo tar -x
184 sudo depmod
185 sudo modprobe snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100186
187 - name: Check autoconf
188 if: contains(matrix.extra, 'unittests')
189 run: |
190 make -C src autoconf
191
192 - name: Set up shadow dir
193 if: matrix.shadow
194 run: |
195 make -C src shadow
196 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
197 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
198
199 - name: Configure
200 run: |
201 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
202 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100203 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
204 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000205 if [[ ${CC} = clang ]]; then
206 # Suppress some warnings produced by clang 12 and later.
207 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
208 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100209
210 - name: Build
211 if: (!contains(matrix.extra, 'unittests'))
212 run: |
213 make ${SHADOWOPT} -j${NPROC}
214
215 - name: Check version
216 if: (!contains(matrix.extra, 'unittests'))
217 run: |
218 "${SRCDIR}"/vim --version
219 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
220 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
221
222 - name: Test
223 timeout-minutes: 20
224 run: |
225 do_test() { sg audio "sg $(id -gn) '$*'"; }
226 do_test make ${SHADOWOPT} ${TEST}
227
ichizok0d47ad42022-01-11 13:05:26 +0000228 # - name: Coveralls
ichizok41ee5b12022-02-12 10:13:13 +0000229 # if: matrix.coverage && github.event_name != 'pull_request'
ichizok0d47ad42022-01-11 13:05:26 +0000230 # env:
231 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
232 # COVERALLS_PARALLEL: true
233 # TRAVIS_JOB_ID: ${{ github.run_id }}
234 # run: |
235 # sudo apt-get install -y python3-setuptools python3-wheel
236 # sudo -H pip3 install pip -U
237 # # needed for https support for coveralls building cffi only works with gcc, not with clang
238 # CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
239 # ~/.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 +0100240
ichizok0d47ad42022-01-11 13:05:26 +0000241 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000242 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100243 run: |
244 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000245 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
246
247 - name: Codecov
ichizok41ee5b12022-02-12 10:13:13 +0000248 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000249 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000250 with:
ichizok41ee5b12022-02-12 10:13:13 +0000251 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100252
253 - name: ASan logs
254 if: contains(matrix.extra, 'asan') && !cancelled()
255 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000256 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000257 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100258 false # in order to fail a job
259 done
260
ichizok0d47ad42022-01-11 13:05:26 +0000261 # coveralls:
Philip Hb2137032022-08-25 15:21:24 +0100262 # runs-on: ubuntu-20.04
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200263 #
ichizok0d47ad42022-01-11 13:05:26 +0000264 # needs: linux
265 # if: always() && github.event_name != 'pull_request'
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200266 #
ichizok0d47ad42022-01-11 13:05:26 +0000267 # steps:
268 # - name: Parallel finished
269 # env:
270 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
271 # run: |
272 # 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 +0100273
274 macos:
275 runs-on: macos-latest
276
277 env:
ichizok48c01962021-12-11 17:34:19 +0000278 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100279 TEST: test
280 SRCDIR: ./src
281 LEAK_CFLAGS: -DEXITFREE
282 TERM: xterm
283
284 strategy:
285 fail-fast: false
286 matrix:
ichizok48c01962021-12-11 17:34:19 +0000287 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100288
289 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100290 - name: Checkout repository from github
291 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100292
293 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000294 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100295 run: |
296 brew install lua
297 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
Philip Hd094e582022-10-16 14:53:34 +0100298 brew uninstall perl
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100299
300 - name: Set up environment
301 run: |
302 (
303 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
304 case "${{ matrix.features }}" in
305 tiny)
306 echo "TEST=testtiny"
307 echo "CONFOPT=--disable-gui"
308 ;;
ichizok48c01962021-12-11 17:34:19 +0000309 normal)
310 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100311 huge)
Philip Hd094e582022-10-16 14:53:34 +0100312 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100313 ;;
314 esac
315 ) >> $GITHUB_ENV
316
317 - name: Configure
318 run: |
319 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
320 # Append various warning flags to CFLAGS.
321 # BSD sed needs backup extension specified.
322 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
323 # On macOS, the entity of gcc is clang.
324 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000325 # Suppress some warnings produced by clang 12 and later.
326 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
327 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
328 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100329
330 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100331 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100332 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100333 run: |
334 make -j${NPROC}
335
336 - name: Check version
337 run: |
338 "${SRCDIR}"/vim --version
339 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
340 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
341
342 - name: Test
343 timeout-minutes: 20
344 run: |
345 make ${TEST}
346
347 windows:
Philip H361f9d22022-06-14 11:35:21 +0100348 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100349
350 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100351 # Interfaces
352 # Lua
353 LUA_VER: 54
354 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000355 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100356 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
357 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
358 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100359 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
360 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100361 # Python 2
362 PYTHON_VER: 27
363 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100364 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100365 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000366 PYTHON3_VER: 311
367 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100368 # Other dependencies
369 # winpty
370 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
371 # Escape sequences
372 COL_RED: "\x1b[31m"
373 COL_GREEN: "\x1b[32m"
374 COL_YELLOW: "\x1b[33m"
375 COL_RESET: "\x1b[m"
376
377 strategy:
378 fail-fast: false
379 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100380 include:
K.Takata2da11a42022-09-10 13:03:12 +0100381 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
382 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
383 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
384 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
385 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
386 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
387 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
388 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100389
390 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200391 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100392 id: init
393 shell: bash
394 run: |
K.Takata80613d62022-11-09 16:12:47 +0000395 # Show Windows version
396 cmd /c ver
397
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100398 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100399
400 if [ "${{ matrix.arch }}" = "x64" ]; then
401 cygreg=registry
402 pyreg=
403 echo "VCARCH=amd64" >> $GITHUB_ENV
404 echo "WARCH=x64" >> $GITHUB_ENV
405 echo "BITS=64" >> $GITHUB_ENV
406 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100407 else
K.Takata2da11a42022-09-10 13:03:12 +0100408 cygreg=registry32
409 pyreg=-32
410 echo "VCARCH=x86" >> $GITHUB_ENV
411 echo "WARCH=ia32" >> $GITHUB_ENV
412 echo "BITS=32" >> $GITHUB_ENV
413 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100414 fi
K.Takata2da11a42022-09-10 13:03:12 +0100415
416 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
417 if [ "${{ matrix.features }}" != "TINY" ]; then
418 if [ "${{ matrix.arch }}" = "x86" ]; then
K.Takata80613d62022-11-09 16:12:47 +0000419 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100420 else
K.Takata80613d62022-11-09 16:12:47 +0000421 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100422 fi
423 fi
424 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100425 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
426
427 - uses: msys2/setup-msys2@v2
428 if: matrix.toolchain == 'mingw'
429 with:
Philip H361f9d22022-06-14 11:35:21 +0100430 update: true
431 install: tar
432 pacboy: >-
433 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100434 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100435 release: false
436
Philip Hbfaa24f2022-06-01 21:26:34 +0100437 - name: Checkout repository from github
438 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100439
440 - name: Create a list of download URLs
441 shell: cmd
442 run: |
443 type NUL > urls.txt
444 echo %LUA_RELEASE%>> urls.txt
445 echo %WINPTY_URL%>> urls.txt
446
447 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100448 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100449 with:
450 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100451 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100452
453 - name: Download dependencies
454 shell: cmd
455 run: |
456 path C:\Program Files\7-Zip;%path%
457 if not exist downloads mkdir downloads
458
459 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100460 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100461 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
462
463 echo %COL_GREEN%Download winpty%COL_RESET%
464 call :downloadfile %WINPTY_URL% downloads\winpty.zip
465 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100466 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
467 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100468
469 goto :eof
470
471 :downloadfile
472 :: call :downloadfile <URL> <localfile>
473 if not exist %2 (
474 curl -f -L %1 -o %2
475 )
476 if ERRORLEVEL 1 (
477 rem Retry once.
478 curl -f -L %1 -o %2 || exit 1
479 )
480 goto :eof
481
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100482 - name: Build (MSVC)
483 if: matrix.toolchain == 'msvc'
484 shell: cmd
485 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100486 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100487 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100488 if "${{ matrix.VIMDLL }}"=="yes" (
489 set GUI=yes
490 ) else (
491 set GUI=${{ matrix.GUI }}
492 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100493 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000494 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100495 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100496 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100497 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
498 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
499 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
500 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000501 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100502 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100503 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100504 )
505
506 - name: Build (MinGW)
507 if: matrix.toolchain == 'mingw'
508 shell: msys2 {0}
509 run: |
510 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100511 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
512 GUI=yes
513 else
514 GUI=${{ matrix.GUI }}
515 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100516 if [ "${{ matrix.features }}" = "HUGE" ]; then
517 mingw32-make -f Make_ming.mak -j2 \
518 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100519 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100520 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100521 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
522 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000523 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100524 else
525 mingw32-make -f Make_ming.mak -j2 \
526 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100527 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100528 STATIC_STDCPLUS=yes
529 fi
530
ichizok0cd3e942022-02-14 11:36:57 +0000531 - name: Check version
532 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000533 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100534 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
535 if "${{ matrix.GUI }}"=="yes" (
536 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
537 type version.txt
538 echo.
539 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
540 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
541 type version.txt
542 del version.txt
543 ) else (
544 src\vim --version || exit 1
545 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
546 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
547 )
ichizok0cd3e942022-02-14 11:36:57 +0000548
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100549 #- name: Prepare Artifact
550 # shell: cmd
551 # run: |
552 # mkdir artifacts
553 # copy src\*vim.exe artifacts
554 # copy src\vim*.dll artifacts
555 #
556 #- name: Upload Artifact
557 # uses: actions/upload-artifact@v1
558 # with:
559 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
560 # path: ./artifacts
561
ichizok0cd3e942022-02-14 11:36:57 +0000562 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100563 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100564 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100565 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100566 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100567 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
568 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100569
ichizok0cd3e942022-02-14 11:36:57 +0000570 echo %COL_GREEN%Test gVim:%COL_RESET%
571 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100572 if "${{ matrix.GUI }}"=="yes" (
573 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
574 ) else (
575 @rem Run only tiny tests.
576 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100577 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100578
K.Takata2da11a42022-09-10 13:03:12 +0100579 - name: Test and show the result of testing Vim
580 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
581 shell: cmd
582 timeout-minutes: 15
583 run: |
584 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
585 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000586
K.Takata2da11a42022-09-10 13:03:12 +0100587 echo %COL_GREEN%Test Vim:%COL_RESET%
588 cd src\testdir
589 nmake -nologo -f Make_mvc.mak clean
590 if "${{ matrix.GUI }}"=="no" (
591 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
592 ) else (
593 @rem Run only tiny tests.
594 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100595 )
ichizok41ee5b12022-02-12 10:13:13 +0000596
597 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000598 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000599 shell: msys2 {0}
600 run: |
601 cd src
602 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000603
K.Takata2da11a42022-09-10 13:03:12 +0100604 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000605 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000606 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000607 with:
608 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000609 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}