blob: cd1615f9f447fe7fe3a70088ae72e98b826efd37 [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 \
Christian Brabandte085dfd2023-09-30 12:49:18 +0200113 attr \
114 libattr1-dev
ichizok10504762022-01-15 13:37:14 +0000115 )
116 fi
ichizok01722702023-04-21 17:46:57 +0100117 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100118
Philip H9be736f2023-04-21 19:51:22 +0100119 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100120 if: matrix.compiler == 'gcc'
121 run: |
James McCoya4245a12023-09-05 07:41:23 +0200122 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ matrix.architecture }}
Philip H7268e532023-05-16 20:11:02 +0100123 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
124 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100125
Philip H9be736f2023-04-21 19:51:22 +0100126 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100127 if: matrix.compiler == 'clang'
128 run: |
129 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
130 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100131 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
132 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
133 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
134 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
135 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
136 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 +0100137
138 - name: Set up environment
139 run: |
140 mkdir -p "${LOG_DIR}"
141 mkdir -p "${HOME}/bin"
142 echo "${HOME}/bin" >> $GITHUB_PATH
143 (
144 echo "LINUX_VERSION=$(uname -r)"
145 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100146 echo "TMPDIR=${{ runner.temp }}"
147
148 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100149 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100150 echo "TEST=testtiny"
151 if ${{ contains(matrix.extra, 'nogui') }}; then
152 echo "CONFOPT=--disable-gui"
153 fi
154 ;;
155 normal)
156 ;;
157 huge)
158 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200159 INTERFACE=${{ matrix.interface || 'yes' }}
160 if ${{ matrix.python3 == 'stable-abi' }}; then
161 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200162 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200163 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 +0100164 ;;
165 esac
166
167 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200168 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100169 echo "LDFLAGS=--coverage"
170 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200171 if ${{ contains(matrix.extra, 'uchar') }}; then
172 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100173 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100174 if ${{ contains(matrix.extra, 'testgui') }}; then
175 echo "TEST=-C src testgui"
176 fi
177 if ${{ contains(matrix.extra, 'unittests') }}; then
178 echo "TEST=unittests"
179 fi
180 if ${{ contains(matrix.extra, 'asan') }}; then
181 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
182 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
183 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
184 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
185 fi
186 if ${{ contains(matrix.extra, 'vimtags') }}; then
187 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
188 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200189 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100190 ) >> $GITHUB_ENV
191
192 - name: Set up system
193 run: |
194 if [[ ${CC} = clang ]]; then
195 # Use llvm-cov instead of gcov when compiler is clang.
196 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
197 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100198 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
199 sudo usermod -a -G audio "${USER}"
200 sudo bash ci/setup-xvfb.sh
201
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200202 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200203 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100204 env:
205 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200206 uses: tecolicom/actions-use-apt-tools@main
207 with:
208 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
209 path: "${DEST_DIR}"
210
211 - name: modprobe snd-dummy
212 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100213 run: |
Philip He741f032023-05-11 15:22:58 +0100214 sudo depmod --verbose
Christian Brabandta66feb52023-09-16 18:29:42 +0200215 sudo modprobe --verbose snd-dummy || true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100216
217 - name: Check autoconf
218 if: contains(matrix.extra, 'unittests')
219 run: |
220 make -C src autoconf
221
222 - name: Set up shadow dir
223 if: matrix.shadow
224 run: |
225 make -C src shadow
226 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
227 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
228
229 - name: Configure
230 run: |
231 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
232 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100233 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
234 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000235 if [[ ${CC} = clang ]]; then
236 # Suppress some warnings produced by clang 12 and later.
237 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
238 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100239
240 - name: Build
241 if: (!contains(matrix.extra, 'unittests'))
242 run: |
243 make ${SHADOWOPT} -j${NPROC}
244
245 - name: Check version
246 if: (!contains(matrix.extra, 'unittests'))
247 run: |
248 "${SRCDIR}"/vim --version
249 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
250 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
251
252 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200253 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100254 run: |
255 do_test() { sg audio "sg $(id -gn) '$*'"; }
256 do_test make ${SHADOWOPT} ${TEST}
257
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200258 - name: Vim tags
259 if: contains(matrix.extra, 'vimtags')
260 run: |
261 # This will exit with an error code if the generated vim tags differs from source.
262 git diff --exit-code -- runtime/doc/tags
263
ichizok0d47ad42022-01-11 13:05:26 +0000264 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000265 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100266 run: |
267 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000268 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
269
270 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100271 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000272 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000273 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000274 with:
ichizok41ee5b12022-02-12 10:13:13 +0000275 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100276
277 - name: ASan logs
278 if: contains(matrix.extra, 'asan') && !cancelled()
279 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000280 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000281 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100282 false # in order to fail a job
283 done
284
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100285 macos:
286 runs-on: macos-latest
287
288 env:
ichizok48c01962021-12-11 17:34:19 +0000289 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100290 TEST: test
291 SRCDIR: ./src
292 LEAK_CFLAGS: -DEXITFREE
293 TERM: xterm
294
295 strategy:
296 fail-fast: false
297 matrix:
ichizok48c01962021-12-11 17:34:19 +0000298 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100299
300 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100301 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200302 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100303
304 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000305 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100306 run: |
307 brew install lua
308 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
309
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
ichizok2f147162023-04-26 15:43:39 +0100381 # libsodium
382 SODIUM_VER: '1.0.18'
383 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
384 SODIUM_MSVC_VER: v143
385 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
386 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100387 # Escape sequences
388 COL_RED: "\x1b[31m"
389 COL_GREEN: "\x1b[32m"
390 COL_YELLOW: "\x1b[33m"
391 COL_RESET: "\x1b[m"
392
393 strategy:
394 fail-fast: false
395 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100396 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200397 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
398 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100399 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
400 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
401 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
402 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
403 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
404 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100405
406 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200407 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100408 id: init
409 shell: bash
410 run: |
K.Takata80613d62022-11-09 16:12:47 +0000411 # Show Windows version
412 cmd /c ver
413
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100414 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100415
ichizok2f147162023-04-26 15:43:39 +0100416 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100417 cygreg=registry
418 pyreg=
419 echo "VCARCH=amd64" >> $GITHUB_ENV
420 echo "WARCH=x64" >> $GITHUB_ENV
421 echo "BITS=64" >> $GITHUB_ENV
422 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100423 else
K.Takata2da11a42022-09-10 13:03:12 +0100424 cygreg=registry32
425 pyreg=-32
426 echo "VCARCH=x86" >> $GITHUB_ENV
427 echo "WARCH=ia32" >> $GITHUB_ENV
428 echo "BITS=32" >> $GITHUB_ENV
429 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100430 fi
K.Takata2da11a42022-09-10 13:03:12 +0100431
432 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100433 if ${{ matrix.features != 'TINY' }}; then
434 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000435 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100436 else
K.Takata80613d62022-11-09 16:12:47 +0000437 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100438 fi
439 fi
440 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100441 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
442
ichizok2f147162023-04-26 15:43:39 +0100443 if ${{ matrix.toolchain == 'msvc' }}; then
444 SODIUM_DIR=D:\\libsodium
445 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
446 else
447 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
448 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
449 fi
450 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
451
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100452 - uses: msys2/setup-msys2@v2
453 if: matrix.toolchain == 'mingw'
454 with:
Philip H361f9d22022-06-14 11:35:21 +0100455 update: true
456 install: tar
457 pacboy: >-
458 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100459 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100460 release: false
461
Philip Hbfaa24f2022-06-01 21:26:34 +0100462 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200463 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100464
465 - name: Create a list of download URLs
466 shell: cmd
467 run: |
468 type NUL > urls.txt
469 echo %LUA_RELEASE%>> urls.txt
470 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100471 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100472
473 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100474 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100475 with:
476 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100477 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100478
479 - name: Download dependencies
480 shell: cmd
481 run: |
482 path C:\Program Files\7-Zip;%path%
483 if not exist downloads mkdir downloads
484
485 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100486 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100487 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
488
489 echo %COL_GREEN%Download winpty%COL_RESET%
490 call :downloadfile %WINPTY_URL% downloads\winpty.zip
491 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100492 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
493 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100494
ichizok2f147162023-04-26 15:43:39 +0100495 echo %COL_GREEN%Download libsodium%COL_RESET%
496 if "${{ matrix.toolchain }}"=="msvc" (
497 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
498 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
499 ) else (
500 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
501 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
502 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
503 )
504
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100505 goto :eof
506
507 :downloadfile
508 :: call :downloadfile <URL> <localfile>
509 if not exist %2 (
510 curl -f -L %1 -o %2
511 )
512 if ERRORLEVEL 1 (
513 rem Retry once.
514 curl -f -L %1 -o %2 || exit 1
515 )
516 goto :eof
517
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100518 - name: Build (MSVC)
519 if: matrix.toolchain == 'msvc'
520 shell: cmd
521 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100522 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100523 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100524 if "${{ matrix.VIMDLL }}"=="yes" (
525 set GUI=yes
526 ) else (
527 set GUI=${{ matrix.GUI }}
528 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200529 if "${{ matrix.python3 }}"=="stable" (
530 set PYTHON3_STABLE=yes
531 ) else (
532 set PYTHON3_STABLE=no
533 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100534 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000535 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100536 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 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
539 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100540 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200541 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100542 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100543 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000544 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100545 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100546 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100547 )
548
549 - name: Build (MinGW)
550 if: matrix.toolchain == 'mingw'
551 shell: msys2 {0}
552 run: |
553 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100554 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
555 GUI=yes
556 else
557 GUI=${{ matrix.GUI }}
558 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200559 if [ "${{ matrix.python3 }}" = "stable" ]; then
560 PYTHON3_STABLE=yes
561 else
562 PYTHON3_STABLE=no
563 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100564 if [ "${{ matrix.features }}" = "HUGE" ]; then
565 mingw32-make -f Make_ming.mak -j2 \
566 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100567 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100568 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100569 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
570 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200571 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100572 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000573 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100574 else
575 mingw32-make -f Make_ming.mak -j2 \
576 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100577 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100578 STATIC_STDCPLUS=yes
579 fi
580
ichizok0cd3e942022-02-14 11:36:57 +0000581 - name: Check version
582 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000583 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100584 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
585 if "${{ matrix.GUI }}"=="yes" (
586 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
587 type version.txt
588 echo.
589 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
590 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
591 type version.txt
592 del version.txt
593 ) else (
594 src\vim --version || exit 1
595 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
596 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
597 )
ichizok0cd3e942022-02-14 11:36:57 +0000598
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100599 #- name: Prepare Artifact
600 # shell: cmd
601 # run: |
602 # mkdir artifacts
603 # copy src\*vim.exe artifacts
604 # copy src\vim*.dll artifacts
605 #
606 #- name: Upload Artifact
607 # uses: actions/upload-artifact@v1
608 # with:
609 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
610 # path: ./artifacts
611
ichizok0cd3e942022-02-14 11:36:57 +0000612 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100613 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100614 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100615 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100616 run: |
ichizok2f147162023-04-26 15:43:39 +0100617 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100618 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100619
ichizok0cd3e942022-02-14 11:36:57 +0000620 echo %COL_GREEN%Test gVim:%COL_RESET%
621 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100622 if "${{ matrix.GUI }}"=="yes" (
623 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
624 ) else (
625 @rem Run only tiny tests.
626 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100627 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100628
K.Takata2da11a42022-09-10 13:03:12 +0100629 - name: Test and show the result of testing Vim
630 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
631 shell: cmd
632 timeout-minutes: 15
633 run: |
ichizok2f147162023-04-26 15:43:39 +0100634 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100635 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000636
K.Takata2da11a42022-09-10 13:03:12 +0100637 echo %COL_GREEN%Test Vim:%COL_RESET%
638 cd src\testdir
639 nmake -nologo -f Make_mvc.mak clean
640 if "${{ matrix.GUI }}"=="no" (
641 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
642 ) else (
643 @rem Run only tiny tests.
644 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100645 )
ichizok41ee5b12022-02-12 10:13:13 +0000646
647 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000648 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000649 shell: msys2 {0}
650 run: |
651 cd src
652 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000653
K.Takata2da11a42022-09-10 13:03:12 +0100654 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100655 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000656 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000657 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000658 with:
659 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000660 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}