blob: 207b7dd3faf0758e2e302018dc725c8f48b85ef3 [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 H9be736f2023-04-21 19:51:22 +010024 GCC_VER: 12
25 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]
41 include:
42 - features: tiny
43 compiler: clang
44 extra: nogui
45 - features: tiny
46 compiler: gcc
47 extra: nogui
48 - features: normal
49 shadow: ./src/shadow
50 - features: huge
51 coverage: true
52 - features: huge
53 compiler: gcc
54 coverage: true
55 extra: testgui
James McCoy2e258bd2021-10-05 19:44:04 +010056 uchar: true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010057 - features: huge
58 compiler: clang
59 extra: asan
60 - features: huge
61 compiler: gcc
62 coverage: true
63 extra: unittests
64 - features: normal
65 compiler: gcc
66 extra: vimtags
67
68 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010069 - name: Checkout repository from github
70 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010071
72 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010073 run: |
ichizok10504762022-01-15 13:37:14 +000074 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010075 gettext \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010076 libgtk2.0-dev \
77 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +020078 libtool-bin \
ichizok10504762022-01-15 13:37:14 +000079 )
80 if ${{ matrix.features == 'huge' }}; then
81 PKGS+=( \
82 autoconf \
83 lcov \
84 libcanberra-dev \
85 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +010086 python2-dev \
ichizok10504762022-01-15 13:37:14 +000087 python3-dev \
Philip H9be736f2023-04-21 19:51:22 +010088 liblua5.4-dev \
89 lua5.4 \
ichizok10504762022-01-15 13:37:14 +000090 ruby-dev \
91 tcl-dev \
92 cscope \
93 libsodium-dev \
94 )
95 fi
ichizok01722702023-04-21 17:46:57 +010096 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +010097
Philip H9be736f2023-04-21 19:51:22 +010098 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +010099 if: matrix.compiler == 'gcc'
100 run: |
Philip H9be736f2023-04-21 19:51:22 +0100101 sudo apt-get install -y gcc-${{ env.GCC_VER }}
102 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
103 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100104
Philip H9be736f2023-04-21 19:51:22 +0100105 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100106 if: matrix.compiler == 'clang'
107 run: |
108 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
109 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100110 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
111 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
112 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
113 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
114 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
115 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 +0100116
117 - name: Set up environment
118 run: |
119 mkdir -p "${LOG_DIR}"
120 mkdir -p "${HOME}/bin"
121 echo "${HOME}/bin" >> $GITHUB_PATH
122 (
123 echo "LINUX_VERSION=$(uname -r)"
124 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100125 echo "TMPDIR=${{ runner.temp }}"
126
127 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100128 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100129 echo "TEST=testtiny"
130 if ${{ contains(matrix.extra, 'nogui') }}; then
131 echo "CONFOPT=--disable-gui"
132 fi
133 ;;
134 normal)
135 ;;
136 huge)
137 echo "TEST=scripttests test_libvterm"
138 echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
139 ;;
140 esac
141
142 if ${{ matrix.coverage == true }}; then
James McCoy2e258bd2021-10-05 19:44:04 +0100143 CFLAGS="$CFLAGS --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100144 echo "LDFLAGS=--coverage"
145 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100146 if ${{ matrix.uchar == true }}; then
147 CFLAGS="$CFLAGS -funsigned-char"
148 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100149 if ${{ contains(matrix.extra, 'testgui') }}; then
150 echo "TEST=-C src testgui"
151 fi
152 if ${{ contains(matrix.extra, 'unittests') }}; then
153 echo "TEST=unittests"
154 fi
155 if ${{ contains(matrix.extra, 'asan') }}; then
156 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
157 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
158 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
159 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
160 fi
161 if ${{ contains(matrix.extra, 'vimtags') }}; then
162 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
163 fi
James McCoy2e258bd2021-10-05 19:44:04 +0100164 echo "CFLAGS=$CFLAGS"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100165 ) >> $GITHUB_ENV
166
167 - name: Set up system
168 run: |
169 if [[ ${CC} = clang ]]; then
170 # Use llvm-cov instead of gcov when compiler is clang.
171 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
172 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100173 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
174 sudo usermod -a -G audio "${USER}"
175 sudo bash ci/setup-xvfb.sh
176
Philip He741f032023-05-11 15:22:58 +0100177 - name: Set up snd-dummy
178 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
179 env:
180 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
181 run: |
182 cd /lib/modules/${{ env.LINUX_VERSION }}
183 if [ sudo apt-get install -d -y linux-modules-extra-${{ env.LINUX_VERSION }} 2>&1 | $(grep "Unable to locate package ") ]; then
184 echo "Download of " linux-modules-extra-${{ env.LINUX_VERSION }} "failed continue anyway" exit 0
185 else
186 sudo apt-get install -d -y linux-modules-extra-${{ env.LINUX_VERSION }}
187 sudo dpkg -x /var/cache/apt/archives/linux-modules-extra-${{ env.LINUX_VERSION }}*.deb "${DEST_DIR}"
188 tar -cvC "${DEST_DIR}"/lib/modules/${{ env.LINUX_VERSION }} kernel/sound | sudo tar -x
189 sudo depmod --verbose
190 sudo modprobe --verbose snd-dummy
191 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100192
193 - name: Check autoconf
194 if: contains(matrix.extra, 'unittests')
195 run: |
196 make -C src autoconf
197
198 - name: Set up shadow dir
199 if: matrix.shadow
200 run: |
201 make -C src shadow
202 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
203 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
204
205 - name: Configure
206 run: |
207 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
208 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100209 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
210 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000211 if [[ ${CC} = clang ]]; then
212 # Suppress some warnings produced by clang 12 and later.
213 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
214 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100215
216 - name: Build
217 if: (!contains(matrix.extra, 'unittests'))
218 run: |
219 make ${SHADOWOPT} -j${NPROC}
220
221 - name: Check version
222 if: (!contains(matrix.extra, 'unittests'))
223 run: |
224 "${SRCDIR}"/vim --version
225 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
226 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
227
228 - name: Test
229 timeout-minutes: 20
230 run: |
231 do_test() { sg audio "sg $(id -gn) '$*'"; }
232 do_test make ${SHADOWOPT} ${TEST}
233
ichizok0d47ad42022-01-11 13:05:26 +0000234 # - name: Coveralls
ichizok41ee5b12022-02-12 10:13:13 +0000235 # if: matrix.coverage && github.event_name != 'pull_request'
ichizok0d47ad42022-01-11 13:05:26 +0000236 # env:
237 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
238 # COVERALLS_PARALLEL: true
239 # TRAVIS_JOB_ID: ${{ github.run_id }}
240 # run: |
241 # sudo apt-get install -y python3-setuptools python3-wheel
242 # sudo -H pip3 install pip -U
243 # # needed for https support for coveralls building cffi only works with gcc, not with clang
244 # CC=gcc pip3 install --user cpp-coveralls pyopenssl ndg-httpsclient pyasn1
245 # ~/.local/bin/coveralls -b "${SRCDIR}" -x .xs -e "${SRCDIR}"/if_perl.c -e "${SRCDIR}"/xxd -e "${SRCDIR}"/libvterm --encodings utf-8
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100246
ichizok0d47ad42022-01-11 13:05:26 +0000247 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000248 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100249 run: |
250 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000251 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
252
253 - name: Codecov
ichizok41ee5b12022-02-12 10:13:13 +0000254 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000255 uses: codecov/codecov-action@v3
ichizok0d47ad42022-01-11 13:05:26 +0000256 with:
ichizok41ee5b12022-02-12 10:13:13 +0000257 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100258
259 - name: ASan logs
260 if: contains(matrix.extra, 'asan') && !cancelled()
261 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000262 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000263 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100264 false # in order to fail a job
265 done
266
ichizok0d47ad42022-01-11 13:05:26 +0000267 # coveralls:
Philip Hb2137032022-08-25 15:21:24 +0100268 # runs-on: ubuntu-20.04
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200269 #
ichizok0d47ad42022-01-11 13:05:26 +0000270 # needs: linux
271 # if: always() && github.event_name != 'pull_request'
Bram Moolenaar18fefdd2021-09-19 17:55:16 +0200272 #
ichizok0d47ad42022-01-11 13:05:26 +0000273 # steps:
274 # - name: Parallel finished
275 # env:
276 # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
277 # run: |
278 # curl -k "https://coveralls.io/webhook?repo_token=${COVERALLS_REPO_TOKEN}" -d "payload[build_num]=${GITHUB_RUN_ID}&payload[status]=done"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100279
280 macos:
281 runs-on: macos-latest
282
283 env:
ichizok48c01962021-12-11 17:34:19 +0000284 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100285 TEST: test
286 SRCDIR: ./src
287 LEAK_CFLAGS: -DEXITFREE
288 TERM: xterm
289
290 strategy:
291 fail-fast: false
292 matrix:
ichizok48c01962021-12-11 17:34:19 +0000293 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100294
295 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100296 - name: Checkout repository from github
297 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100298
299 - name: Install packages
ichizok10504762022-01-15 13:37:14 +0000300 if: matrix.features == 'huge'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100301 run: |
302 brew install lua
303 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
Philip Hd094e582022-10-16 14:53:34 +0100304 brew uninstall perl
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100305
306 - name: Set up environment
307 run: |
308 (
309 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
310 case "${{ matrix.features }}" in
311 tiny)
312 echo "TEST=testtiny"
313 echo "CONFOPT=--disable-gui"
314 ;;
ichizok48c01962021-12-11 17:34:19 +0000315 normal)
316 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100317 huge)
Philip Hd094e582022-10-16 14:53:34 +0100318 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100319 ;;
320 esac
321 ) >> $GITHUB_ENV
322
323 - name: Configure
324 run: |
325 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
326 # Append various warning flags to CFLAGS.
327 # BSD sed needs backup extension specified.
328 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
329 # On macOS, the entity of gcc is clang.
330 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000331 # Suppress some warnings produced by clang 12 and later.
332 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
333 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
334 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100335
336 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100337 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100338 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100339 run: |
340 make -j${NPROC}
341
342 - name: Check version
343 run: |
344 "${SRCDIR}"/vim --version
345 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
346 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
347
348 - name: Test
349 timeout-minutes: 20
350 run: |
351 make ${TEST}
352
353 windows:
Philip H361f9d22022-06-14 11:35:21 +0100354 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100355
356 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100357 # Interfaces
358 # Lua
359 LUA_VER: 54
360 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000361 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100362 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
363 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
364 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100365 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
366 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100367 # Python 2
368 PYTHON_VER: 27
369 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100370 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100371 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000372 PYTHON3_VER: 311
373 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100374 # Other dependencies
375 # winpty
376 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100377 # libsodium
378 SODIUM_VER: '1.0.18'
379 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
380 SODIUM_MSVC_VER: v143
381 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
382 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100383 # Escape sequences
384 COL_RED: "\x1b[31m"
385 COL_GREEN: "\x1b[32m"
386 COL_YELLOW: "\x1b[33m"
387 COL_RESET: "\x1b[m"
388
389 strategy:
390 fail-fast: false
391 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100392 include:
K.Takata2da11a42022-09-10 13:03:12 +0100393 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64 }
394 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, coverage: yes }
395 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
396 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
397 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
398 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
399 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
400 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100401
402 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200403 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100404 id: init
405 shell: bash
406 run: |
K.Takata80613d62022-11-09 16:12:47 +0000407 # Show Windows version
408 cmd /c ver
409
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100410 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100411
ichizok2f147162023-04-26 15:43:39 +0100412 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100413 cygreg=registry
414 pyreg=
415 echo "VCARCH=amd64" >> $GITHUB_ENV
416 echo "WARCH=x64" >> $GITHUB_ENV
417 echo "BITS=64" >> $GITHUB_ENV
418 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100419 else
K.Takata2da11a42022-09-10 13:03:12 +0100420 cygreg=registry32
421 pyreg=-32
422 echo "VCARCH=x86" >> $GITHUB_ENV
423 echo "WARCH=ia32" >> $GITHUB_ENV
424 echo "BITS=32" >> $GITHUB_ENV
425 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100426 fi
K.Takata2da11a42022-09-10 13:03:12 +0100427
428 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100429 if ${{ matrix.features != 'TINY' }}; then
430 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000431 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100432 else
K.Takata80613d62022-11-09 16:12:47 +0000433 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100434 fi
435 fi
436 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100437 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
438
ichizok2f147162023-04-26 15:43:39 +0100439 if ${{ matrix.toolchain == 'msvc' }}; then
440 SODIUM_DIR=D:\\libsodium
441 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
442 else
443 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
444 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
445 fi
446 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
447
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100448 - uses: msys2/setup-msys2@v2
449 if: matrix.toolchain == 'mingw'
450 with:
Philip H361f9d22022-06-14 11:35:21 +0100451 update: true
452 install: tar
453 pacboy: >-
454 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100455 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100456 release: false
457
Philip Hbfaa24f2022-06-01 21:26:34 +0100458 - name: Checkout repository from github
459 uses: actions/checkout@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100460
461 - name: Create a list of download URLs
462 shell: cmd
463 run: |
464 type NUL > urls.txt
465 echo %LUA_RELEASE%>> urls.txt
466 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100467 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100468
469 - name: Cache downloaded files
Philip H2ff7e7e2022-06-17 21:27:38 +0100470 uses: actions/cache@v3
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100471 with:
472 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100473 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100474
475 - name: Download dependencies
476 shell: cmd
477 run: |
478 path C:\Program Files\7-Zip;%path%
479 if not exist downloads mkdir downloads
480
481 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100482 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100483 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
484
485 echo %COL_GREEN%Download winpty%COL_RESET%
486 call :downloadfile %WINPTY_URL% downloads\winpty.zip
487 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100488 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
489 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100490
ichizok2f147162023-04-26 15:43:39 +0100491 echo %COL_GREEN%Download libsodium%COL_RESET%
492 if "${{ matrix.toolchain }}"=="msvc" (
493 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
494 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
495 ) else (
496 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
497 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
498 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
499 )
500
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100501 goto :eof
502
503 :downloadfile
504 :: call :downloadfile <URL> <localfile>
505 if not exist %2 (
506 curl -f -L %1 -o %2
507 )
508 if ERRORLEVEL 1 (
509 rem Retry once.
510 curl -f -L %1 -o %2 || exit 1
511 )
512 goto :eof
513
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100514 - name: Build (MSVC)
515 if: matrix.toolchain == 'msvc'
516 shell: cmd
517 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100518 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100519 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100520 if "${{ matrix.VIMDLL }}"=="yes" (
521 set GUI=yes
522 ) else (
523 set GUI=${{ matrix.GUI }}
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% ^
532 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
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100549 if [ "${{ matrix.features }}" = "HUGE" ]; then
550 mingw32-make -f Make_ming.mak -j2 \
551 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100552 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100553 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100554 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
555 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
ichizok2f147162023-04-26 15:43:39 +0100556 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000557 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100558 else
559 mingw32-make -f Make_ming.mak -j2 \
560 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100561 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100562 STATIC_STDCPLUS=yes
563 fi
564
ichizok0cd3e942022-02-14 11:36:57 +0000565 - name: Check version
566 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000567 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100568 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
569 if "${{ matrix.GUI }}"=="yes" (
570 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
571 type version.txt
572 echo.
573 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
574 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
575 type version.txt
576 del version.txt
577 ) else (
578 src\vim --version || exit 1
579 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
580 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
581 )
ichizok0cd3e942022-02-14 11:36:57 +0000582
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100583 #- name: Prepare Artifact
584 # shell: cmd
585 # run: |
586 # mkdir artifacts
587 # copy src\*vim.exe artifacts
588 # copy src\vim*.dll artifacts
589 #
590 #- name: Upload Artifact
591 # uses: actions/upload-artifact@v1
592 # with:
593 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
594 # path: ./artifacts
595
ichizok0cd3e942022-02-14 11:36:57 +0000596 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100597 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100598 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100599 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100600 run: |
ichizok2f147162023-04-26 15:43:39 +0100601 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100602 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100603
ichizok0cd3e942022-02-14 11:36:57 +0000604 echo %COL_GREEN%Test gVim:%COL_RESET%
605 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100606 if "${{ matrix.GUI }}"=="yes" (
607 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
608 ) else (
609 @rem Run only tiny tests.
610 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100611 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100612
K.Takata2da11a42022-09-10 13:03:12 +0100613 - name: Test and show the result of testing Vim
614 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
615 shell: cmd
616 timeout-minutes: 15
617 run: |
ichizok2f147162023-04-26 15:43:39 +0100618 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100619 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000620
K.Takata2da11a42022-09-10 13:03:12 +0100621 echo %COL_GREEN%Test Vim:%COL_RESET%
622 cd src\testdir
623 nmake -nologo -f Make_mvc.mak clean
624 if "${{ matrix.GUI }}"=="no" (
625 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
626 ) else (
627 @rem Run only tiny tests.
628 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100629 )
ichizok41ee5b12022-02-12 10:13:13 +0000630
631 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000632 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000633 shell: msys2 {0}
634 run: |
635 cd src
636 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000637
K.Takata2da11a42022-09-10 13:03:12 +0100638 - name: Codecov
ichizok0cd3e942022-02-14 11:36:57 +0000639 if: matrix.coverage
dundargocb5328b42022-12-17 15:47:45 +0000640 uses: codecov/codecov-action@v3
ichizok41ee5b12022-02-12 10:13:13 +0000641 with:
642 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000643 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}