blob: 0307b454bf4a392590ddc6f8fa0686530ae8e686 [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 H28db30d2024-01-31 20:02:10 +010025 CLANG_VER: 18
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010026 TEST: test
27 SRCDIR: ./src
28 LEAK_CFLAGS: -DEXITFREE
29 LOG_DIR: ${{ github.workspace }}/logs
30 TERM: xterm
31 DISPLAY: ':99'
Bram Moolenaar9aff9702020-12-21 13:37:28 +010032 DEBIAN_FRONTEND: noninteractive
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010033
34 strategy:
35 fail-fast: false
36 matrix:
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +010037 features: [tiny, normal, huge]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010038 compiler: [clang, gcc]
ichizok3e1e63d2023-08-29 22:16:34 +020039 extra: [[]]
James McCoya4245a12023-09-05 07:41:23 +020040 # Only use non-native architecture when features != huge.
41 # features=huge tries to install python3-dev, which fails to install
42 # for the non-native architecture.
43 architecture: [native]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010044 include:
45 - features: tiny
46 compiler: clang
ichizok3e1e63d2023-08-29 22:16:34 +020047 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010048 - features: tiny
49 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020050 extra: [nogui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010051 - features: normal
52 shadow: ./src/shadow
James McCoya4245a12023-09-05 07:41:23 +020053 compiler: gcc
54 architecture: i386
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010055 - features: huge
56 coverage: true
57 - features: huge
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020058 compiler: clang
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020059 interface: dynamic
60 python3: stable-abi
61 - features: huge
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010062 compiler: gcc
63 coverage: true
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +020064 interface: dynamic
ichizok3e1e63d2023-08-29 22:16:34 +020065 extra: [uchar, testgui]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010066 - features: huge
67 compiler: clang
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
ichizok3e1e63d2023-08-29 22:16:34 +020070 lua_ver: '5.1'
71 extra: [asan]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010072 - features: huge
73 compiler: gcc
74 coverage: true
ichizok3e1e63d2023-08-29 22:16:34 +020075 extra: [unittests]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010076 - features: normal
77 compiler: gcc
ichizok3e1e63d2023-08-29 22:16:34 +020078 extra: [vimtags]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010079
80 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +010081 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +020082 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010083
Peter Simonyi9cc95aa2023-12-01 12:07:42 -050084 - name: Check Filelist (for packaging)
85 run: |
86 # If any files in the repository are not listed in Filelist this will
87 # exit with an error code and list the missing entries.
88 make -f ci/unlisted.make
89
James McCoya4245a12023-09-05 07:41:23 +020090 - run: sudo dpkg --add-architecture i386
91 if: matrix.architecture == 'i386'
92
Philip H0a3d3692024-01-31 20:04:22 +010093 - name: Uninstall snap
94 run: |
95 sudo bash ci/remove_snap.sh
96
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010097 - name: Install packages
Bram Moolenaar8ea05de2020-12-17 20:27:26 +010098 run: |
Philip H04e89432024-04-24 19:55:11 +020099 # This is added by default, and it is often broken, but we don't need anything from it
100 sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
ichizok10504762022-01-15 13:37:14 +0000101 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100102 gettext \
James McCoya4245a12023-09-05 07:41:23 +0200103 libgtk2.0-dev:${{ matrix.architecture }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100104 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +0200105 libtool-bin \
James McCoya4245a12023-09-05 07:41:23 +0200106 libncurses-dev:${{ matrix.architecture }} \
107 libxt-dev:${{ matrix.architecture }} \
ichizok10504762022-01-15 13:37:14 +0000108 )
109 if ${{ matrix.features == 'huge' }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200110 LUA_VER=${{ matrix.lua_ver || '5.4' }}
ichizok10504762022-01-15 13:37:14 +0000111 PKGS+=( \
112 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +0200113 gdb \
ichizok10504762022-01-15 13:37:14 +0000114 lcov \
115 libcanberra-dev \
116 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +0100117 python2-dev \
ichizok10504762022-01-15 13:37:14 +0000118 python3-dev \
ichizok3e1e63d2023-08-29 22:16:34 +0200119 liblua${LUA_VER}-dev \
120 lua${LUA_VER} \
ichizok10504762022-01-15 13:37:14 +0000121 ruby-dev \
122 tcl-dev \
123 cscope \
124 libsodium-dev \
Christian Brabandte085dfd2023-09-30 12:49:18 +0200125 attr \
126 libattr1-dev
ichizok10504762022-01-15 13:37:14 +0000127 )
128 fi
Philip H0fdd1852024-02-28 23:25:08 +0100129 sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100130
Philip H9be736f2023-04-21 19:51:22 +0100131 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100132 if: matrix.compiler == 'gcc'
133 run: |
Philip H4b9fc822024-04-26 18:45:41 +0200134 # ubuntu-toolchain-r/test PPA for gcc-13 compiler
135 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
136 sudo apt-get update -y
James McCoya4245a12023-09-05 07:41:23 +0200137 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ matrix.architecture }}
Philip H7268e532023-05-16 20:11:02 +0100138 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
139 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100140
Philip H9be736f2023-04-21 19:51:22 +0100141 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100142 if: matrix.compiler == 'clang'
143 run: |
144 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
145 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100146 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
147 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
148 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
149 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
150 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
151 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 +0100152
153 - name: Set up environment
154 run: |
155 mkdir -p "${LOG_DIR}"
156 mkdir -p "${HOME}/bin"
157 echo "${HOME}/bin" >> $GITHUB_PATH
158 (
159 echo "LINUX_VERSION=$(uname -r)"
160 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100161 echo "TMPDIR=${{ runner.temp }}"
162
163 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100164 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100165 echo "TEST=testtiny"
166 if ${{ contains(matrix.extra, 'nogui') }}; then
167 echo "CONFOPT=--disable-gui"
168 fi
169 ;;
170 normal)
171 ;;
172 huge)
173 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200174 INTERFACE=${{ matrix.interface || 'yes' }}
175 if ${{ matrix.python3 == 'stable-abi' }}; then
176 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200177 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200178 echo "CONFOPT=--enable-perlinterp=${INTERFACE} --enable-pythoninterp=${INTERFACE} --enable-python3interp=${INTERFACE} --enable-rubyinterp=${INTERFACE} --enable-luainterp=${INTERFACE} --enable-tclinterp=${INTERFACE} ${PYTHON3_CONFOPT}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100179 ;;
180 esac
181
182 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200183 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100184 echo "LDFLAGS=--coverage"
185 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200186 if ${{ contains(matrix.extra, 'uchar') }}; then
187 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100188 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100189 if ${{ contains(matrix.extra, 'testgui') }}; then
190 echo "TEST=-C src testgui"
191 fi
192 if ${{ contains(matrix.extra, 'unittests') }}; then
193 echo "TEST=unittests"
194 fi
195 if ${{ contains(matrix.extra, 'asan') }}; then
196 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
197 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
198 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
199 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
200 fi
201 if ${{ contains(matrix.extra, 'vimtags') }}; then
202 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
203 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200204 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100205 ) >> $GITHUB_ENV
206
207 - name: Set up system
208 run: |
209 if [[ ${CC} = clang ]]; then
210 # Use llvm-cov instead of gcov when compiler is clang.
211 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
212 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100213 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
214 sudo usermod -a -G audio "${USER}"
215 sudo bash ci/setup-xvfb.sh
216
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200217 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200218 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100219 env:
220 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200221 uses: tecolicom/actions-use-apt-tools@main
222 with:
223 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
224 path: "${DEST_DIR}"
225
226 - name: modprobe snd-dummy
227 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100228 run: |
Philip He741f032023-05-11 15:22:58 +0100229 sudo depmod --verbose
Christian Brabandta66feb52023-09-16 18:29:42 +0200230 sudo modprobe --verbose snd-dummy || true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100231
232 - name: Check autoconf
233 if: contains(matrix.extra, 'unittests')
234 run: |
235 make -C src autoconf
236
237 - name: Set up shadow dir
238 if: matrix.shadow
239 run: |
240 make -C src shadow
241 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
242 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
243
244 - name: Configure
245 run: |
246 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
247 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100248 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
249 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000250 if [[ ${CC} = clang ]]; then
251 # Suppress some warnings produced by clang 12 and later.
252 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
253 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100254
255 - name: Build
256 if: (!contains(matrix.extra, 'unittests'))
257 run: |
258 make ${SHADOWOPT} -j${NPROC}
259
260 - name: Check version
261 if: (!contains(matrix.extra, 'unittests'))
262 run: |
263 "${SRCDIR}"/vim --version
264 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
265 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
266
267 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200268 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100269 run: |
270 do_test() { sg audio "sg $(id -gn) '$*'"; }
271 do_test make ${SHADOWOPT} ${TEST}
272
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200273 - name: Vim tags
274 if: contains(matrix.extra, 'vimtags')
275 run: |
276 # This will exit with an error code if the generated vim tags differs from source.
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000277 (
278 cd runtime/doc
279 git diff --exit-code -- tags
280 make html; rm *.html tags.ref;
281 test -f errors.log && exit 3;
Christian Brabandt9c581912024-01-15 22:38:48 +0100282 true
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000283 )
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200284
ichizok0d47ad42022-01-11 13:05:26 +0000285 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000286 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100287 run: |
288 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000289 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
290
291 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100292 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000293 if: matrix.coverage
dependabot[bot]ea7f2f22024-02-06 10:46:10 +0100294 uses: codecov/codecov-action@v4
ichizok0d47ad42022-01-11 13:05:26 +0000295 with:
ichizok41ee5b12022-02-12 10:13:13 +0000296 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
K.Takatabd2f45a2024-02-10 02:18:11 +0900297 token: ${{ secrets.CODECOV_TOKEN }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100298
299 - name: ASan logs
300 if: contains(matrix.extra, 'asan') && !cancelled()
301 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000302 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000303 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100304 false # in order to fail a job
305 done
306
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100307 macos:
rhysde93d5ca2024-02-01 21:22:14 +0100308 runs-on: ${{ matrix.runner }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100309
310 env:
ichizok48c01962021-12-11 17:34:19 +0000311 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100312 TEST: test
313 SRCDIR: ./src
314 LEAK_CFLAGS: -DEXITFREE
315 TERM: xterm
316
317 strategy:
318 fail-fast: false
319 matrix:
ichizok48c01962021-12-11 17:34:19 +0000320 features: [tiny, normal, huge]
Philip Hacba5af2024-04-14 18:48:34 +0200321 runner: [macos-12, macos-14]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100322
323 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100324 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200325 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100326
Yee Cheng Chin49f2ba62024-02-14 20:34:58 +0100327 - name: Install packages
328 if: matrix.features == 'huge'
rhysde93d5ca2024-02-01 21:22:14 +0100329 run: |
330 brew install lua libtool
Yee Cheng Chin49f2ba62024-02-14 20:34:58 +0100331 echo "LUA_PREFIX=$(brew --prefix)" >> $GITHUB_ENV
332
333 - name: Grant microphone access for macos-14
334 if: matrix.runner == 'macos-14'
335 run: |
336 # Temporary fix to fix microphone permission issues for macos-14 when playing sound.
337 sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
rhysde93d5ca2024-02-01 21:22:14 +0100338
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100339 - name: Set up environment
340 run: |
341 (
342 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
343 case "${{ matrix.features }}" in
344 tiny)
345 echo "TEST=testtiny"
346 echo "CONFOPT=--disable-gui"
347 ;;
ichizok48c01962021-12-11 17:34:19 +0000348 normal)
349 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100350 huge)
Philip Hd094e582022-10-16 14:53:34 +0100351 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100352 ;;
353 esac
354 ) >> $GITHUB_ENV
355
356 - name: Configure
357 run: |
358 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
359 # Append various warning flags to CFLAGS.
360 # BSD sed needs backup extension specified.
361 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
362 # On macOS, the entity of gcc is clang.
363 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000364 # Suppress some warnings produced by clang 12 and later.
365 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
366 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
367 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100368
369 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100370 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100371 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100372 run: |
373 make -j${NPROC}
374
375 - name: Check version
376 run: |
377 "${SRCDIR}"/vim --version
378 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
379 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
380
Linda_pp72a1f452024-02-20 04:55:55 +0900381 - name: Install packages for testing
382 run: |
383 # Apple diff is broken. Use GNU diff instead. See #14032.
384 brew install diffutils
385
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100386 - name: Test
387 timeout-minutes: 20
388 run: |
389 make ${TEST}
390
391 windows:
Philip H361f9d22022-06-14 11:35:21 +0100392 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100393
394 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100395 # Interfaces
396 # Lua
397 LUA_VER: 54
398 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000399 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100400 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
401 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
402 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100403 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
404 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100405 # Python 2
406 PYTHON_VER: 27
407 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100408 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100409 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000410 PYTHON3_VER: 311
411 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100412 # Other dependencies
413 # winpty
414 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100415 # libsodium
Restorer8e37daf2024-03-22 18:34:52 +0000416 SODIUM_VER: '1.0.19'
Restorerfbeea682024-04-22 18:48:43 +0000417 # SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
418 SODIUM_MSVC_URL: https://github.com/jedisct1/libsodium/releases/download/%SODIUM_VER%-RELEASE/libsodium-%SODIUM_VER%-msvc.zip
ichizok2f147162023-04-26 15:43:39 +0100419 SODIUM_MSVC_VER: v143
Restorerfbeea682024-04-22 18:48:43 +0000420 # SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
421 SODIUM_MINGW_URL: https://github.com/jedisct1/libsodium/releases/download/%SODIUM_VER%-RELEASE/libsodium-%SODIUM_VER%-mingw.tar.gz
Restorer8e37daf2024-03-22 18:34:52 +0000422 SODIUM_MINGW_VER: 26
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100423 # Escape sequences
424 COL_RED: "\x1b[31m"
425 COL_GREEN: "\x1b[32m"
426 COL_YELLOW: "\x1b[33m"
427 COL_RESET: "\x1b[m"
428
429 strategy:
430 fail-fast: false
431 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100432 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200433 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
434 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100435 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
436 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
437 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
438 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
439 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
440 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100441
442 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200443 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100444 id: init
445 shell: bash
446 run: |
K.Takata80613d62022-11-09 16:12:47 +0000447 # Show Windows version
448 cmd /c ver
449
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100450 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100451
ichizok2f147162023-04-26 15:43:39 +0100452 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100453 cygreg=registry
454 pyreg=
455 echo "VCARCH=amd64" >> $GITHUB_ENV
456 echo "WARCH=x64" >> $GITHUB_ENV
457 echo "BITS=64" >> $GITHUB_ENV
458 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100459 else
K.Takata2da11a42022-09-10 13:03:12 +0100460 cygreg=registry32
461 pyreg=-32
462 echo "VCARCH=x86" >> $GITHUB_ENV
463 echo "WARCH=ia32" >> $GITHUB_ENV
464 echo "BITS=32" >> $GITHUB_ENV
465 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100466 fi
K.Takata2da11a42022-09-10 13:03:12 +0100467
468 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100469 if ${{ matrix.features != 'TINY' }}; then
470 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000471 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100472 else
K.Takata80613d62022-11-09 16:12:47 +0000473 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100474 fi
475 fi
476 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100477 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
478
ichizok2f147162023-04-26 15:43:39 +0100479 if ${{ matrix.toolchain == 'msvc' }}; then
480 SODIUM_DIR=D:\\libsodium
481 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
482 else
483 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
Christian Brabandtf976e2c2024-03-21 20:55:22 +0000484 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
485 SODIUM_DIR_SLASH=D:/libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
ichizok2f147162023-04-26 15:43:39 +0100486 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
Christian Brabandtf976e2c2024-03-21 20:55:22 +0000487 echo "SODIUM_DIR_SLASH=${SODIUM_DIR_SLASH}" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100488 fi
489 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
490
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100491 - uses: msys2/setup-msys2@v2
492 if: matrix.toolchain == 'mingw'
493 with:
Philip H361f9d22022-06-14 11:35:21 +0100494 update: true
495 install: tar
496 pacboy: >-
497 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100498 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100499 release: false
500
Philip Hbfaa24f2022-06-01 21:26:34 +0100501 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200502 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100503
504 - name: Create a list of download URLs
505 shell: cmd
506 run: |
507 type NUL > urls.txt
508 echo %LUA_RELEASE%>> urls.txt
509 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100510 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100511
512 - name: Cache downloaded files
dependabot[bot]1cee5092024-01-22 20:06:01 +0100513 uses: actions/cache@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100514 with:
515 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100516 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100517
518 - name: Download dependencies
519 shell: cmd
520 run: |
521 path C:\Program Files\7-Zip;%path%
522 if not exist downloads mkdir downloads
523
524 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100525 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100526 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
527
528 echo %COL_GREEN%Download winpty%COL_RESET%
529 call :downloadfile %WINPTY_URL% downloads\winpty.zip
530 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100531 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
532 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100533
ichizok2f147162023-04-26 15:43:39 +0100534 echo %COL_GREEN%Download libsodium%COL_RESET%
535 if "${{ matrix.toolchain }}"=="msvc" (
536 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
537 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
538 ) else (
539 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
540 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
541 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
542 )
543
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100544 goto :eof
545
546 :downloadfile
547 :: call :downloadfile <URL> <localfile>
548 if not exist %2 (
549 curl -f -L %1 -o %2
550 )
551 if ERRORLEVEL 1 (
552 rem Retry once.
553 curl -f -L %1 -o %2 || exit 1
554 )
555 goto :eof
556
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100557 - name: Build (MSVC)
558 if: matrix.toolchain == 'msvc'
559 shell: cmd
560 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100561 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100562 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100563 if "${{ matrix.VIMDLL }}"=="yes" (
564 set GUI=yes
565 ) else (
566 set GUI=${{ matrix.GUI }}
567 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200568 if "${{ matrix.python3 }}"=="stable" (
569 set PYTHON3_STABLE=yes
570 ) else (
571 set PYTHON3_STABLE=no
572 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100573 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000574 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100575 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100576 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100577 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
578 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100579 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200580 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100581 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100582 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000583 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100584 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100585 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100586 )
587
588 - name: Build (MinGW)
589 if: matrix.toolchain == 'mingw'
590 shell: msys2 {0}
591 run: |
592 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100593 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
594 GUI=yes
595 else
596 GUI=${{ matrix.GUI }}
597 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200598 if [ "${{ matrix.python3 }}" = "stable" ]; then
599 PYTHON3_STABLE=yes
600 else
601 PYTHON3_STABLE=no
602 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100603 if [ "${{ matrix.features }}" = "HUGE" ]; then
604 mingw32-make -f Make_ming.mak -j2 \
605 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100606 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100607 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100608 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
609 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200610 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
Christian Brabandtf976e2c2024-03-21 20:55:22 +0000611 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR_SLASH} \
ichizok0cd3e942022-02-14 11:36:57 +0000612 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100613 else
614 mingw32-make -f Make_ming.mak -j2 \
615 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100616 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100617 STATIC_STDCPLUS=yes
618 fi
619
ichizok0cd3e942022-02-14 11:36:57 +0000620 - name: Check version
621 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000622 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100623 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
624 if "${{ matrix.GUI }}"=="yes" (
625 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
626 type version.txt
627 echo.
628 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
629 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
630 type version.txt
631 del version.txt
632 ) else (
633 src\vim --version || exit 1
634 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
635 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
636 )
ichizok0cd3e942022-02-14 11:36:57 +0000637
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100638 #- name: Prepare Artifact
639 # shell: cmd
640 # run: |
641 # mkdir artifacts
642 # copy src\*vim.exe artifacts
643 # copy src\vim*.dll artifacts
644 #
645 #- name: Upload Artifact
646 # uses: actions/upload-artifact@v1
647 # with:
648 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
649 # path: ./artifacts
650
ichizok0cd3e942022-02-14 11:36:57 +0000651 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100652 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100653 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100654 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100655 run: |
ichizok2f147162023-04-26 15:43:39 +0100656 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100657 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100658
ichizok0cd3e942022-02-14 11:36:57 +0000659 echo %COL_GREEN%Test gVim:%COL_RESET%
660 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100661 if "${{ matrix.GUI }}"=="yes" (
662 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
663 ) else (
664 @rem Run only tiny tests.
665 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100666 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100667
K.Takata2da11a42022-09-10 13:03:12 +0100668 - name: Test and show the result of testing Vim
669 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
670 shell: cmd
671 timeout-minutes: 15
672 run: |
ichizok2f147162023-04-26 15:43:39 +0100673 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100674 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000675
K.Takata2da11a42022-09-10 13:03:12 +0100676 echo %COL_GREEN%Test Vim:%COL_RESET%
677 cd src\testdir
678 nmake -nologo -f Make_mvc.mak clean
679 if "${{ matrix.GUI }}"=="no" (
680 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
681 ) else (
682 @rem Run only tiny tests.
683 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100684 )
ichizok41ee5b12022-02-12 10:13:13 +0000685
686 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000687 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000688 shell: msys2 {0}
689 run: |
690 cd src
691 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000692
K.Takata2da11a42022-09-10 13:03:12 +0100693 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100694 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000695 if: matrix.coverage
dependabot[bot]ea7f2f22024-02-06 10:46:10 +0100696 uses: codecov/codecov-action@v4
ichizok41ee5b12022-02-12 10:13:13 +0000697 with:
698 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000699 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}
K.Takatabd2f45a2024-02-10 02:18:11 +0900700 token: ${{ secrets.CODECOV_TOKEN }}