blob: 8c2e5396b7c680bd3e2825fa8c2e42c6927e7adb [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 H9be736f2023-04-21 19:51:22 +010020 runs-on: ubuntu-22.04
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010021
22 env:
23 CC: ${{ matrix.compiler }}
Philip H7268e532023-05-16 20:11:02 +010024 GCC_VER: 13
Philip Hf109bf92023-09-25 21:05:00 +020025 CLANG_VER: 17
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010026 TEST: test
27 SRCDIR: ./src
28 LEAK_CFLAGS: -DEXITFREE
29 LOG_DIR: ${{ github.workspace }}/logs
30 TERM: xterm
31 DISPLAY: ':99'
Bram Moolenaar9aff9702020-12-21 13:37:28 +010032 DEBIAN_FRONTEND: noninteractive
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010033
34 strategy:
35 fail-fast: false
36 matrix:
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +010037 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010038 compiler: [clang, gcc]
ichizok3e1e63d2023-08-29 22:16:34 +020039 extra: [[]]
James McCoya4245a12023-09-05 07:41:23 +020040 # Only use non-native architecture when features != huge.
41 # features=huge tries to install python3-dev, which fails to install
42 # for the non-native architecture.
43 architecture: [native]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010044 include:
45 - features: tiny
46 compiler: clang
ichizok3e1e63d2023-08-29 22:16:34 +020047 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010048 - features: tiny
49 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020050 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010051 - features: normal
52 shadow: ./src/shadow
James McCoya4245a12023-09-05 07:41:23 +020053 compiler: gcc
54 architecture: i386
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010055 - features: huge
56 coverage: true
57 - features: huge
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020058 compiler: clang
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020059 interface: dynamic
60 python3: stable-abi
61 - features: huge
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010062 compiler: gcc
63 coverage: true
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020064 interface: dynamic
ichizok3e1e63d2023-08-29 22:16:34 +020065 extra: [uchar, testgui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010066 - features: huge
67 compiler: clang
Christian Brabandt6efb1982023-08-10 05:44:25 +020068 # Lua5.1 is the most widely used version (since it's what LuaJIT is
69 # compatible with), so ensure it works
ichizok3e1e63d2023-08-29 22:16:34 +020070 lua_ver: '5.1'
71 extra: [asan]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010072 - features: huge
73 compiler: gcc
74 coverage: true
ichizok3e1e63d2023-08-29 22:16:34 +020075 extra: [unittests]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010076 - features: normal
77 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020078 extra: [vimtags]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010079
80 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010081 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +020082 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010083
James McCoya4245a12023-09-05 07:41:23 +020084 - run: sudo dpkg --add-architecture i386
85 if: matrix.architecture == 'i386'
86
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010087 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010088 run: |
ichizok10504762022-01-15 13:37:14 +000089 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010090 gettext \
James McCoya4245a12023-09-05 07:41:23 +020091 libgtk2.0-dev:${{ matrix.architecture }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010092 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020093 libtool-bin \
James McCoya4245a12023-09-05 07:41:23 +020094 libncurses-dev:${{ matrix.architecture }} \
95 libxt-dev:${{ matrix.architecture }} \
ichizok10504762022-01-15 13:37:14 +000096 )
97 if ${{ matrix.features == 'huge' }}; then
ichizok3e1e63d2023-08-29 22:16:34 +020098 LUA_VER=${{ matrix.lua_ver || '5.4' }}
ichizok10504762022-01-15 13:37:14 +000099 PKGS+=( \
100 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +0200101 gdb \
ichizok10504762022-01-15 13:37:14 +0000102 lcov \
103 libcanberra-dev \
104 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +0100105 python2-dev \
ichizok10504762022-01-15 13:37:14 +0000106 python3-dev \
ichizok3e1e63d2023-08-29 22:16:34 +0200107 liblua${LUA_VER}-dev \
108 lua${LUA_VER} \
ichizok10504762022-01-15 13:37:14 +0000109 ruby-dev \
110 tcl-dev \
111 cscope \
112 libsodium-dev \
113 )
114 fi
ichizok01722702023-04-21 17:46:57 +0100115 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100116
Philip H9be736f2023-04-21 19:51:22 +0100117 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100118 if: matrix.compiler == 'gcc'
119 run: |
James McCoya4245a12023-09-05 07:41:23 +0200120 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ matrix.architecture }}
Philip H7268e532023-05-16 20:11:02 +0100121 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
122 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100123
Philip H9be736f2023-04-21 19:51:22 +0100124 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100125 if: matrix.compiler == 'clang'
126 run: |
127 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
128 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100129 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
130 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
131 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
132 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
133 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
134 sudo update-alternatives --install /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-${{ env.CLANG_VER }} 100
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100135
136 - name: Set up environment
137 run: |
138 mkdir -p "${LOG_DIR}"
139 mkdir -p "${HOME}/bin"
140 echo "${HOME}/bin" >> $GITHUB_PATH
141 (
142 echo "LINUX_VERSION=$(uname -r)"
143 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100144 echo "TMPDIR=${{ runner.temp }}"
145
146 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100147 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100148 echo "TEST=testtiny"
149 if ${{ contains(matrix.extra, 'nogui') }}; then
150 echo "CONFOPT=--disable-gui"
151 fi
152 ;;
153 normal)
154 ;;
155 huge)
156 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200157 INTERFACE=${{ matrix.interface || 'yes' }}
158 if ${{ matrix.python3 == 'stable-abi' }}; then
159 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200160 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200161 echo "CONFOPT=--enable-perlinterp=${INTERFACE} --enable-pythoninterp=${INTERFACE} --enable-python3interp=${INTERFACE} --enable-rubyinterp=${INTERFACE} --enable-luainterp=${INTERFACE} --enable-tclinterp=${INTERFACE} ${PYTHON3_CONFOPT}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100162 ;;
163 esac
164
165 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200166 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100167 echo "LDFLAGS=--coverage"
168 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200169 if ${{ contains(matrix.extra, 'uchar') }}; then
170 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100171 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100172 if ${{ contains(matrix.extra, 'testgui') }}; then
173 echo "TEST=-C src testgui"
174 fi
175 if ${{ contains(matrix.extra, 'unittests') }}; then
176 echo "TEST=unittests"
177 fi
178 if ${{ contains(matrix.extra, 'asan') }}; then
179 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
180 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
181 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
182 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
183 fi
184 if ${{ contains(matrix.extra, 'vimtags') }}; then
185 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
186 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200187 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100188 ) >> $GITHUB_ENV
189
190 - name: Set up system
191 run: |
192 if [[ ${CC} = clang ]]; then
193 # Use llvm-cov instead of gcov when compiler is clang.
194 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
195 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100196 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
197 sudo usermod -a -G audio "${USER}"
198 sudo bash ci/setup-xvfb.sh
199
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200200 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200201 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100202 env:
203 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200204 uses: tecolicom/actions-use-apt-tools@main
205 with:
206 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
207 path: "${DEST_DIR}"
208
209 - name: modprobe snd-dummy
210 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100211 run: |
Philip He741f032023-05-11 15:22:58 +0100212 sudo depmod --verbose
Christian Brabandta66feb52023-09-16 18:29:42 +0200213 sudo modprobe --verbose snd-dummy || true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100214
215 - name: Check autoconf
216 if: contains(matrix.extra, 'unittests')
217 run: |
218 make -C src autoconf
219
220 - name: Set up shadow dir
221 if: matrix.shadow
222 run: |
223 make -C src shadow
224 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
225 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
226
227 - name: Configure
228 run: |
229 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
230 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100231 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
232 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000233 if [[ ${CC} = clang ]]; then
234 # Suppress some warnings produced by clang 12 and later.
235 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
236 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100237
238 - name: Build
239 if: (!contains(matrix.extra, 'unittests'))
240 run: |
241 make ${SHADOWOPT} -j${NPROC}
242
243 - name: Check version
244 if: (!contains(matrix.extra, 'unittests'))
245 run: |
246 "${SRCDIR}"/vim --version
247 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
248 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
249
250 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200251 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100252 run: |
253 do_test() { sg audio "sg $(id -gn) '$*'"; }
254 do_test make ${SHADOWOPT} ${TEST}
255
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200256 - name: Vim tags
257 if: contains(matrix.extra, 'vimtags')
258 run: |
259 # This will exit with an error code if the generated vim tags differs from source.
260 git diff --exit-code -- runtime/doc/tags
261
ichizok0d47ad42022-01-11 13:05:26 +0000262 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000263 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100264 run: |
265 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000266 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
267
268 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100269 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000270 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000271 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000272 with:
ichizok41ee5b12022-02-12 10:13:13 +0000273 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100274
275 - name: ASan logs
276 if: contains(matrix.extra, 'asan') && !cancelled()
277 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000278 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000279 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100280 false # in order to fail a job
281 done
282
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100283 macos:
284 runs-on: macos-latest
285
286 env:
ichizok48c01962021-12-11 17:34:19 +0000287 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100288 TEST: test
289 SRCDIR: ./src
290 LEAK_CFLAGS: -DEXITFREE
291 TERM: xterm
292
293 strategy:
294 fail-fast: false
295 matrix:
ichizok48c01962021-12-11 17:34:19 +0000296 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100297
298 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100299 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200300 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100301
302 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000303 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100304 run: |
305 brew install lua
306 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
307
308 - name: Set up environment
309 run: |
310 (
311 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
312 case "${{ matrix.features }}" in
313 tiny)
314 echo "TEST=testtiny"
315 echo "CONFOPT=--disable-gui"
316 ;;
ichizok48c01962021-12-11 17:34:19 +0000317 normal)
318 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100319 huge)
Philip Hd094e582022-10-16 14:53:34 +0100320 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100321 ;;
322 esac
323 ) >> $GITHUB_ENV
324
325 - name: Configure
326 run: |
327 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
328 # Append various warning flags to CFLAGS.
329 # BSD sed needs backup extension specified.
330 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
331 # On macOS, the entity of gcc is clang.
332 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000333 # Suppress some warnings produced by clang 12 and later.
334 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
335 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
336 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100337
338 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100339 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100340 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100341 run: |
342 make -j${NPROC}
343
344 - name: Check version
345 run: |
346 "${SRCDIR}"/vim --version
347 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
348 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
349
350 - name: Test
351 timeout-minutes: 20
352 run: |
353 make ${TEST}
354
355 windows:
Philip H361f9d22022-06-14 11:35:21 +0100356 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100357
358 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100359 # Interfaces
360 # Lua
361 LUA_VER: 54
362 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000363 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100364 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
365 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
366 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100367 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
368 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100369 # Python 2
370 PYTHON_VER: 27
371 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100372 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100373 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000374 PYTHON3_VER: 311
375 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100376 # Other dependencies
377 # winpty
378 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100379 # libsodium
380 SODIUM_VER: '1.0.18'
381 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
382 SODIUM_MSVC_VER: v143
383 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
384 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100385 # Escape sequences
386 COL_RED: "\x1b[31m"
387 COL_GREEN: "\x1b[32m"
388 COL_YELLOW: "\x1b[33m"
389 COL_RESET: "\x1b[m"
390
391 strategy:
392 fail-fast: false
393 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100394 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200395 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
396 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100397 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
398 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
399 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
400 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
401 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
402 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100403
404 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200405 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100406 id: init
407 shell: bash
408 run: |
K.Takata80613d62022-11-09 16:12:47 +0000409 # Show Windows version
410 cmd /c ver
411
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100412 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100413
ichizok2f147162023-04-26 15:43:39 +0100414 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100415 cygreg=registry
416 pyreg=
417 echo "VCARCH=amd64" >> $GITHUB_ENV
418 echo "WARCH=x64" >> $GITHUB_ENV
419 echo "BITS=64" >> $GITHUB_ENV
420 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100421 else
K.Takata2da11a42022-09-10 13:03:12 +0100422 cygreg=registry32
423 pyreg=-32
424 echo "VCARCH=x86" >> $GITHUB_ENV
425 echo "WARCH=ia32" >> $GITHUB_ENV
426 echo "BITS=32" >> $GITHUB_ENV
427 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100428 fi
K.Takata2da11a42022-09-10 13:03:12 +0100429
430 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100431 if ${{ matrix.features != 'TINY' }}; then
432 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000433 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100434 else
K.Takata80613d62022-11-09 16:12:47 +0000435 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100436 fi
437 fi
438 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100439 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
440
ichizok2f147162023-04-26 15:43:39 +0100441 if ${{ matrix.toolchain == 'msvc' }}; then
442 SODIUM_DIR=D:\\libsodium
443 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
444 else
445 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
446 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
447 fi
448 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
449
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100450 - uses: msys2/setup-msys2@v2
451 if: matrix.toolchain == 'mingw'
452 with:
Philip H361f9d22022-06-14 11:35:21 +0100453 update: true
454 install: tar
455 pacboy: >-
456 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100457 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100458 release: false
459
Philip Hbfaa24f2022-06-01 21:26:34 +0100460 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200461 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100462
463 - name: Create a list of download URLs
464 shell: cmd
465 run: |
466 type NUL > urls.txt
467 echo %LUA_RELEASE%>> urls.txt
468 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100469 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100470
471 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100472 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100473 with:
474 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100475 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100476
477 - name: Download dependencies
478 shell: cmd
479 run: |
480 path C:\Program Files\7-Zip;%path%
481 if not exist downloads mkdir downloads
482
483 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100484 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100485 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
486
487 echo %COL_GREEN%Download winpty%COL_RESET%
488 call :downloadfile %WINPTY_URL% downloads\winpty.zip
489 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100490 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
491 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100492
ichizok2f147162023-04-26 15:43:39 +0100493 echo %COL_GREEN%Download libsodium%COL_RESET%
494 if "${{ matrix.toolchain }}"=="msvc" (
495 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
496 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
497 ) else (
498 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
499 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
500 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
501 )
502
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100503 goto :eof
504
505 :downloadfile
506 :: call :downloadfile <URL> <localfile>
507 if not exist %2 (
508 curl -f -L %1 -o %2
509 )
510 if ERRORLEVEL 1 (
511 rem Retry once.
512 curl -f -L %1 -o %2 || exit 1
513 )
514 goto :eof
515
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100516 - name: Build (MSVC)
517 if: matrix.toolchain == 'msvc'
518 shell: cmd
519 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100520 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100521 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100522 if "${{ matrix.VIMDLL }}"=="yes" (
523 set GUI=yes
524 ) else (
525 set GUI=${{ matrix.GUI }}
526 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200527 if "${{ matrix.python3 }}"=="stable" (
528 set PYTHON3_STABLE=yes
529 ) else (
530 set PYTHON3_STABLE=no
531 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100532 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000533 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100534 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100535 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100536 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
537 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100538 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200539 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100540 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100541 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000542 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100543 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100544 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100545 )
546
547 - name: Build (MinGW)
548 if: matrix.toolchain == 'mingw'
549 shell: msys2 {0}
550 run: |
551 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100552 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
553 GUI=yes
554 else
555 GUI=${{ matrix.GUI }}
556 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200557 if [ "${{ matrix.python3 }}" = "stable" ]; then
558 PYTHON3_STABLE=yes
559 else
560 PYTHON3_STABLE=no
561 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100562 if [ "${{ matrix.features }}" = "HUGE" ]; then
563 mingw32-make -f Make_ming.mak -j2 \
564 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100565 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100566 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100567 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
568 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200569 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100570 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000571 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100572 else
573 mingw32-make -f Make_ming.mak -j2 \
574 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100575 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100576 STATIC_STDCPLUS=yes
577 fi
578
ichizok0cd3e942022-02-14 11:36:57 +0000579 - name: Check version
580 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000581 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100582 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
583 if "${{ matrix.GUI }}"=="yes" (
584 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
585 type version.txt
586 echo.
587 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
588 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
589 type version.txt
590 del version.txt
591 ) else (
592 src\vim --version || exit 1
593 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
594 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
595 )
ichizok0cd3e942022-02-14 11:36:57 +0000596
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100597 #- name: Prepare Artifact
598 # shell: cmd
599 # run: |
600 # mkdir artifacts
601 # copy src\*vim.exe artifacts
602 # copy src\vim*.dll artifacts
603 #
604 #- name: Upload Artifact
605 # uses: actions/upload-artifact@v1
606 # with:
607 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
608 # path: ./artifacts
609
ichizok0cd3e942022-02-14 11:36:57 +0000610 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100611 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100612 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100613 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100614 run: |
ichizok2f147162023-04-26 15:43:39 +0100615 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100616 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100617
ichizok0cd3e942022-02-14 11:36:57 +0000618 echo %COL_GREEN%Test gVim:%COL_RESET%
619 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100620 if "${{ matrix.GUI }}"=="yes" (
621 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
622 ) else (
623 @rem Run only tiny tests.
624 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100625 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100626
K.Takata2da11a42022-09-10 13:03:12 +0100627 - name: Test and show the result of testing Vim
628 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
629 shell: cmd
630 timeout-minutes: 15
631 run: |
ichizok2f147162023-04-26 15:43:39 +0100632 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100633 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000634
K.Takata2da11a42022-09-10 13:03:12 +0100635 echo %COL_GREEN%Test Vim:%COL_RESET%
636 cd src\testdir
637 nmake -nologo -f Make_mvc.mak clean
638 if "${{ matrix.GUI }}"=="no" (
639 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
640 ) else (
641 @rem Run only tiny tests.
642 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100643 )
ichizok41ee5b12022-02-12 10:13:13 +0000644
645 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000646 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000647 shell: msys2 {0}
648 run: |
649 cd src
650 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000651
K.Takata2da11a42022-09-10 13:03:12 +0100652 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100653 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000654 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000655 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000656 with:
657 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000658 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}