blob: e5715d3afe9f955b809de4e93e7dfd1d2a9e70df [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
Philip H533c3062022-08-28 19:41:36 +010029 CFLAGS: -Wno-deprecated-declarations
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010030 LOG_DIR: ${{ github.workspace }}/logs
31 TERM: xterm
32 DISPLAY: ':99'
Bram Moolenaar9aff9702020-12-21 13:37:28 +010033 DEBIAN_FRONTEND: noninteractive
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010034
35 strategy:
36 fail-fast: false
37 matrix:
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +010038 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010039 compiler: [clang, gcc]
40 extra: [none]
Christian Brabandt6efb1982023-08-10 05:44:25 +020041 luaver: [lua5.4]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010042 include:
43 - features: tiny
44 compiler: clang
45 extra: nogui
46 - features: tiny
47 compiler: gcc
48 extra: nogui
49 - features: normal
50 shadow: ./src/shadow
51 - features: huge
52 coverage: true
53 - features: huge
54 compiler: gcc
55 coverage: true
56 extra: testgui
James McCoy2e258bd2021-10-05 19:44:04 +010057 uchar: true
Christian Brabandt6efb1982023-08-10 05:44:25 +020058 luaver: lua5.4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010059 - features: huge
60 compiler: clang
61 extra: asan
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
64 luaver: lua5.1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010065 - features: huge
66 compiler: gcc
67 coverage: true
68 extra: unittests
Christian Brabandt6efb1982023-08-10 05:44:25 +020069 luaver: lua5.4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010070 - features: normal
71 compiler: gcc
72 extra: vimtags
73
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
87 PKGS+=( \
88 autoconf \
89 lcov \
90 libcanberra-dev \
91 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +010092 python2-dev \
ichizok10504762022-01-15 13:37:14 +000093 python3-dev \
Christian Brabandt6efb1982023-08-10 05:44:25 +020094 lib${{ matrix.luaver }}-dev \
95 ${{ matrix.luaver }} \
ichizok10504762022-01-15 13:37:14 +000096 ruby-dev \
97 tcl-dev \
98 cscope \
99 libsodium-dev \
100 )
101 fi
ichizok01722702023-04-21 17:46:57 +0100102 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100103
Philip H9be736f2023-04-21 19:51:22 +0100104 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100105 if: matrix.compiler == 'gcc'
106 run: |
Philip H7268e532023-05-16 20:11:02 +0100107 sudo apt-get install -y gcc-${{ env.GCC_VER }}
108 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
109 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100110
Philip H9be736f2023-04-21 19:51:22 +0100111 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100112 if: matrix.compiler == 'clang'
113 run: |
114 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
115 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100116 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
117 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
118 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
119 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
120 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
121 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 +0100122
123 - name: Set up environment
124 run: |
125 mkdir -p "${LOG_DIR}"
126 mkdir -p "${HOME}/bin"
127 echo "${HOME}/bin" >> $GITHUB_PATH
128 (
129 echo "LINUX_VERSION=$(uname -r)"
130 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100131 echo "TMPDIR=${{ runner.temp }}"
132
133 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100134 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100135 echo "TEST=testtiny"
136 if ${{ contains(matrix.extra, 'nogui') }}; then
137 echo "CONFOPT=--disable-gui"
138 fi
139 ;;
140 normal)
141 ;;
142 huge)
143 echo "TEST=scripttests test_libvterm"
144 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
145 ;;
146 esac
147
148 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100149 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100150 echo "LDFLAGS=--coverage"
151 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100152 if ${{ matrix.uchar == true }}; then
153 CFLAGS="$CFLAGS -funsigned-char"
154 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100155 if ${{ contains(matrix.extra, 'testgui') }}; then
156 echo "TEST=-C src testgui"
157 fi
158 if ${{ contains(matrix.extra, 'unittests') }}; then
159 echo "TEST=unittests"
160 fi
161 if ${{ contains(matrix.extra, 'asan') }}; then
162 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
163 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
164 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
165 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
166 fi
167 if ${{ contains(matrix.extra, 'vimtags') }}; then
168 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
169 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100170 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100171 ) >> $GITHUB_ENV
172
173 - name: Set up system
174 run: |
175 if [[ ${CC} = clang ]]; then
176 # Use llvm-cov instead of gcov when compiler is clang.
177 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
178 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100179 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
180 sudo usermod -a -G audio "${USER}"
181 sudo bash ci/setup-xvfb.sh
182
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200183 - name: Check if linux-modules-extra is available
184 id: check-snd-dummy
Philip He741f032023-05-11 15:22:58 +0100185 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200186 continue-on-error: true
187 run: |
188 sudo apt-get install -d -y linux-modules-extra-${{ env.LINUX_VERSION }}
189
190 - name: Set up snd-dummy
191 if: steps.check-snd-dummy.outcome == 'success' && (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100192 env:
193 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
194 run: |
195 cd /lib/modules/${{ env.LINUX_VERSION }}
Philip He741f032023-05-11 15:22:58 +0100196 sudo dpkg -x /var/cache/apt/archives/linux-modules-extra-${{ env.LINUX_VERSION }}*.deb "${DEST_DIR}"
197 tar -cvC "${DEST_DIR}"/lib/modules/${{ env.LINUX_VERSION }} kernel/sound | sudo tar -x
198 sudo depmod --verbose
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200199 sudo modprobe --verbose snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100200
201 - name: Check autoconf
202 if: contains(matrix.extra, 'unittests')
203 run: |
204 make -C src autoconf
205
206 - name: Set up shadow dir
207 if: matrix.shadow
208 run: |
209 make -C src shadow
210 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
211 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
212
213 - name: Configure
214 run: |
215 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
216 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100217 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
218 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000219 if [[ ${CC} = clang ]]; then
220 # Suppress some warnings produced by clang 12 and later.
221 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
222 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100223
224 - name: Build
225 if: (!contains(matrix.extra, 'unittests'))
226 run: |
227 make ${SHADOWOPT} -j${NPROC}
228
229 - name: Check version
230 if: (!contains(matrix.extra, 'unittests'))
231 run: |
232 "${SRCDIR}"/vim --version
233 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
234 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
235
236 - name: Test
237 timeout-minutes: 20
238 run: |
239 do_test() { sg audio "sg $(id -gn) '$*'"; }
240 do_test make ${SHADOWOPT} ${TEST}
241
ichizok0d47ad42022-01-11 13:05:26 +0000242 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000243 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100244 run: |
245 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000246 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
247
248 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100249 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000250 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000251 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000252 with:
ichizok41ee5b12022-02-12 10:13:13 +0000253 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100254
255 - name: ASan logs
256 if: contains(matrix.extra, 'asan') && !cancelled()
257 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000258 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000259 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100260 false # in order to fail a job
261 done
262
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100263 macos:
264 runs-on: macos-latest
265
266 env:
ichizok48c01962021-12-11 17:34:19 +0000267 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100268 TEST: test
269 SRCDIR: ./src
270 LEAK_CFLAGS: -DEXITFREE
271 TERM: xterm
272
273 strategy:
274 fail-fast: false
275 matrix:
ichizok48c01962021-12-11 17:34:19 +0000276 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100277
278 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100279 - name: Checkout repository from github
280 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100281
282 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000283 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100284 run: |
285 brew install lua
286 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
287
288 - name: Set up environment
289 run: |
290 (
291 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
292 case "${{ matrix.features }}" in
293 tiny)
294 echo "TEST=testtiny"
295 echo "CONFOPT=--disable-gui"
296 ;;
ichizok48c01962021-12-11 17:34:19 +0000297 normal)
298 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100299 huge)
Philip Hd094e582022-10-16 14:53:34 +0100300 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100301 ;;
302 esac
303 ) >> $GITHUB_ENV
304
305 - name: Configure
306 run: |
307 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
308 # Append various warning flags to CFLAGS.
309 # BSD sed needs backup extension specified.
310 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
311 # On macOS, the entity of gcc is clang.
312 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000313 # Suppress some warnings produced by clang 12 and later.
314 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
315 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
316 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100317
318 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100319 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100320 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100321 run: |
322 make -j${NPROC}
323
324 - name: Check version
325 run: |
326 "${SRCDIR}"/vim --version
327 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
328 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
329
330 - name: Test
331 timeout-minutes: 20
332 run: |
333 make ${TEST}
334
335 windows:
Philip H361f9d22022-06-14 11:35:21 +0100336 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100337
338 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100339 # Interfaces
340 # Lua
341 LUA_VER: 54
342 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000343 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100344 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
345 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
346 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100347 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
348 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100349 # Python 2
350 PYTHON_VER: 27
351 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100352 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100353 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000354 PYTHON3_VER: 311
355 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100356 # Other dependencies
357 # winpty
358 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100359 # libsodium
360 SODIUM_VER: '1.0.18'
361 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
362 SODIUM_MSVC_VER: v143
363 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
364 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100365 # Escape sequences
366 COL_RED: "\x1b[31m"
367 COL_GREEN: "\x1b[32m"
368 COL_YELLOW: "\x1b[33m"
369 COL_RESET: "\x1b[m"
370
371 strategy:
372 fail-fast: false
373 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100374 include:
K.Takata2da11a42022-09-10 13:03:12 +0100375 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
376 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
377 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
378 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
379 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
380 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
381 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
382 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100383
384 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200385 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100386 id: init
387 shell: bash
388 run: |
K.Takata80613d62022-11-09 16:12:47 +0000389 # Show Windows version
390 cmd /c ver
391
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100392 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100393
ichizok2f147162023-04-26 15:43:39 +0100394 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100395 cygreg=registry
396 pyreg=
397 echo "VCARCH=amd64" >> $GITHUB_ENV
398 echo "WARCH=x64" >> $GITHUB_ENV
399 echo "BITS=64" >> $GITHUB_ENV
400 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100401 else
K.Takata2da11a42022-09-10 13:03:12 +0100402 cygreg=registry32
403 pyreg=-32
404 echo "VCARCH=x86" >> $GITHUB_ENV
405 echo "WARCH=ia32" >> $GITHUB_ENV
406 echo "BITS=32" >> $GITHUB_ENV
407 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100408 fi
K.Takata2da11a42022-09-10 13:03:12 +0100409
410 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100411 if ${{ matrix.features != 'TINY' }}; then
412 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000413 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100414 else
K.Takata80613d62022-11-09 16:12:47 +0000415 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100416 fi
417 fi
418 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100419 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
420
ichizok2f147162023-04-26 15:43:39 +0100421 if ${{ matrix.toolchain == 'msvc' }}; then
422 SODIUM_DIR=D:\\libsodium
423 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
424 else
425 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
426 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
427 fi
428 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
429
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100430 - uses: msys2/setup-msys2@v2
431 if: matrix.toolchain == 'mingw'
432 with:
Philip H361f9d22022-06-14 11:35:21 +0100433 update: true
434 install: tar
435 pacboy: >-
436 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100437 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100438 release: false
439
Philip Hbfaa24f2022-06-01 21:26:34 +0100440 - name: Checkout repository from github
441 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100442
443 - name: Create a list of download URLs
444 shell: cmd
445 run: |
446 type NUL > urls.txt
447 echo %LUA_RELEASE%>> urls.txt
448 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100449 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100450
451 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100452 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100453 with:
454 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100455 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100456
457 - name: Download dependencies
458 shell: cmd
459 run: |
460 path C:\Program Files\7-Zip;%path%
461 if not exist downloads mkdir downloads
462
463 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100464 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100465 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
466
467 echo %COL_GREEN%Download winpty%COL_RESET%
468 call :downloadfile %WINPTY_URL% downloads\winpty.zip
469 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100470 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
471 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100472
ichizok2f147162023-04-26 15:43:39 +0100473 echo %COL_GREEN%Download libsodium%COL_RESET%
474 if "${{ matrix.toolchain }}"=="msvc" (
475 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
476 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
477 ) else (
478 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
479 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
480 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
481 )
482
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100483 goto :eof
484
485 :downloadfile
486 :: call :downloadfile <URL> <localfile>
487 if not exist %2 (
488 curl -f -L %1 -o %2
489 )
490 if ERRORLEVEL 1 (
491 rem Retry once.
492 curl -f -L %1 -o %2 || exit 1
493 )
494 goto :eof
495
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100496 - name: Build (MSVC)
497 if: matrix.toolchain == 'msvc'
498 shell: cmd
499 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100500 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100501 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100502 if "${{ matrix.VIMDLL }}"=="yes" (
503 set GUI=yes
504 ) else (
505 set GUI=${{ matrix.GUI }}
506 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100507 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000508 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100509 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100510 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100511 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
512 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100513 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
514 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100515 ) else (
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 )
520
521 - name: Build (MinGW)
522 if: matrix.toolchain == 'mingw'
523 shell: msys2 {0}
524 run: |
525 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100526 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
527 GUI=yes
528 else
529 GUI=${{ matrix.GUI }}
530 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100531 if [ "${{ matrix.features }}" = "HUGE" ]; then
532 mingw32-make -f Make_ming.mak -j2 \
533 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100534 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100535 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100536 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
537 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok2f147162023-04-26 15:43:39 +0100538 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000539 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100540 else
541 mingw32-make -f Make_ming.mak -j2 \
542 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100543 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100544 STATIC_STDCPLUS=yes
545 fi
546
ichizok0cd3e942022-02-14 11:36:57 +0000547 - name: Check version
548 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000549 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100550 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
551 if "${{ matrix.GUI }}"=="yes" (
552 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
553 type version.txt
554 echo.
555 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
556 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
557 type version.txt
558 del version.txt
559 ) else (
560 src\vim --version || exit 1
561 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
562 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
563 )
ichizok0cd3e942022-02-14 11:36:57 +0000564
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100565 #- name: Prepare Artifact
566 # shell: cmd
567 # run: |
568 # mkdir artifacts
569 # copy src\*vim.exe artifacts
570 # copy src\vim*.dll artifacts
571 #
572 #- name: Upload Artifact
573 # uses: actions/upload-artifact@v1
574 # with:
575 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
576 # path: ./artifacts
577
ichizok0cd3e942022-02-14 11:36:57 +0000578 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100579 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100580 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100581 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100582 run: |
ichizok2f147162023-04-26 15:43:39 +0100583 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100584 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100585
ichizok0cd3e942022-02-14 11:36:57 +0000586 echo %COL_GREEN%Test gVim:%COL_RESET%
587 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100588 if "${{ matrix.GUI }}"=="yes" (
589 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
590 ) else (
591 @rem Run only tiny tests.
592 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100593 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100594
K.Takata2da11a42022-09-10 13:03:12 +0100595 - name: Test and show the result of testing Vim
596 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
597 shell: cmd
598 timeout-minutes: 15
599 run: |
ichizok2f147162023-04-26 15:43:39 +0100600 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100601 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000602
K.Takata2da11a42022-09-10 13:03:12 +0100603 echo %COL_GREEN%Test Vim:%COL_RESET%
604 cd src\testdir
605 nmake -nologo -f Make_mvc.mak clean
606 if "${{ matrix.GUI }}"=="no" (
607 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
608 ) else (
609 @rem Run only tiny tests.
610 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100611 )
ichizok41ee5b12022-02-12 10:13:13 +0000612
613 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000614 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000615 shell: msys2 {0}
616 run: |
617 cd src
618 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000619
K.Takata2da11a42022-09-10 13:03:12 +0100620 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100621 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000622 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000623 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000624 with:
625 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000626 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}