blob: 7f789e804743438d3cc968faacdc0be674cbfc75 [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
Peter Simonyi9cc95aa2023-12-01 12:07:42 -050084 - name: Check Filelist (for packaging)
85 run: |
86 # If any files in the repository are not listed in Filelist this will
87 # exit with an error code and list the missing entries.
88 make -f ci/unlisted.make
89
James McCoya4245a12023-09-05 07:41:23 +020090 - run: sudo dpkg --add-architecture i386
91 if: matrix.architecture == 'i386'
92
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010093 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010094 run: |
ichizok10504762022-01-15 13:37:14 +000095 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010096 gettext \
James McCoya4245a12023-09-05 07:41:23 +020097 libgtk2.0-dev:${{ matrix.architecture }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010098 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020099 libtool-bin \
James McCoya4245a12023-09-05 07:41:23 +0200100 libncurses-dev:${{ matrix.architecture }} \
101 libxt-dev:${{ matrix.architecture }} \
ichizok10504762022-01-15 13:37:14 +0000102 )
103 if ${{ matrix.features == 'huge' }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200104 LUA_VER=${{ matrix.lua_ver || '5.4' }}
ichizok10504762022-01-15 13:37:14 +0000105 PKGS+=( \
106 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +0200107 gdb \
ichizok10504762022-01-15 13:37:14 +0000108 lcov \
109 libcanberra-dev \
110 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +0100111 python2-dev \
ichizok10504762022-01-15 13:37:14 +0000112 python3-dev \
ichizok3e1e63d2023-08-29 22:16:34 +0200113 liblua${LUA_VER}-dev \
114 lua${LUA_VER} \
ichizok10504762022-01-15 13:37:14 +0000115 ruby-dev \
116 tcl-dev \
117 cscope \
118 libsodium-dev \
Christian Brabandte085dfd2023-09-30 12:49:18 +0200119 attr \
120 libattr1-dev
ichizok10504762022-01-15 13:37:14 +0000121 )
122 fi
K.Takata7349c512023-12-14 15:58:48 +0900123 sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100124
Philip H9be736f2023-04-21 19:51:22 +0100125 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100126 if: matrix.compiler == 'gcc'
127 run: |
James McCoya4245a12023-09-05 07:41:23 +0200128 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ matrix.architecture }}
Philip H7268e532023-05-16 20:11:02 +0100129 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
130 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100131
Philip H9be736f2023-04-21 19:51:22 +0100132 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100133 if: matrix.compiler == 'clang'
134 run: |
135 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
136 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100137 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
138 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
139 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
140 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
141 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
142 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 +0100143
144 - name: Set up environment
145 run: |
146 mkdir -p "${LOG_DIR}"
147 mkdir -p "${HOME}/bin"
148 echo "${HOME}/bin" >> $GITHUB_PATH
149 (
150 echo "LINUX_VERSION=$(uname -r)"
151 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100152 echo "TMPDIR=${{ runner.temp }}"
153
154 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100155 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100156 echo "TEST=testtiny"
157 if ${{ contains(matrix.extra, 'nogui') }}; then
158 echo "CONFOPT=--disable-gui"
159 fi
160 ;;
161 normal)
162 ;;
163 huge)
164 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200165 INTERFACE=${{ matrix.interface || 'yes' }}
166 if ${{ matrix.python3 == 'stable-abi' }}; then
167 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200168 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200169 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 +0100170 ;;
171 esac
172
173 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200174 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100175 echo "LDFLAGS=--coverage"
176 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200177 if ${{ contains(matrix.extra, 'uchar') }}; then
178 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100179 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100180 if ${{ contains(matrix.extra, 'testgui') }}; then
181 echo "TEST=-C src testgui"
182 fi
183 if ${{ contains(matrix.extra, 'unittests') }}; then
184 echo "TEST=unittests"
185 fi
186 if ${{ contains(matrix.extra, 'asan') }}; then
187 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
188 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
189 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
190 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
191 fi
192 if ${{ contains(matrix.extra, 'vimtags') }}; then
193 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
194 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200195 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100196 ) >> $GITHUB_ENV
197
198 - name: Set up system
199 run: |
200 if [[ ${CC} = clang ]]; then
201 # Use llvm-cov instead of gcov when compiler is clang.
202 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
203 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100204 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
205 sudo usermod -a -G audio "${USER}"
206 sudo bash ci/setup-xvfb.sh
207
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200208 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200209 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100210 env:
211 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200212 uses: tecolicom/actions-use-apt-tools@main
213 with:
214 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
215 path: "${DEST_DIR}"
216
217 - name: modprobe snd-dummy
218 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100219 run: |
Philip He741f032023-05-11 15:22:58 +0100220 sudo depmod --verbose
Christian Brabandta66feb52023-09-16 18:29:42 +0200221 sudo modprobe --verbose snd-dummy || true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100222
223 - name: Check autoconf
224 if: contains(matrix.extra, 'unittests')
225 run: |
226 make -C src autoconf
227
228 - name: Set up shadow dir
229 if: matrix.shadow
230 run: |
231 make -C src shadow
232 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
233 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
234
235 - name: Configure
236 run: |
237 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
238 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100239 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
240 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000241 if [[ ${CC} = clang ]]; then
242 # Suppress some warnings produced by clang 12 and later.
243 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
244 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100245
246 - name: Build
247 if: (!contains(matrix.extra, 'unittests'))
248 run: |
249 make ${SHADOWOPT} -j${NPROC}
250
251 - name: Check version
252 if: (!contains(matrix.extra, 'unittests'))
253 run: |
254 "${SRCDIR}"/vim --version
255 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
256 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
257
258 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200259 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100260 run: |
261 do_test() { sg audio "sg $(id -gn) '$*'"; }
262 do_test make ${SHADOWOPT} ${TEST}
263
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200264 - name: Vim tags
265 if: contains(matrix.extra, 'vimtags')
266 run: |
267 # This will exit with an error code if the generated vim tags differs from source.
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000268 (
269 cd runtime/doc
270 git diff --exit-code -- tags
271 make html; rm *.html tags.ref;
272 test -f errors.log && exit 3;
Christian Brabandt9c581912024-01-15 22:38:48 +0100273 true
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000274 )
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200275
ichizok0d47ad42022-01-11 13:05:26 +0000276 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000277 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100278 run: |
279 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000280 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
281
282 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100283 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000284 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000285 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000286 with:
ichizok41ee5b12022-02-12 10:13:13 +0000287 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100288
289 - name: ASan logs
290 if: contains(matrix.extra, 'asan') && !cancelled()
291 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000292 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000293 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100294 false # in order to fail a job
295 done
296
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100297 macos:
298 runs-on: macos-latest
299
300 env:
ichizok48c01962021-12-11 17:34:19 +0000301 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100302 TEST: test
303 SRCDIR: ./src
304 LEAK_CFLAGS: -DEXITFREE
305 TERM: xterm
306
307 strategy:
308 fail-fast: false
309 matrix:
ichizok48c01962021-12-11 17:34:19 +0000310 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100311
312 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100313 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200314 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100315
316 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000317 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100318 run: |
319 brew install lua
320 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
321
322 - name: Set up environment
323 run: |
324 (
325 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
326 case "${{ matrix.features }}" in
327 tiny)
328 echo "TEST=testtiny"
329 echo "CONFOPT=--disable-gui"
330 ;;
ichizok48c01962021-12-11 17:34:19 +0000331 normal)
332 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100333 huge)
Philip Hd094e582022-10-16 14:53:34 +0100334 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100335 ;;
336 esac
337 ) >> $GITHUB_ENV
338
339 - name: Configure
340 run: |
341 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
342 # Append various warning flags to CFLAGS.
343 # BSD sed needs backup extension specified.
344 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
345 # On macOS, the entity of gcc is clang.
346 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000347 # Suppress some warnings produced by clang 12 and later.
348 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
349 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
350 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100351
352 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100353 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100354 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100355 run: |
356 make -j${NPROC}
357
358 - name: Check version
359 run: |
360 "${SRCDIR}"/vim --version
361 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
362 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
363
364 - name: Test
365 timeout-minutes: 20
366 run: |
367 make ${TEST}
368
369 windows:
Philip H361f9d22022-06-14 11:35:21 +0100370 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100371
372 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100373 # Interfaces
374 # Lua
375 LUA_VER: 54
376 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000377 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100378 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
379 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
380 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100381 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
382 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100383 # Python 2
384 PYTHON_VER: 27
385 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100386 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100387 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000388 PYTHON3_VER: 311
389 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100390 # Other dependencies
391 # winpty
392 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100393 # libsodium
394 SODIUM_VER: '1.0.18'
395 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
396 SODIUM_MSVC_VER: v143
397 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
398 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100399 # Escape sequences
400 COL_RED: "\x1b[31m"
401 COL_GREEN: "\x1b[32m"
402 COL_YELLOW: "\x1b[33m"
403 COL_RESET: "\x1b[m"
404
405 strategy:
406 fail-fast: false
407 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100408 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200409 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
410 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100411 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
412 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
413 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
414 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
415 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
416 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100417
418 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200419 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100420 id: init
421 shell: bash
422 run: |
K.Takata80613d62022-11-09 16:12:47 +0000423 # Show Windows version
424 cmd /c ver
425
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100426 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100427
ichizok2f147162023-04-26 15:43:39 +0100428 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100429 cygreg=registry
430 pyreg=
431 echo "VCARCH=amd64" >> $GITHUB_ENV
432 echo "WARCH=x64" >> $GITHUB_ENV
433 echo "BITS=64" >> $GITHUB_ENV
434 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100435 else
K.Takata2da11a42022-09-10 13:03:12 +0100436 cygreg=registry32
437 pyreg=-32
438 echo "VCARCH=x86" >> $GITHUB_ENV
439 echo "WARCH=ia32" >> $GITHUB_ENV
440 echo "BITS=32" >> $GITHUB_ENV
441 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100442 fi
K.Takata2da11a42022-09-10 13:03:12 +0100443
444 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100445 if ${{ matrix.features != 'TINY' }}; then
446 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000447 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100448 else
K.Takata80613d62022-11-09 16:12:47 +0000449 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100450 fi
451 fi
452 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100453 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
454
ichizok2f147162023-04-26 15:43:39 +0100455 if ${{ matrix.toolchain == 'msvc' }}; then
456 SODIUM_DIR=D:\\libsodium
457 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
458 else
459 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
460 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
461 fi
462 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
463
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100464 - uses: msys2/setup-msys2@v2
465 if: matrix.toolchain == 'mingw'
466 with:
Philip H361f9d22022-06-14 11:35:21 +0100467 update: true
468 install: tar
469 pacboy: >-
470 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100471 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100472 release: false
473
Philip Hbfaa24f2022-06-01 21:26:34 +0100474 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200475 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100476
477 - name: Create a list of download URLs
478 shell: cmd
479 run: |
480 type NUL > urls.txt
481 echo %LUA_RELEASE%>> urls.txt
482 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100483 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100484
485 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100486 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100487 with:
488 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100489 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100490
491 - name: Download dependencies
492 shell: cmd
493 run: |
494 path C:\Program Files\7-Zip;%path%
495 if not exist downloads mkdir downloads
496
497 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100498 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100499 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
500
501 echo %COL_GREEN%Download winpty%COL_RESET%
502 call :downloadfile %WINPTY_URL% downloads\winpty.zip
503 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100504 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
505 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100506
ichizok2f147162023-04-26 15:43:39 +0100507 echo %COL_GREEN%Download libsodium%COL_RESET%
508 if "${{ matrix.toolchain }}"=="msvc" (
509 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
510 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
511 ) else (
512 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
513 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
514 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
515 )
516
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100517 goto :eof
518
519 :downloadfile
520 :: call :downloadfile <URL> <localfile>
521 if not exist %2 (
522 curl -f -L %1 -o %2
523 )
524 if ERRORLEVEL 1 (
525 rem Retry once.
526 curl -f -L %1 -o %2 || exit 1
527 )
528 goto :eof
529
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100530 - name: Build (MSVC)
531 if: matrix.toolchain == 'msvc'
532 shell: cmd
533 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100534 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100535 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100536 if "${{ matrix.VIMDLL }}"=="yes" (
537 set GUI=yes
538 ) else (
539 set GUI=${{ matrix.GUI }}
540 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200541 if "${{ matrix.python3 }}"=="stable" (
542 set PYTHON3_STABLE=yes
543 ) else (
544 set PYTHON3_STABLE=no
545 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100546 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000547 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100548 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100549 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100550 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
551 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100552 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200553 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100554 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100555 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000556 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100557 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100558 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100559 )
560
561 - name: Build (MinGW)
562 if: matrix.toolchain == 'mingw'
563 shell: msys2 {0}
564 run: |
565 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100566 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
567 GUI=yes
568 else
569 GUI=${{ matrix.GUI }}
570 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200571 if [ "${{ matrix.python3 }}" = "stable" ]; then
572 PYTHON3_STABLE=yes
573 else
574 PYTHON3_STABLE=no
575 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100576 if [ "${{ matrix.features }}" = "HUGE" ]; then
577 mingw32-make -f Make_ming.mak -j2 \
578 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100579 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100580 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100581 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
582 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200583 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100584 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000585 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100586 else
587 mingw32-make -f Make_ming.mak -j2 \
588 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100589 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100590 STATIC_STDCPLUS=yes
591 fi
592
ichizok0cd3e942022-02-14 11:36:57 +0000593 - name: Check version
594 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000595 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100596 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
597 if "${{ matrix.GUI }}"=="yes" (
598 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
599 type version.txt
600 echo.
601 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
602 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
603 type version.txt
604 del version.txt
605 ) else (
606 src\vim --version || exit 1
607 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
608 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
609 )
ichizok0cd3e942022-02-14 11:36:57 +0000610
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100611 #- name: Prepare Artifact
612 # shell: cmd
613 # run: |
614 # mkdir artifacts
615 # copy src\*vim.exe artifacts
616 # copy src\vim*.dll artifacts
617 #
618 #- name: Upload Artifact
619 # uses: actions/upload-artifact@v1
620 # with:
621 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
622 # path: ./artifacts
623
ichizok0cd3e942022-02-14 11:36:57 +0000624 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100625 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100626 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100627 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100628 run: |
ichizok2f147162023-04-26 15:43:39 +0100629 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100630 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100631
ichizok0cd3e942022-02-14 11:36:57 +0000632 echo %COL_GREEN%Test gVim:%COL_RESET%
633 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100634 if "${{ matrix.GUI }}"=="yes" (
635 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
636 ) else (
637 @rem Run only tiny tests.
638 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100639 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100640
K.Takata2da11a42022-09-10 13:03:12 +0100641 - name: Test and show the result of testing Vim
642 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
643 shell: cmd
644 timeout-minutes: 15
645 run: |
ichizok2f147162023-04-26 15:43:39 +0100646 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100647 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000648
K.Takata2da11a42022-09-10 13:03:12 +0100649 echo %COL_GREEN%Test Vim:%COL_RESET%
650 cd src\testdir
651 nmake -nologo -f Make_mvc.mak clean
652 if "${{ matrix.GUI }}"=="no" (
653 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
654 ) else (
655 @rem Run only tiny tests.
656 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100657 )
ichizok41ee5b12022-02-12 10:13:13 +0000658
659 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000660 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000661 shell: msys2 {0}
662 run: |
663 cd src
664 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000665
K.Takata2da11a42022-09-10 13:03:12 +0100666 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100667 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000668 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000669 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000670 with:
671 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000672 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}