blob: 078e12cb2587e70b922e0f2b39bb401478063844 [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 H9be736f2023-04-21 19:51:22 +010025 CLANG_VER: 16
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: [[]]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010040 include:
41 - features: tiny
42 compiler: clang
ichizok3e1e63d2023-08-29 22:16:34 +020043 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010044 - features: tiny
45 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020046 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010047 - features: normal
48 shadow: ./src/shadow
49 - features: huge
50 coverage: true
51 - features: huge
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020052 compiler: clang
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020053 interface: dynamic
54 python3: stable-abi
55 - features: huge
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010056 compiler: gcc
57 coverage: true
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020058 interface: dynamic
ichizok3e1e63d2023-08-29 22:16:34 +020059 extra: [uchar, testgui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010060 - features: huge
61 compiler: clang
Christian Brabandt6efb1982023-08-10 05:44:25 +020062 # Lua5.1 is the most widely used version (since it's what LuaJIT is
63 # compatible with), so ensure it works
ichizok3e1e63d2023-08-29 22:16:34 +020064 lua_ver: '5.1'
65 extra: [asan]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010066 - features: huge
67 compiler: gcc
68 coverage: true
ichizok3e1e63d2023-08-29 22:16:34 +020069 extra: [unittests]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010070 - features: normal
71 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020072 extra: [vimtags]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010073
74 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010075 - name: Checkout repository from github
76 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010077
78 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010079 run: |
ichizok10504762022-01-15 13:37:14 +000080 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010081 gettext \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010082 libgtk2.0-dev \
83 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020084 libtool-bin \
ichizok10504762022-01-15 13:37:14 +000085 )
86 if ${{ matrix.features == 'huge' }}; then
ichizok3e1e63d2023-08-29 22:16:34 +020087 LUA_VER=${{ matrix.lua_ver || '5.4' }}
ichizok10504762022-01-15 13:37:14 +000088 PKGS+=( \
89 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +020090 gdb \
ichizok10504762022-01-15 13:37:14 +000091 lcov \
92 libcanberra-dev \
93 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +010094 python2-dev \
ichizok10504762022-01-15 13:37:14 +000095 python3-dev \
ichizok3e1e63d2023-08-29 22:16:34 +020096 liblua${LUA_VER}-dev \
97 lua${LUA_VER} \
ichizok10504762022-01-15 13:37:14 +000098 ruby-dev \
99 tcl-dev \
100 cscope \
101 libsodium-dev \
102 )
103 fi
ichizok01722702023-04-21 17:46:57 +0100104 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100105
Philip H9be736f2023-04-21 19:51:22 +0100106 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100107 if: matrix.compiler == 'gcc'
108 run: |
Philip H7268e532023-05-16 20:11:02 +0100109 sudo apt-get install -y gcc-${{ env.GCC_VER }}
110 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
111 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100112
Philip H9be736f2023-04-21 19:51:22 +0100113 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100114 if: matrix.compiler == 'clang'
115 run: |
116 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
117 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100118 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
119 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
120 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
121 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
122 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
123 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 +0100124
125 - name: Set up environment
126 run: |
127 mkdir -p "${LOG_DIR}"
128 mkdir -p "${HOME}/bin"
129 echo "${HOME}/bin" >> $GITHUB_PATH
130 (
131 echo "LINUX_VERSION=$(uname -r)"
132 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100133 echo "TMPDIR=${{ runner.temp }}"
134
135 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100136 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100137 echo "TEST=testtiny"
138 if ${{ contains(matrix.extra, 'nogui') }}; then
139 echo "CONFOPT=--disable-gui"
140 fi
141 ;;
142 normal)
143 ;;
144 huge)
145 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200146 INTERFACE=${{ matrix.interface || 'yes' }}
147 if ${{ matrix.python3 == 'stable-abi' }}; then
148 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200149 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200150 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 +0100151 ;;
152 esac
153
154 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200155 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100156 echo "LDFLAGS=--coverage"
157 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200158 if ${{ contains(matrix.extra, 'uchar') }}; then
159 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100160 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100161 if ${{ contains(matrix.extra, 'testgui') }}; then
162 echo "TEST=-C src testgui"
163 fi
164 if ${{ contains(matrix.extra, 'unittests') }}; then
165 echo "TEST=unittests"
166 fi
167 if ${{ contains(matrix.extra, 'asan') }}; then
168 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
169 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
170 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
171 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
172 fi
173 if ${{ contains(matrix.extra, 'vimtags') }}; then
174 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
175 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200176 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100177 ) >> $GITHUB_ENV
178
179 - name: Set up system
180 run: |
181 if [[ ${CC} = clang ]]; then
182 # Use llvm-cov instead of gcov when compiler is clang.
183 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
184 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100185 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
186 sudo usermod -a -G audio "${USER}"
187 sudo bash ci/setup-xvfb.sh
188
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200189 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200190 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100191 env:
192 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200193 uses: tecolicom/actions-use-apt-tools@main
194 with:
195 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
196 path: "${DEST_DIR}"
197
198 - name: modprobe snd-dummy
199 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100200 run: |
Philip He741f032023-05-11 15:22:58 +0100201 sudo depmod --verbose
Philip Hd2af6c62023-08-17 23:45:08 +0200202 sudo modprobe --verbose snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100203
204 - name: Check autoconf
205 if: contains(matrix.extra, 'unittests')
206 run: |
207 make -C src autoconf
208
209 - name: Set up shadow dir
210 if: matrix.shadow
211 run: |
212 make -C src shadow
213 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
214 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
215
216 - name: Configure
217 run: |
218 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
219 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100220 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
221 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000222 if [[ ${CC} = clang ]]; then
223 # Suppress some warnings produced by clang 12 and later.
224 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
225 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100226
227 - name: Build
228 if: (!contains(matrix.extra, 'unittests'))
229 run: |
230 make ${SHADOWOPT} -j${NPROC}
231
232 - name: Check version
233 if: (!contains(matrix.extra, 'unittests'))
234 run: |
235 "${SRCDIR}"/vim --version
236 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
237 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
238
239 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200240 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100241 run: |
242 do_test() { sg audio "sg $(id -gn) '$*'"; }
243 do_test make ${SHADOWOPT} ${TEST}
244
ichizok0d47ad42022-01-11 13:05:26 +0000245 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000246 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100247 run: |
248 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000249 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
250
251 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100252 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000253 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000254 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000255 with:
ichizok41ee5b12022-02-12 10:13:13 +0000256 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100257
258 - name: ASan logs
259 if: contains(matrix.extra, 'asan') && !cancelled()
260 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000261 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000262 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100263 false # in order to fail a job
264 done
265
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100266 macos:
267 runs-on: macos-latest
268
269 env:
ichizok48c01962021-12-11 17:34:19 +0000270 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100271 TEST: test
272 SRCDIR: ./src
273 LEAK_CFLAGS: -DEXITFREE
274 TERM: xterm
275
276 strategy:
277 fail-fast: false
278 matrix:
ichizok48c01962021-12-11 17:34:19 +0000279 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100280
281 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100282 - name: Checkout repository from github
283 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100284
285 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000286 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100287 run: |
288 brew install lua
289 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
290
291 - name: Set up environment
292 run: |
293 (
294 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
295 case "${{ matrix.features }}" in
296 tiny)
297 echo "TEST=testtiny"
298 echo "CONFOPT=--disable-gui"
299 ;;
ichizok48c01962021-12-11 17:34:19 +0000300 normal)
301 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100302 huge)
Philip Hd094e582022-10-16 14:53:34 +0100303 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100304 ;;
305 esac
306 ) >> $GITHUB_ENV
307
308 - name: Configure
309 run: |
310 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
311 # Append various warning flags to CFLAGS.
312 # BSD sed needs backup extension specified.
313 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
314 # On macOS, the entity of gcc is clang.
315 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000316 # Suppress some warnings produced by clang 12 and later.
317 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
318 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
319 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100320
321 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100322 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100323 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100324 run: |
325 make -j${NPROC}
326
327 - name: Check version
328 run: |
329 "${SRCDIR}"/vim --version
330 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
331 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
332
333 - name: Test
334 timeout-minutes: 20
335 run: |
336 make ${TEST}
337
338 windows:
Philip H361f9d22022-06-14 11:35:21 +0100339 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100340
341 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100342 # Interfaces
343 # Lua
344 LUA_VER: 54
345 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000346 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100347 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
348 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
349 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100350 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
351 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100352 # Python 2
353 PYTHON_VER: 27
354 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100355 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100356 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000357 PYTHON3_VER: 311
358 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100359 # Other dependencies
360 # winpty
361 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100362 # libsodium
363 SODIUM_VER: '1.0.18'
364 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
365 SODIUM_MSVC_VER: v143
366 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
367 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100368 # Escape sequences
369 COL_RED: "\x1b[31m"
370 COL_GREEN: "\x1b[32m"
371 COL_YELLOW: "\x1b[33m"
372 COL_RESET: "\x1b[m"
373
374 strategy:
375 fail-fast: false
376 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100377 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200378 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
379 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100380 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
381 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
382 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
383 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
384 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
385 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100386
387 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200388 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100389 id: init
390 shell: bash
391 run: |
K.Takata80613d62022-11-09 16:12:47 +0000392 # Show Windows version
393 cmd /c ver
394
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100395 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100396
ichizok2f147162023-04-26 15:43:39 +0100397 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100398 cygreg=registry
399 pyreg=
400 echo "VCARCH=amd64" >> $GITHUB_ENV
401 echo "WARCH=x64" >> $GITHUB_ENV
402 echo "BITS=64" >> $GITHUB_ENV
403 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100404 else
K.Takata2da11a42022-09-10 13:03:12 +0100405 cygreg=registry32
406 pyreg=-32
407 echo "VCARCH=x86" >> $GITHUB_ENV
408 echo "WARCH=ia32" >> $GITHUB_ENV
409 echo "BITS=32" >> $GITHUB_ENV
410 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100411 fi
K.Takata2da11a42022-09-10 13:03:12 +0100412
413 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100414 if ${{ matrix.features != 'TINY' }}; then
415 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000416 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100417 else
K.Takata80613d62022-11-09 16:12:47 +0000418 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100419 fi
420 fi
421 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100422 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
423
ichizok2f147162023-04-26 15:43:39 +0100424 if ${{ matrix.toolchain == 'msvc' }}; then
425 SODIUM_DIR=D:\\libsodium
426 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
427 else
428 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
429 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
430 fi
431 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
432
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100433 - uses: msys2/setup-msys2@v2
434 if: matrix.toolchain == 'mingw'
435 with:
Philip H361f9d22022-06-14 11:35:21 +0100436 update: true
437 install: tar
438 pacboy: >-
439 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100440 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100441 release: false
442
Philip Hbfaa24f2022-06-01 21:26:34 +0100443 - name: Checkout repository from github
444 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100445
446 - name: Create a list of download URLs
447 shell: cmd
448 run: |
449 type NUL > urls.txt
450 echo %LUA_RELEASE%>> urls.txt
451 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100452 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100453
454 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100455 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100456 with:
457 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100458 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100459
460 - name: Download dependencies
461 shell: cmd
462 run: |
463 path C:\Program Files\7-Zip;%path%
464 if not exist downloads mkdir downloads
465
466 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100467 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100468 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
469
470 echo %COL_GREEN%Download winpty%COL_RESET%
471 call :downloadfile %WINPTY_URL% downloads\winpty.zip
472 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100473 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
474 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100475
ichizok2f147162023-04-26 15:43:39 +0100476 echo %COL_GREEN%Download libsodium%COL_RESET%
477 if "${{ matrix.toolchain }}"=="msvc" (
478 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
479 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
480 ) else (
481 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
482 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
483 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
484 )
485
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100486 goto :eof
487
488 :downloadfile
489 :: call :downloadfile <URL> <localfile>
490 if not exist %2 (
491 curl -f -L %1 -o %2
492 )
493 if ERRORLEVEL 1 (
494 rem Retry once.
495 curl -f -L %1 -o %2 || exit 1
496 )
497 goto :eof
498
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100499 - name: Build (MSVC)
500 if: matrix.toolchain == 'msvc'
501 shell: cmd
502 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100503 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100504 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100505 if "${{ matrix.VIMDLL }}"=="yes" (
506 set GUI=yes
507 ) else (
508 set GUI=${{ matrix.GUI }}
509 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200510 if "${{ matrix.python3 }}"=="stable" (
511 set PYTHON3_STABLE=yes
512 ) else (
513 set PYTHON3_STABLE=no
514 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100515 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000516 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100517 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100518 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100519 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
520 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100521 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200522 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100523 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100524 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000525 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100526 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100527 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100528 )
529
530 - name: Build (MinGW)
531 if: matrix.toolchain == 'mingw'
532 shell: msys2 {0}
533 run: |
534 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100535 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
536 GUI=yes
537 else
538 GUI=${{ matrix.GUI }}
539 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200540 if [ "${{ matrix.python3 }}" = "stable" ]; then
541 PYTHON3_STABLE=yes
542 else
543 PYTHON3_STABLE=no
544 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100545 if [ "${{ matrix.features }}" = "HUGE" ]; then
546 mingw32-make -f Make_ming.mak -j2 \
547 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100548 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100549 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100550 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
551 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200552 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100553 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000554 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100555 else
556 mingw32-make -f Make_ming.mak -j2 \
557 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 STATIC_STDCPLUS=yes
560 fi
561
ichizok0cd3e942022-02-14 11:36:57 +0000562 - name: Check version
563 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000564 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100565 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
566 if "${{ matrix.GUI }}"=="yes" (
567 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
568 type version.txt
569 echo.
570 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
571 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
572 type version.txt
573 del version.txt
574 ) else (
575 src\vim --version || exit 1
576 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
577 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
578 )
ichizok0cd3e942022-02-14 11:36:57 +0000579
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100580 #- name: Prepare Artifact
581 # shell: cmd
582 # run: |
583 # mkdir artifacts
584 # copy src\*vim.exe artifacts
585 # copy src\vim*.dll artifacts
586 #
587 #- name: Upload Artifact
588 # uses: actions/upload-artifact@v1
589 # with:
590 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
591 # path: ./artifacts
592
ichizok0cd3e942022-02-14 11:36:57 +0000593 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100594 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100595 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100596 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100597 run: |
ichizok2f147162023-04-26 15:43:39 +0100598 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100599 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100600
ichizok0cd3e942022-02-14 11:36:57 +0000601 echo %COL_GREEN%Test gVim:%COL_RESET%
602 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100603 if "${{ matrix.GUI }}"=="yes" (
604 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
605 ) else (
606 @rem Run only tiny tests.
607 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100608 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100609
K.Takata2da11a42022-09-10 13:03:12 +0100610 - name: Test and show the result of testing Vim
611 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
612 shell: cmd
613 timeout-minutes: 15
614 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%
ichizok0cd3e942022-02-14 11:36:57 +0000617
K.Takata2da11a42022-09-10 13:03:12 +0100618 echo %COL_GREEN%Test Vim:%COL_RESET%
619 cd src\testdir
620 nmake -nologo -f Make_mvc.mak clean
621 if "${{ matrix.GUI }}"=="no" (
622 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
623 ) else (
624 @rem Run only tiny tests.
625 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100626 )
ichizok41ee5b12022-02-12 10:13:13 +0000627
628 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000629 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000630 shell: msys2 {0}
631 run: |
632 cd src
633 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000634
K.Takata2da11a42022-09-10 13:03:12 +0100635 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100636 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000637 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000638 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000639 with:
640 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000641 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}