blob: 459d5932d7b26f8773d9f8a7d05473fe454d9279 [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
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020054 compiler: clang
55 extra: none
56 interface: dynamic
57 python3: stable-abi
58 - features: huge
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010059 compiler: gcc
60 coverage: true
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020061 interface: dynamic
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010062 extra: testgui
James McCoy2e258bd2021-10-05 19:44:04 +010063 uchar: true
Christian Brabandt6efb1982023-08-10 05:44:25 +020064 luaver: lua5.4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010065 - features: huge
66 compiler: clang
67 extra: asan
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
70 luaver: lua5.1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010071 - features: huge
72 compiler: gcc
73 coverage: true
74 extra: unittests
Christian Brabandt6efb1982023-08-10 05:44:25 +020075 luaver: lua5.4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010076 - features: normal
77 compiler: gcc
78 extra: vimtags
79
80 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010081 - name: Checkout repository from github
82 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010083
84 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010085 run: |
ichizok10504762022-01-15 13:37:14 +000086 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010087 gettext \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010088 libgtk2.0-dev \
89 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020090 libtool-bin \
ichizok10504762022-01-15 13:37:14 +000091 )
92 if ${{ matrix.features == 'huge' }}; then
93 PKGS+=( \
94 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +020095 gdb \
ichizok10504762022-01-15 13:37:14 +000096 lcov \
97 libcanberra-dev \
98 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +010099 python2-dev \
ichizok10504762022-01-15 13:37:14 +0000100 python3-dev \
Christian Brabandt6efb1982023-08-10 05:44:25 +0200101 lib${{ matrix.luaver }}-dev \
102 ${{ matrix.luaver }} \
ichizok10504762022-01-15 13:37:14 +0000103 ruby-dev \
104 tcl-dev \
105 cscope \
106 libsodium-dev \
107 )
108 fi
ichizok01722702023-04-21 17:46:57 +0100109 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100110
Philip H9be736f2023-04-21 19:51:22 +0100111 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100112 if: matrix.compiler == 'gcc'
113 run: |
Philip H7268e532023-05-16 20:11:02 +0100114 sudo apt-get install -y gcc-${{ env.GCC_VER }}
115 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
116 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100117
Philip H9be736f2023-04-21 19:51:22 +0100118 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100119 if: matrix.compiler == 'clang'
120 run: |
121 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
122 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100123 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
124 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
125 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
126 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
127 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
128 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 +0100129
130 - name: Set up environment
131 run: |
132 mkdir -p "${LOG_DIR}"
133 mkdir -p "${HOME}/bin"
134 echo "${HOME}/bin" >> $GITHUB_PATH
135 (
136 echo "LINUX_VERSION=$(uname -r)"
137 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100138 echo "TMPDIR=${{ runner.temp }}"
139
140 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100141 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100142 echo "TEST=testtiny"
143 if ${{ contains(matrix.extra, 'nogui') }}; then
144 echo "CONFOPT=--disable-gui"
145 fi
146 ;;
147 normal)
148 ;;
149 huge)
150 echo "TEST=scripttests test_libvterm"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200151 if ${{ matrix.interface == 'dynamic' }}; then
152 if ${{ matrix.python3 == 'stable-abi' }}; then
153 PYTHON3_FLAGS="--with-python3-stable-abi=3.8"
154 else
155 PYTHON3_FLAGS=""
156 fi
157 echo "CONFOPT=--enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --enable-luainterp=dynamic --enable-tclinterp=dynamic ${PYTHON3_FLAGS}"
158 else
159 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
160 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100161 ;;
162 esac
163
164 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100165 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100166 echo "LDFLAGS=--coverage"
167 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100168 if ${{ matrix.uchar == true }}; then
169 CFLAGS="$CFLAGS -funsigned-char"
170 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100171 if ${{ contains(matrix.extra, 'testgui') }}; then
172 echo "TEST=-C src testgui"
173 fi
174 if ${{ contains(matrix.extra, 'unittests') }}; then
175 echo "TEST=unittests"
176 fi
177 if ${{ contains(matrix.extra, 'asan') }}; then
178 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
179 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
180 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
181 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
182 fi
183 if ${{ contains(matrix.extra, 'vimtags') }}; then
184 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
185 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100186 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100187 ) >> $GITHUB_ENV
188
189 - name: Set up system
190 run: |
191 if [[ ${CC} = clang ]]; then
192 # Use llvm-cov instead of gcov when compiler is clang.
193 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
194 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100195 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
196 sudo usermod -a -G audio "${USER}"
197 sudo bash ci/setup-xvfb.sh
198
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200199 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200200 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100201 env:
202 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200203 uses: tecolicom/actions-use-apt-tools@main
204 with:
205 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
206 path: "${DEST_DIR}"
207
208 - name: modprobe snd-dummy
209 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100210 run: |
Philip He741f032023-05-11 15:22:58 +0100211 sudo depmod --verbose
Philip Hd2af6c62023-08-17 23:45:08 +0200212 sudo modprobe --verbose snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100213
214 - name: Check autoconf
215 if: contains(matrix.extra, 'unittests')
216 run: |
217 make -C src autoconf
218
219 - name: Set up shadow dir
220 if: matrix.shadow
221 run: |
222 make -C src shadow
223 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
224 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
225
226 - name: Configure
227 run: |
228 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
229 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100230 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
231 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000232 if [[ ${CC} = clang ]]; then
233 # Suppress some warnings produced by clang 12 and later.
234 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
235 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100236
237 - name: Build
238 if: (!contains(matrix.extra, 'unittests'))
239 run: |
240 make ${SHADOWOPT} -j${NPROC}
241
242 - name: Check version
243 if: (!contains(matrix.extra, 'unittests'))
244 run: |
245 "${SRCDIR}"/vim --version
246 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
247 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
248
249 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200250 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100251 run: |
252 do_test() { sg audio "sg $(id -gn) '$*'"; }
253 do_test make ${SHADOWOPT} ${TEST}
254
ichizok0d47ad42022-01-11 13:05:26 +0000255 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000256 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100257 run: |
258 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000259 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
260
261 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100262 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000263 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000264 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000265 with:
ichizok41ee5b12022-02-12 10:13:13 +0000266 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100267
268 - name: ASan logs
269 if: contains(matrix.extra, 'asan') && !cancelled()
270 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000271 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000272 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100273 false # in order to fail a job
274 done
275
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100276 macos:
277 runs-on: macos-latest
278
279 env:
ichizok48c01962021-12-11 17:34:19 +0000280 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100281 TEST: test
282 SRCDIR: ./src
283 LEAK_CFLAGS: -DEXITFREE
284 TERM: xterm
285
286 strategy:
287 fail-fast: false
288 matrix:
ichizok48c01962021-12-11 17:34:19 +0000289 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100290
291 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100292 - name: Checkout repository from github
293 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100294
295 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000296 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100297 run: |
298 brew install lua
299 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
300
301 - name: Set up environment
302 run: |
303 (
304 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
305 case "${{ matrix.features }}" in
306 tiny)
307 echo "TEST=testtiny"
308 echo "CONFOPT=--disable-gui"
309 ;;
ichizok48c01962021-12-11 17:34:19 +0000310 normal)
311 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100312 huge)
Philip Hd094e582022-10-16 14:53:34 +0100313 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100314 ;;
315 esac
316 ) >> $GITHUB_ENV
317
318 - name: Configure
319 run: |
320 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
321 # Append various warning flags to CFLAGS.
322 # BSD sed needs backup extension specified.
323 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
324 # On macOS, the entity of gcc is clang.
325 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000326 # Suppress some warnings produced by clang 12 and later.
327 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
328 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
329 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100330
331 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100332 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100333 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100334 run: |
335 make -j${NPROC}
336
337 - name: Check version
338 run: |
339 "${SRCDIR}"/vim --version
340 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
341 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
342
343 - name: Test
344 timeout-minutes: 20
345 run: |
346 make ${TEST}
347
348 windows:
Philip H361f9d22022-06-14 11:35:21 +0100349 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100350
351 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100352 # Interfaces
353 # Lua
354 LUA_VER: 54
355 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000356 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100357 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
358 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
359 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100360 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
361 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100362 # Python 2
363 PYTHON_VER: 27
364 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100365 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100366 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000367 PYTHON3_VER: 311
368 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100369 # Other dependencies
370 # winpty
371 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100372 # libsodium
373 SODIUM_VER: '1.0.18'
374 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
375 SODIUM_MSVC_VER: v143
376 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
377 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100378 # Escape sequences
379 COL_RED: "\x1b[31m"
380 COL_GREEN: "\x1b[32m"
381 COL_YELLOW: "\x1b[33m"
382 COL_RESET: "\x1b[m"
383
384 strategy:
385 fail-fast: false
386 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100387 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200388 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
389 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100390 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
391 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
392 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
393 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
394 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
395 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100396
397 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200398 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100399 id: init
400 shell: bash
401 run: |
K.Takata80613d62022-11-09 16:12:47 +0000402 # Show Windows version
403 cmd /c ver
404
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100405 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100406
ichizok2f147162023-04-26 15:43:39 +0100407 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100408 cygreg=registry
409 pyreg=
410 echo "VCARCH=amd64" >> $GITHUB_ENV
411 echo "WARCH=x64" >> $GITHUB_ENV
412 echo "BITS=64" >> $GITHUB_ENV
413 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100414 else
K.Takata2da11a42022-09-10 13:03:12 +0100415 cygreg=registry32
416 pyreg=-32
417 echo "VCARCH=x86" >> $GITHUB_ENV
418 echo "WARCH=ia32" >> $GITHUB_ENV
419 echo "BITS=32" >> $GITHUB_ENV
420 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100421 fi
K.Takata2da11a42022-09-10 13:03:12 +0100422
423 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100424 if ${{ matrix.features != 'TINY' }}; then
425 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000426 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100427 else
K.Takata80613d62022-11-09 16:12:47 +0000428 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100429 fi
430 fi
431 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100432 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
433
ichizok2f147162023-04-26 15:43:39 +0100434 if ${{ matrix.toolchain == 'msvc' }}; then
435 SODIUM_DIR=D:\\libsodium
436 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
437 else
438 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
439 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
440 fi
441 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
442
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100443 - uses: msys2/setup-msys2@v2
444 if: matrix.toolchain == 'mingw'
445 with:
Philip H361f9d22022-06-14 11:35:21 +0100446 update: true
447 install: tar
448 pacboy: >-
449 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100450 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100451 release: false
452
Philip Hbfaa24f2022-06-01 21:26:34 +0100453 - name: Checkout repository from github
454 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100455
456 - name: Create a list of download URLs
457 shell: cmd
458 run: |
459 type NUL > urls.txt
460 echo %LUA_RELEASE%>> urls.txt
461 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100462 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100463
464 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100465 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100466 with:
467 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100468 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100469
470 - name: Download dependencies
471 shell: cmd
472 run: |
473 path C:\Program Files\7-Zip;%path%
474 if not exist downloads mkdir downloads
475
476 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100477 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100478 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
479
480 echo %COL_GREEN%Download winpty%COL_RESET%
481 call :downloadfile %WINPTY_URL% downloads\winpty.zip
482 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100483 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
484 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100485
ichizok2f147162023-04-26 15:43:39 +0100486 echo %COL_GREEN%Download libsodium%COL_RESET%
487 if "${{ matrix.toolchain }}"=="msvc" (
488 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
489 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
490 ) else (
491 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
492 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
493 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
494 )
495
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100496 goto :eof
497
498 :downloadfile
499 :: call :downloadfile <URL> <localfile>
500 if not exist %2 (
501 curl -f -L %1 -o %2
502 )
503 if ERRORLEVEL 1 (
504 rem Retry once.
505 curl -f -L %1 -o %2 || exit 1
506 )
507 goto :eof
508
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100509 - name: Build (MSVC)
510 if: matrix.toolchain == 'msvc'
511 shell: cmd
512 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100513 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100514 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100515 if "${{ matrix.VIMDLL }}"=="yes" (
516 set GUI=yes
517 ) else (
518 set GUI=${{ matrix.GUI }}
519 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200520 if "${{ matrix.python3 }}"=="stable" (
521 set PYTHON3_STABLE=yes
522 ) else (
523 set PYTHON3_STABLE=no
524 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100525 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000526 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100527 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100528 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100529 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
530 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100531 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200532 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100533 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100534 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000535 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100536 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100537 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100538 )
539
540 - name: Build (MinGW)
541 if: matrix.toolchain == 'mingw'
542 shell: msys2 {0}
543 run: |
544 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100545 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
546 GUI=yes
547 else
548 GUI=${{ matrix.GUI }}
549 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200550 if [ "${{ matrix.python3 }}" = "stable" ]; then
551 PYTHON3_STABLE=yes
552 else
553 PYTHON3_STABLE=no
554 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100555 if [ "${{ matrix.features }}" = "HUGE" ]; then
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 }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100559 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100560 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
561 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200562 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100563 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000564 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100565 else
566 mingw32-make -f Make_ming.mak -j2 \
567 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100568 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100569 STATIC_STDCPLUS=yes
570 fi
571
ichizok0cd3e942022-02-14 11:36:57 +0000572 - name: Check version
573 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000574 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100575 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
576 if "${{ matrix.GUI }}"=="yes" (
577 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
578 type version.txt
579 echo.
580 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
581 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
582 type version.txt
583 del version.txt
584 ) else (
585 src\vim --version || exit 1
586 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
587 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
588 )
ichizok0cd3e942022-02-14 11:36:57 +0000589
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100590 #- name: Prepare Artifact
591 # shell: cmd
592 # run: |
593 # mkdir artifacts
594 # copy src\*vim.exe artifacts
595 # copy src\vim*.dll artifacts
596 #
597 #- name: Upload Artifact
598 # uses: actions/upload-artifact@v1
599 # with:
600 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
601 # path: ./artifacts
602
ichizok0cd3e942022-02-14 11:36:57 +0000603 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100604 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100605 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100606 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100607 run: |
ichizok2f147162023-04-26 15:43:39 +0100608 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100609 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100610
ichizok0cd3e942022-02-14 11:36:57 +0000611 echo %COL_GREEN%Test gVim:%COL_RESET%
612 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100613 if "${{ matrix.GUI }}"=="yes" (
614 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
615 ) else (
616 @rem Run only tiny tests.
617 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100618 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100619
K.Takata2da11a42022-09-10 13:03:12 +0100620 - name: Test and show the result of testing Vim
621 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
622 shell: cmd
623 timeout-minutes: 15
624 run: |
ichizok2f147162023-04-26 15:43:39 +0100625 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100626 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000627
K.Takata2da11a42022-09-10 13:03:12 +0100628 echo %COL_GREEN%Test Vim:%COL_RESET%
629 cd src\testdir
630 nmake -nologo -f Make_mvc.mak clean
631 if "${{ matrix.GUI }}"=="no" (
632 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
633 ) else (
634 @rem Run only tiny tests.
635 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100636 )
ichizok41ee5b12022-02-12 10:13:13 +0000637
638 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000639 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000640 shell: msys2 {0}
641 run: |
642 cd src
643 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000644
K.Takata2da11a42022-09-10 13:03:12 +0100645 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100646 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000647 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000648 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000649 with:
650 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000651 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}