blob: 98bff17d4250fb09cad2e49be0648059c17d7e73 [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 \
95 lcov \
96 libcanberra-dev \
97 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +010098 python2-dev \
ichizok10504762022-01-15 13:37:14 +000099 python3-dev \
Christian Brabandt6efb1982023-08-10 05:44:25 +0200100 lib${{ matrix.luaver }}-dev \
101 ${{ matrix.luaver }} \
ichizok10504762022-01-15 13:37:14 +0000102 ruby-dev \
103 tcl-dev \
104 cscope \
105 libsodium-dev \
106 )
107 fi
ichizok01722702023-04-21 17:46:57 +0100108 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100109
Philip H9be736f2023-04-21 19:51:22 +0100110 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100111 if: matrix.compiler == 'gcc'
112 run: |
Philip H7268e532023-05-16 20:11:02 +0100113 sudo apt-get install -y gcc-${{ env.GCC_VER }}
114 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
115 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100116
Philip H9be736f2023-04-21 19:51:22 +0100117 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100118 if: matrix.compiler == 'clang'
119 run: |
120 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
121 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100122 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
123 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
124 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
125 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
126 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
127 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 +0100128
129 - name: Set up environment
130 run: |
131 mkdir -p "${LOG_DIR}"
132 mkdir -p "${HOME}/bin"
133 echo "${HOME}/bin" >> $GITHUB_PATH
134 (
135 echo "LINUX_VERSION=$(uname -r)"
136 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100137 echo "TMPDIR=${{ runner.temp }}"
138
139 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100140 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100141 echo "TEST=testtiny"
142 if ${{ contains(matrix.extra, 'nogui') }}; then
143 echo "CONFOPT=--disable-gui"
144 fi
145 ;;
146 normal)
147 ;;
148 huge)
149 echo "TEST=scripttests test_libvterm"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200150 if ${{ matrix.interface == 'dynamic' }}; then
151 if ${{ matrix.python3 == 'stable-abi' }}; then
152 PYTHON3_FLAGS="--with-python3-stable-abi=3.8"
153 else
154 PYTHON3_FLAGS=""
155 fi
156 echo "CONFOPT=--enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --enable-luainterp=dynamic --enable-tclinterp=dynamic ${PYTHON3_FLAGS}"
157 else
158 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
159 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100160 ;;
161 esac
162
163 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100164 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100165 echo "LDFLAGS=--coverage"
166 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100167 if ${{ matrix.uchar == true }}; then
168 CFLAGS="$CFLAGS -funsigned-char"
169 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100170 if ${{ contains(matrix.extra, 'testgui') }}; then
171 echo "TEST=-C src testgui"
172 fi
173 if ${{ contains(matrix.extra, 'unittests') }}; then
174 echo "TEST=unittests"
175 fi
176 if ${{ contains(matrix.extra, 'asan') }}; then
177 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
178 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
179 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
180 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
181 fi
182 if ${{ contains(matrix.extra, 'vimtags') }}; then
183 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
184 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100185 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100186 ) >> $GITHUB_ENV
187
188 - name: Set up system
189 run: |
190 if [[ ${CC} = clang ]]; then
191 # Use llvm-cov instead of gcov when compiler is clang.
192 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
193 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100194 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
195 sudo usermod -a -G audio "${USER}"
196 sudo bash ci/setup-xvfb.sh
197
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200198 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200199 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100200 env:
201 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200202 uses: tecolicom/actions-use-apt-tools@main
203 with:
204 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
205 path: "${DEST_DIR}"
206
207 - name: modprobe snd-dummy
208 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100209 run: |
Philip He741f032023-05-11 15:22:58 +0100210 sudo depmod --verbose
Philip Hd2af6c62023-08-17 23:45:08 +0200211 sudo modprobe --verbose snd-dummy
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100212
213 - name: Check autoconf
214 if: contains(matrix.extra, 'unittests')
215 run: |
216 make -C src autoconf
217
218 - name: Set up shadow dir
219 if: matrix.shadow
220 run: |
221 make -C src shadow
222 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
223 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
224
225 - name: Configure
226 run: |
227 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
228 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100229 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
230 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000231 if [[ ${CC} = clang ]]; then
232 # Suppress some warnings produced by clang 12 and later.
233 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
234 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100235
236 - name: Build
237 if: (!contains(matrix.extra, 'unittests'))
238 run: |
239 make ${SHADOWOPT} -j${NPROC}
240
241 - name: Check version
242 if: (!contains(matrix.extra, 'unittests'))
243 run: |
244 "${SRCDIR}"/vim --version
245 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
246 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
247
248 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200249 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100250 run: |
251 do_test() { sg audio "sg $(id -gn) '$*'"; }
252 do_test make ${SHADOWOPT} ${TEST}
253
ichizok0d47ad42022-01-11 13:05:26 +0000254 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000255 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100256 run: |
257 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000258 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
259
260 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100261 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000262 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000263 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000264 with:
ichizok41ee5b12022-02-12 10:13:13 +0000265 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100266
267 - name: ASan logs
268 if: contains(matrix.extra, 'asan') && !cancelled()
269 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000270 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000271 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100272 false # in order to fail a job
273 done
274
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100275 macos:
276 runs-on: macos-latest
277
278 env:
ichizok48c01962021-12-11 17:34:19 +0000279 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100280 TEST: test
281 SRCDIR: ./src
282 LEAK_CFLAGS: -DEXITFREE
283 TERM: xterm
284
285 strategy:
286 fail-fast: false
287 matrix:
ichizok48c01962021-12-11 17:34:19 +0000288 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100289
290 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100291 - name: Checkout repository from github
292 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100293
294 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000295 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100296 run: |
297 brew install lua
298 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
299
300 - name: Set up environment
301 run: |
302 (
303 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
304 case "${{ matrix.features }}" in
305 tiny)
306 echo "TEST=testtiny"
307 echo "CONFOPT=--disable-gui"
308 ;;
ichizok48c01962021-12-11 17:34:19 +0000309 normal)
310 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100311 huge)
Philip Hd094e582022-10-16 14:53:34 +0100312 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100313 ;;
314 esac
315 ) >> $GITHUB_ENV
316
317 - name: Configure
318 run: |
319 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
320 # Append various warning flags to CFLAGS.
321 # BSD sed needs backup extension specified.
322 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
323 # On macOS, the entity of gcc is clang.
324 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000325 # Suppress some warnings produced by clang 12 and later.
326 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
327 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
328 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100329
330 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100331 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100332 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100333 run: |
334 make -j${NPROC}
335
336 - name: Check version
337 run: |
338 "${SRCDIR}"/vim --version
339 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
340 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
341
342 - name: Test
343 timeout-minutes: 20
344 run: |
345 make ${TEST}
346
347 windows:
Philip H361f9d22022-06-14 11:35:21 +0100348 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100349
350 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100351 # Interfaces
352 # Lua
353 LUA_VER: 54
354 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000355 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100356 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
357 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
358 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100359 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
360 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100361 # Python 2
362 PYTHON_VER: 27
363 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100364 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100365 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000366 PYTHON3_VER: 311
367 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100368 # Other dependencies
369 # winpty
370 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100371 # libsodium
372 SODIUM_VER: '1.0.18'
373 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
374 SODIUM_MSVC_VER: v143
375 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
376 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100377 # Escape sequences
378 COL_RED: "\x1b[31m"
379 COL_GREEN: "\x1b[32m"
380 COL_YELLOW: "\x1b[33m"
381 COL_RESET: "\x1b[m"
382
383 strategy:
384 fail-fast: false
385 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100386 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200387 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
388 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100389 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
390 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
391 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
392 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
393 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
394 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100395
396 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200397 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100398 id: init
399 shell: bash
400 run: |
K.Takata80613d62022-11-09 16:12:47 +0000401 # Show Windows version
402 cmd /c ver
403
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100404 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100405
ichizok2f147162023-04-26 15:43:39 +0100406 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100407 cygreg=registry
408 pyreg=
409 echo "VCARCH=amd64" >> $GITHUB_ENV
410 echo "WARCH=x64" >> $GITHUB_ENV
411 echo "BITS=64" >> $GITHUB_ENV
412 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100413 else
K.Takata2da11a42022-09-10 13:03:12 +0100414 cygreg=registry32
415 pyreg=-32
416 echo "VCARCH=x86" >> $GITHUB_ENV
417 echo "WARCH=ia32" >> $GITHUB_ENV
418 echo "BITS=32" >> $GITHUB_ENV
419 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100420 fi
K.Takata2da11a42022-09-10 13:03:12 +0100421
422 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100423 if ${{ matrix.features != 'TINY' }}; then
424 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000425 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100426 else
K.Takata80613d62022-11-09 16:12:47 +0000427 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100428 fi
429 fi
430 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100431 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
432
ichizok2f147162023-04-26 15:43:39 +0100433 if ${{ matrix.toolchain == 'msvc' }}; then
434 SODIUM_DIR=D:\\libsodium
435 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
436 else
437 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
438 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
439 fi
440 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
441
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100442 - uses: msys2/setup-msys2@v2
443 if: matrix.toolchain == 'mingw'
444 with:
Philip H361f9d22022-06-14 11:35:21 +0100445 update: true
446 install: tar
447 pacboy: >-
448 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100449 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100450 release: false
451
Philip Hbfaa24f2022-06-01 21:26:34 +0100452 - name: Checkout repository from github
453 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100454
455 - name: Create a list of download URLs
456 shell: cmd
457 run: |
458 type NUL > urls.txt
459 echo %LUA_RELEASE%>> urls.txt
460 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100461 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100462
463 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100464 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100465 with:
466 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100467 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100468
469 - name: Download dependencies
470 shell: cmd
471 run: |
472 path C:\Program Files\7-Zip;%path%
473 if not exist downloads mkdir downloads
474
475 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100476 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100477 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
478
479 echo %COL_GREEN%Download winpty%COL_RESET%
480 call :downloadfile %WINPTY_URL% downloads\winpty.zip
481 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100482 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
483 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100484
ichizok2f147162023-04-26 15:43:39 +0100485 echo %COL_GREEN%Download libsodium%COL_RESET%
486 if "${{ matrix.toolchain }}"=="msvc" (
487 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
488 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
489 ) else (
490 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
491 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
492 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
493 )
494
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100495 goto :eof
496
497 :downloadfile
498 :: call :downloadfile <URL> <localfile>
499 if not exist %2 (
500 curl -f -L %1 -o %2
501 )
502 if ERRORLEVEL 1 (
503 rem Retry once.
504 curl -f -L %1 -o %2 || exit 1
505 )
506 goto :eof
507
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100508 - name: Build (MSVC)
509 if: matrix.toolchain == 'msvc'
510 shell: cmd
511 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100512 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100513 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100514 if "${{ matrix.VIMDLL }}"=="yes" (
515 set GUI=yes
516 ) else (
517 set GUI=${{ matrix.GUI }}
518 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200519 if "${{ matrix.python3 }}"=="stable" (
520 set PYTHON3_STABLE=yes
521 ) else (
522 set PYTHON3_STABLE=no
523 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100524 if "${{ matrix.features }}"=="HUGE" (
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 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
529 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100530 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200531 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100532 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100533 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000534 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100535 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100536 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100537 )
538
539 - name: Build (MinGW)
540 if: matrix.toolchain == 'mingw'
541 shell: msys2 {0}
542 run: |
543 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100544 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
545 GUI=yes
546 else
547 GUI=${{ matrix.GUI }}
548 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200549 if [ "${{ matrix.python3 }}" = "stable" ]; then
550 PYTHON3_STABLE=yes
551 else
552 PYTHON3_STABLE=no
553 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100554 if [ "${{ matrix.features }}" = "HUGE" ]; then
555 mingw32-make -f Make_ming.mak -j2 \
556 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100557 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100558 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100559 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
560 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200561 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100562 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000563 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100564 else
565 mingw32-make -f Make_ming.mak -j2 \
566 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100567 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100568 STATIC_STDCPLUS=yes
569 fi
570
ichizok0cd3e942022-02-14 11:36:57 +0000571 - name: Check version
572 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000573 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100574 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
575 if "${{ matrix.GUI }}"=="yes" (
576 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
577 type version.txt
578 echo.
579 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
580 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
581 type version.txt
582 del version.txt
583 ) else (
584 src\vim --version || exit 1
585 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
586 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
587 )
ichizok0cd3e942022-02-14 11:36:57 +0000588
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100589 #- name: Prepare Artifact
590 # shell: cmd
591 # run: |
592 # mkdir artifacts
593 # copy src\*vim.exe artifacts
594 # copy src\vim*.dll artifacts
595 #
596 #- name: Upload Artifact
597 # uses: actions/upload-artifact@v1
598 # with:
599 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
600 # path: ./artifacts
601
ichizok0cd3e942022-02-14 11:36:57 +0000602 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100603 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100604 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100605 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100606 run: |
ichizok2f147162023-04-26 15:43:39 +0100607 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100608 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100609
ichizok0cd3e942022-02-14 11:36:57 +0000610 echo %COL_GREEN%Test gVim:%COL_RESET%
611 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100612 if "${{ matrix.GUI }}"=="yes" (
613 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
614 ) else (
615 @rem Run only tiny tests.
616 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100617 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100618
K.Takata2da11a42022-09-10 13:03:12 +0100619 - name: Test and show the result of testing Vim
620 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
621 shell: cmd
622 timeout-minutes: 15
623 run: |
ichizok2f147162023-04-26 15:43:39 +0100624 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100625 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000626
K.Takata2da11a42022-09-10 13:03:12 +0100627 echo %COL_GREEN%Test Vim:%COL_RESET%
628 cd src\testdir
629 nmake -nologo -f Make_mvc.mak clean
630 if "${{ matrix.GUI }}"=="no" (
631 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
632 ) else (
633 @rem Run only tiny tests.
634 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100635 )
ichizok41ee5b12022-02-12 10:13:13 +0000636
637 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000638 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000639 shell: msys2 {0}
640 run: |
641 cd src
642 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000643
K.Takata2da11a42022-09-10 13:03:12 +0100644 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100645 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000646 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000647 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000648 with:
649 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000650 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}