blob: 036b36a39490d3b03cd9742bbc313666ad0b1800 [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
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200245 - name: Vim tags
246 if: contains(matrix.extra, 'vimtags')
247 run: |
248 # This will exit with an error code if the generated vim tags differs from source.
249 git diff --exit-code -- runtime/doc/tags
250
ichizok0d47ad42022-01-11 13:05:26 +0000251 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000252 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100253 run: |
254 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000255 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
256
257 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100258 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000259 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000260 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000261 with:
ichizok41ee5b12022-02-12 10:13:13 +0000262 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100263
264 - name: ASan logs
265 if: contains(matrix.extra, 'asan') && !cancelled()
266 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000267 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000268 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100269 false # in order to fail a job
270 done
271
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100272 macos:
273 runs-on: macos-latest
274
275 env:
ichizok48c01962021-12-11 17:34:19 +0000276 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100277 TEST: test
278 SRCDIR: ./src
279 LEAK_CFLAGS: -DEXITFREE
280 TERM: xterm
281
282 strategy:
283 fail-fast: false
284 matrix:
ichizok48c01962021-12-11 17:34:19 +0000285 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100286
287 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100288 - name: Checkout repository from github
289 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100290
291 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000292 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100293 run: |
294 brew install lua
295 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
296
297 - name: Set up environment
298 run: |
299 (
300 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
301 case "${{ matrix.features }}" in
302 tiny)
303 echo "TEST=testtiny"
304 echo "CONFOPT=--disable-gui"
305 ;;
ichizok48c01962021-12-11 17:34:19 +0000306 normal)
307 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100308 huge)
Philip Hd094e582022-10-16 14:53:34 +0100309 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100310 ;;
311 esac
312 ) >> $GITHUB_ENV
313
314 - name: Configure
315 run: |
316 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
317 # Append various warning flags to CFLAGS.
318 # BSD sed needs backup extension specified.
319 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
320 # On macOS, the entity of gcc is clang.
321 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000322 # Suppress some warnings produced by clang 12 and later.
323 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
324 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
325 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100326
327 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100328 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100329 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100330 run: |
331 make -j${NPROC}
332
333 - name: Check version
334 run: |
335 "${SRCDIR}"/vim --version
336 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
337 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
338
339 - name: Test
340 timeout-minutes: 20
341 run: |
342 make ${TEST}
343
344 windows:
Philip H361f9d22022-06-14 11:35:21 +0100345 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100346
347 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100348 # Interfaces
349 # Lua
350 LUA_VER: 54
351 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000352 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100353 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
354 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
355 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100356 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
357 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100358 # Python 2
359 PYTHON_VER: 27
360 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100361 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100362 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000363 PYTHON3_VER: 311
364 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100365 # Other dependencies
366 # winpty
367 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100368 # libsodium
369 SODIUM_VER: '1.0.18'
370 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
371 SODIUM_MSVC_VER: v143
372 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
373 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100374 # Escape sequences
375 COL_RED: "\x1b[31m"
376 COL_GREEN: "\x1b[32m"
377 COL_YELLOW: "\x1b[33m"
378 COL_RESET: "\x1b[m"
379
380 strategy:
381 fail-fast: false
382 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100383 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200384 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
385 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100386 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
387 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
388 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
389 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
390 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
391 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100392
393 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200394 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100395 id: init
396 shell: bash
397 run: |
K.Takata80613d62022-11-09 16:12:47 +0000398 # Show Windows version
399 cmd /c ver
400
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100401 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100402
ichizok2f147162023-04-26 15:43:39 +0100403 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100404 cygreg=registry
405 pyreg=
406 echo "VCARCH=amd64" >> $GITHUB_ENV
407 echo "WARCH=x64" >> $GITHUB_ENV
408 echo "BITS=64" >> $GITHUB_ENV
409 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100410 else
K.Takata2da11a42022-09-10 13:03:12 +0100411 cygreg=registry32
412 pyreg=-32
413 echo "VCARCH=x86" >> $GITHUB_ENV
414 echo "WARCH=ia32" >> $GITHUB_ENV
415 echo "BITS=32" >> $GITHUB_ENV
416 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100417 fi
K.Takata2da11a42022-09-10 13:03:12 +0100418
419 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100420 if ${{ matrix.features != 'TINY' }}; then
421 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000422 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100423 else
K.Takata80613d62022-11-09 16:12:47 +0000424 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100425 fi
426 fi
427 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100428 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
429
ichizok2f147162023-04-26 15:43:39 +0100430 if ${{ matrix.toolchain == 'msvc' }}; then
431 SODIUM_DIR=D:\\libsodium
432 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
433 else
434 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
435 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
436 fi
437 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
438
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100439 - uses: msys2/setup-msys2@v2
440 if: matrix.toolchain == 'mingw'
441 with:
Philip H361f9d22022-06-14 11:35:21 +0100442 update: true
443 install: tar
444 pacboy: >-
445 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100446 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100447 release: false
448
Philip Hbfaa24f2022-06-01 21:26:34 +0100449 - name: Checkout repository from github
450 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100451
452 - name: Create a list of download URLs
453 shell: cmd
454 run: |
455 type NUL > urls.txt
456 echo %LUA_RELEASE%>> urls.txt
457 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100458 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100459
460 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100461 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100462 with:
463 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100464 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100465
466 - name: Download dependencies
467 shell: cmd
468 run: |
469 path C:\Program Files\7-Zip;%path%
470 if not exist downloads mkdir downloads
471
472 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100473 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100474 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
475
476 echo %COL_GREEN%Download winpty%COL_RESET%
477 call :downloadfile %WINPTY_URL% downloads\winpty.zip
478 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100479 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
480 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100481
ichizok2f147162023-04-26 15:43:39 +0100482 echo %COL_GREEN%Download libsodium%COL_RESET%
483 if "${{ matrix.toolchain }}"=="msvc" (
484 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
485 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
486 ) else (
487 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
488 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
489 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
490 )
491
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100492 goto :eof
493
494 :downloadfile
495 :: call :downloadfile <URL> <localfile>
496 if not exist %2 (
497 curl -f -L %1 -o %2
498 )
499 if ERRORLEVEL 1 (
500 rem Retry once.
501 curl -f -L %1 -o %2 || exit 1
502 )
503 goto :eof
504
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100505 - name: Build (MSVC)
506 if: matrix.toolchain == 'msvc'
507 shell: cmd
508 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100509 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100510 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100511 if "${{ matrix.VIMDLL }}"=="yes" (
512 set GUI=yes
513 ) else (
514 set GUI=${{ matrix.GUI }}
515 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200516 if "${{ matrix.python3 }}"=="stable" (
517 set PYTHON3_STABLE=yes
518 ) else (
519 set PYTHON3_STABLE=no
520 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100521 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000522 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100523 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100524 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100525 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
526 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100527 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200528 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100529 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100530 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000531 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100532 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100533 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100534 )
535
536 - name: Build (MinGW)
537 if: matrix.toolchain == 'mingw'
538 shell: msys2 {0}
539 run: |
540 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100541 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
542 GUI=yes
543 else
544 GUI=${{ matrix.GUI }}
545 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200546 if [ "${{ matrix.python3 }}" = "stable" ]; then
547 PYTHON3_STABLE=yes
548 else
549 PYTHON3_STABLE=no
550 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100551 if [ "${{ matrix.features }}" = "HUGE" ]; then
552 mingw32-make -f Make_ming.mak -j2 \
553 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100554 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100555 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100556 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
557 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200558 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100559 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000560 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100561 else
562 mingw32-make -f Make_ming.mak -j2 \
563 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100564 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100565 STATIC_STDCPLUS=yes
566 fi
567
ichizok0cd3e942022-02-14 11:36:57 +0000568 - name: Check version
569 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000570 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100571 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
572 if "${{ matrix.GUI }}"=="yes" (
573 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
574 type version.txt
575 echo.
576 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
577 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
578 type version.txt
579 del version.txt
580 ) else (
581 src\vim --version || exit 1
582 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
583 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
584 )
ichizok0cd3e942022-02-14 11:36:57 +0000585
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100586 #- name: Prepare Artifact
587 # shell: cmd
588 # run: |
589 # mkdir artifacts
590 # copy src\*vim.exe artifacts
591 # copy src\vim*.dll artifacts
592 #
593 #- name: Upload Artifact
594 # uses: actions/upload-artifact@v1
595 # with:
596 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
597 # path: ./artifacts
598
ichizok0cd3e942022-02-14 11:36:57 +0000599 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100600 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100601 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100602 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100603 run: |
ichizok2f147162023-04-26 15:43:39 +0100604 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100605 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100606
ichizok0cd3e942022-02-14 11:36:57 +0000607 echo %COL_GREEN%Test gVim:%COL_RESET%
608 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100609 if "${{ matrix.GUI }}"=="yes" (
610 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
611 ) else (
612 @rem Run only tiny tests.
613 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100614 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100615
K.Takata2da11a42022-09-10 13:03:12 +0100616 - name: Test and show the result of testing Vim
617 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
618 shell: cmd
619 timeout-minutes: 15
620 run: |
ichizok2f147162023-04-26 15:43:39 +0100621 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100622 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000623
K.Takata2da11a42022-09-10 13:03:12 +0100624 echo %COL_GREEN%Test Vim:%COL_RESET%
625 cd src\testdir
626 nmake -nologo -f Make_mvc.mak clean
627 if "${{ matrix.GUI }}"=="no" (
628 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
629 ) else (
630 @rem Run only tiny tests.
631 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100632 )
ichizok41ee5b12022-02-12 10:13:13 +0000633
634 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000635 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000636 shell: msys2 {0}
637 run: |
638 cd src
639 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000640
K.Takata2da11a42022-09-10 13:03:12 +0100641 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100642 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000643 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000644 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000645 with:
646 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000647 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}