blob: a4b02404d9d7cbf894c2e772648a7c6995006314 [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 run: |
303 brew install lua
304 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
Philip Hd094e582022-10-16 14:53:34 +0100305 brew uninstall perl
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100306
307 - name: Set up environment
308 run: |
309 (
310 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
311 case "${{ matrix.features }}" in
312 tiny)
313 echo "TEST=testtiny"
314 echo "CONFOPT=--disable-gui"
315 ;;
ichizok48c01962021-12-11 17:34:19 +0000316 normal)
317 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100318 huge)
Philip Hd094e582022-10-16 14:53:34 +0100319 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100320 ;;
321 esac
322 ) >> $GITHUB_ENV
323
324 - name: Configure
325 run: |
326 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
327 # Append various warning flags to CFLAGS.
328 # BSD sed needs backup extension specified.
329 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
330 # On macOS, the entity of gcc is clang.
331 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000332 # Suppress some warnings produced by clang 12 and later.
333 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
334 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
335 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100336
337 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100338 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100339 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100340 run: |
341 make -j${NPROC}
342
343 - name: Check version
344 run: |
345 "${SRCDIR}"/vim --version
346 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
347 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
348
349 - name: Test
350 timeout-minutes: 20
351 run: |
352 make ${TEST}
353
354 windows:
Philip H361f9d22022-06-14 11:35:21 +0100355 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100356
357 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100358 # Interfaces
359 # Lua
360 LUA_VER: 54
361 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000362 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100363 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
364 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
365 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100366 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
367 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100368 # Python 2
369 PYTHON_VER: 27
370 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100371 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100372 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000373 PYTHON3_VER: 311
374 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100375 # Other dependencies
376 # winpty
377 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
378 # Escape sequences
379 COL_RED: "\x1b[31m"
380 COL_GREEN: "\x1b[32m"
381 COL_YELLOW: "\x1b[33m"
382 COL_RESET: "\x1b[m"
383
384 strategy:
385 fail-fast: false
386 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100387 include:
K.Takata2da11a42022-09-10 13:03:12 +0100388 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
389 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
390 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
391 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
392 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
393 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
394 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
395 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100396
397 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200398 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100399 id: init
400 shell: bash
401 run: |
K.Takata80613d62022-11-09 16:12:47 +0000402 # Show Windows version
403 cmd /c ver
404
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100405 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100406
407 if [ "${{ matrix.arch }}" = "x64" ]; then
408 cygreg=registry
409 pyreg=
410 echo "VCARCH=amd64" >> $GITHUB_ENV
411 echo "WARCH=x64" >> $GITHUB_ENV
412 echo "BITS=64" >> $GITHUB_ENV
413 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100414 else
K.Takata2da11a42022-09-10 13:03:12 +0100415 cygreg=registry32
416 pyreg=-32
417 echo "VCARCH=x86" >> $GITHUB_ENV
418 echo "WARCH=ia32" >> $GITHUB_ENV
419 echo "BITS=32" >> $GITHUB_ENV
420 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100421 fi
K.Takata2da11a42022-09-10 13:03:12 +0100422
423 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
424 if [ "${{ matrix.features }}" != "TINY" ]; then
425 if [ "${{ matrix.arch }}" = "x86" ]; then
K.Takata80613d62022-11-09 16:12:47 +0000426 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100427 else
K.Takata80613d62022-11-09 16:12:47 +0000428 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100429 fi
430 fi
431 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100432 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
433
434 - uses: msys2/setup-msys2@v2
435 if: matrix.toolchain == 'mingw'
436 with:
Philip H361f9d22022-06-14 11:35:21 +0100437 update: true
438 install: tar
439 pacboy: >-
440 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100441 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100442 release: false
443
Philip Hbfaa24f2022-06-01 21:26:34 +0100444 - name: Checkout repository from github
445 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100446
447 - name: Create a list of download URLs
448 shell: cmd
449 run: |
450 type NUL > urls.txt
451 echo %LUA_RELEASE%>> urls.txt
452 echo %WINPTY_URL%>> urls.txt
453
454 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100455 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100456 with:
457 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100458 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100459
460 - name: Download dependencies
461 shell: cmd
462 run: |
463 path C:\Program Files\7-Zip;%path%
464 if not exist downloads mkdir downloads
465
466 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100467 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100468 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
469
470 echo %COL_GREEN%Download winpty%COL_RESET%
471 call :downloadfile %WINPTY_URL% downloads\winpty.zip
472 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100473 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
474 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100475
476 goto :eof
477
478 :downloadfile
479 :: call :downloadfile <URL> <localfile>
480 if not exist %2 (
481 curl -f -L %1 -o %2
482 )
483 if ERRORLEVEL 1 (
484 rem Retry once.
485 curl -f -L %1 -o %2 || exit 1
486 )
487 goto :eof
488
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100489 - name: Build (MSVC)
490 if: matrix.toolchain == 'msvc'
491 shell: cmd
492 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100493 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100494 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100495 if "${{ matrix.VIMDLL }}"=="yes" (
496 set GUI=yes
497 ) else (
498 set GUI=${{ matrix.GUI }}
499 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100500 if "${{ matrix.features }}"=="HUGE" (
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 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
505 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
506 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR%
507 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000508 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100509 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100510 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100511 )
512
513 - name: Build (MinGW)
514 if: matrix.toolchain == 'mingw'
515 shell: msys2 {0}
516 run: |
517 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100518 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
519 GUI=yes
520 else
521 GUI=${{ matrix.GUI }}
522 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100523 if [ "${{ matrix.features }}" = "HUGE" ]; then
524 mingw32-make -f Make_ming.mak -j2 \
525 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100526 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100527 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100528 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
529 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000530 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100531 else
532 mingw32-make -f Make_ming.mak -j2 \
533 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100534 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100535 STATIC_STDCPLUS=yes
536 fi
537
ichizok0cd3e942022-02-14 11:36:57 +0000538 - name: Check version
539 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000540 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100541 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
542 if "${{ matrix.GUI }}"=="yes" (
543 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
544 type version.txt
545 echo.
546 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
547 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
548 type version.txt
549 del version.txt
550 ) else (
551 src\vim --version || exit 1
552 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
553 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
554 )
ichizok0cd3e942022-02-14 11:36:57 +0000555
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100556 #- name: Prepare Artifact
557 # shell: cmd
558 # run: |
559 # mkdir artifacts
560 # copy src\*vim.exe artifacts
561 # copy src\vim*.dll artifacts
562 #
563 #- name: Upload Artifact
564 # uses: actions/upload-artifact@v1
565 # with:
566 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
567 # path: ./artifacts
568
ichizok0cd3e942022-02-14 11:36:57 +0000569 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100570 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100571 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100572 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100573 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100574 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
575 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100576
ichizok0cd3e942022-02-14 11:36:57 +0000577 echo %COL_GREEN%Test gVim:%COL_RESET%
578 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100579 if "${{ matrix.GUI }}"=="yes" (
580 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
581 ) else (
582 @rem Run only tiny tests.
583 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100584 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100585
K.Takata2da11a42022-09-10 13:03:12 +0100586 - name: Test and show the result of testing Vim
587 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
588 shell: cmd
589 timeout-minutes: 15
590 run: |
591 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
592 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000593
K.Takata2da11a42022-09-10 13:03:12 +0100594 echo %COL_GREEN%Test Vim:%COL_RESET%
595 cd src\testdir
596 nmake -nologo -f Make_mvc.mak clean
597 if "${{ matrix.GUI }}"=="no" (
598 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
599 ) else (
600 @rem Run only tiny tests.
601 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100602 )
ichizok41ee5b12022-02-12 10:13:13 +0000603
604 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000605 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000606 shell: msys2 {0}
607 run: |
608 cd src
609 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000610
K.Takata2da11a42022-09-10 13:03:12 +0100611 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000612 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000613 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000614 with:
615 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000616 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}