blob: 2746605d2bd2412b50b65cea86f68696bb803510 [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: |
ichizok10504762022-01-15 13:37:14 +000099 PKGS=( \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100100 gettext \
James McCoya4245a12023-09-05 07:41:23 +0200101 libgtk2.0-dev:${{ matrix.architecture }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100102 desktop-file-utils \
Christian Brabandtf573c6e2021-06-20 14:02:16 +0200103 libtool-bin \
James McCoya4245a12023-09-05 07:41:23 +0200104 libncurses-dev:${{ matrix.architecture }} \
105 libxt-dev:${{ matrix.architecture }} \
ichizok10504762022-01-15 13:37:14 +0000106 )
107 if ${{ matrix.features == 'huge' }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200108 LUA_VER=${{ matrix.lua_ver || '5.4' }}
ichizok10504762022-01-15 13:37:14 +0000109 PKGS+=( \
110 autoconf \
Yegappan Lakshmanan58f39d82023-08-27 11:14:44 +0200111 gdb \
ichizok10504762022-01-15 13:37:14 +0000112 lcov \
113 libcanberra-dev \
114 libperl-dev \
Philip H9be736f2023-04-21 19:51:22 +0100115 python2-dev \
ichizok10504762022-01-15 13:37:14 +0000116 python3-dev \
ichizok3e1e63d2023-08-29 22:16:34 +0200117 liblua${LUA_VER}-dev \
118 lua${LUA_VER} \
ichizok10504762022-01-15 13:37:14 +0000119 ruby-dev \
120 tcl-dev \
121 cscope \
122 libsodium-dev \
Christian Brabandte085dfd2023-09-30 12:49:18 +0200123 attr \
124 libattr1-dev
ichizok10504762022-01-15 13:37:14 +0000125 )
126 fi
Philip H7f630e62024-02-06 10:47:49 +0100127 sudo apt-get update && sudo apt-get install -y "${PKGS[@]}"
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100128
Philip H9be736f2023-04-21 19:51:22 +0100129 - name: Install gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100130 if: matrix.compiler == 'gcc'
131 run: |
James McCoya4245a12023-09-05 07:41:23 +0200132 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ matrix.architecture }}
Philip H7268e532023-05-16 20:11:02 +0100133 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
134 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
Philip Hd2edee52022-04-16 20:04:30 +0100135
Philip H9be736f2023-04-21 19:51:22 +0100136 - name: Install clang-${{ env.CLANG_VER }}
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100137 if: matrix.compiler == 'clang'
138 run: |
139 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
140 . /etc/lsb-release
Philip H9be736f2023-04-21 19:51:22 +0100141 sudo add-apt-repository -y "deb http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }} main"
142 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
143 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
144 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
145 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
146 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 +0100147
148 - name: Set up environment
149 run: |
150 mkdir -p "${LOG_DIR}"
151 mkdir -p "${HOME}/bin"
152 echo "${HOME}/bin" >> $GITHUB_PATH
153 (
154 echo "LINUX_VERSION=$(uname -r)"
155 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100156 echo "TMPDIR=${{ runner.temp }}"
157
158 case "${{ matrix.features }}" in
Naruhiko Nishinob7af5a02022-10-09 13:28:36 +0100159 tiny)
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100160 echo "TEST=testtiny"
161 if ${{ contains(matrix.extra, 'nogui') }}; then
162 echo "CONFOPT=--disable-gui"
163 fi
164 ;;
165 normal)
166 ;;
167 huge)
168 echo "TEST=scripttests test_libvterm"
ichizok3e1e63d2023-08-29 22:16:34 +0200169 INTERFACE=${{ matrix.interface || 'yes' }}
170 if ${{ matrix.python3 == 'stable-abi' }}; then
171 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200172 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200173 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 +0100174 ;;
175 esac
176
177 if ${{ matrix.coverage == true }}; then
ichizok3e1e63d2023-08-29 22:16:34 +0200178 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100179 echo "LDFLAGS=--coverage"
180 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200181 if ${{ contains(matrix.extra, 'uchar') }}; then
182 CFLAGS="${CFLAGS} -funsigned-char"
James McCoy2e258bd2021-10-05 19:44:04 +0100183 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100184 if ${{ contains(matrix.extra, 'testgui') }}; then
185 echo "TEST=-C src testgui"
186 fi
187 if ${{ contains(matrix.extra, 'unittests') }}; then
188 echo "TEST=unittests"
189 fi
190 if ${{ contains(matrix.extra, 'asan') }}; then
191 echo "SANITIZER_CFLAGS=-g -O1 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
192 echo "ASAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/asan"
193 echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=${LOG_DIR}/ubsan"
194 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
195 fi
196 if ${{ contains(matrix.extra, 'vimtags') }}; then
197 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
198 fi
ichizok3e1e63d2023-08-29 22:16:34 +0200199 echo "CFLAGS=${CFLAGS}"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100200 ) >> $GITHUB_ENV
201
202 - name: Set up system
203 run: |
204 if [[ ${CC} = clang ]]; then
205 # Use llvm-cov instead of gcov when compiler is clang.
206 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
207 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100208 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
209 sudo usermod -a -G audio "${USER}"
210 sudo bash ci/setup-xvfb.sh
211
Zdenek Dohnalba913b12023-08-15 22:34:45 +0200212 - name: Set up snd-dummy
Philip Hd2af6c62023-08-17 23:45:08 +0200213 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100214 env:
215 DEST_DIR: ${{ env.TMPDIR }}/linux-modules-extra-${{ env.LINUX_VERSION }}
Philip Hd2af6c62023-08-17 23:45:08 +0200216 uses: tecolicom/actions-use-apt-tools@main
217 with:
218 tools: linux-modules-extra-${{ env.LINUX_VERSION }}
219 path: "${DEST_DIR}"
220
221 - name: modprobe snd-dummy
222 if: (!(contains(matrix.extra, 'unittests') || contains(matrix.extra, 'vimtags')))
Philip He741f032023-05-11 15:22:58 +0100223 run: |
Philip He741f032023-05-11 15:22:58 +0100224 sudo depmod --verbose
Christian Brabandta66feb52023-09-16 18:29:42 +0200225 sudo modprobe --verbose snd-dummy || true
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100226
227 - name: Check autoconf
228 if: contains(matrix.extra, 'unittests')
229 run: |
230 make -C src autoconf
231
232 - name: Set up shadow dir
233 if: matrix.shadow
234 run: |
235 make -C src shadow
236 echo "SRCDIR=${{ matrix.shadow }}" >> $GITHUB_ENV
237 echo "SHADOWOPT=-C ${{ matrix.shadow }}" >> $GITHUB_ENV
238
239 - name: Configure
240 run: |
241 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
242 # Append various warning flags to CFLAGS.
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100243 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
244 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000245 if [[ ${CC} = clang ]]; then
246 # Suppress some warnings produced by clang 12 and later.
247 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
248 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100249
250 - name: Build
251 if: (!contains(matrix.extra, 'unittests'))
252 run: |
253 make ${SHADOWOPT} -j${NPROC}
254
255 - name: Check version
256 if: (!contains(matrix.extra, 'unittests'))
257 run: |
258 "${SRCDIR}"/vim --version
259 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
260 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
261
262 - name: Test
Christian Brabandt07a2b612023-08-18 01:18:22 +0200263 timeout-minutes: 25
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100264 run: |
265 do_test() { sg audio "sg $(id -gn) '$*'"; }
266 do_test make ${SHADOWOPT} ${TEST}
267
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200268 - name: Vim tags
269 if: contains(matrix.extra, 'vimtags')
270 run: |
271 # This will exit with an error code if the generated vim tags differs from source.
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000272 (
273 cd runtime/doc
274 git diff --exit-code -- tags
275 make html; rm *.html tags.ref;
276 test -f errors.log && exit 3;
Christian Brabandt9c581912024-01-15 22:38:48 +0100277 true
Christian Brabandt8102a4c2024-01-14 18:24:05 +0000278 )
Yee Cheng Chin8b202032023-09-02 16:03:04 +0200279
ichizok0d47ad42022-01-11 13:05:26 +0000280 - name: Generate gcov files
ichizok41ee5b12022-02-12 10:13:13 +0000281 if: matrix.coverage
Bram Moolenaare5492602020-12-22 19:05:33 +0100282 run: |
283 cd "${SRCDIR}"
ichizok0d47ad42022-01-11 13:05:26 +0000284 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
285
286 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100287 timeout-minutes: 20
ichizok41ee5b12022-02-12 10:13:13 +0000288 if: matrix.coverage
dependabot[bot]ea7f2f22024-02-06 10:46:10 +0100289 uses: codecov/codecov-action@v4
ichizok0d47ad42022-01-11 13:05:26 +0000290 with:
ichizok41ee5b12022-02-12 10:13:13 +0000291 flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ matrix.extra }}
K.Takatabd2f45a2024-02-10 02:18:11 +0900292 token: ${{ secrets.CODECOV_TOKEN }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100293
294 - name: ASan logs
295 if: contains(matrix.extra, 'asan') && !cancelled()
296 run: |
ichizok41ee5b12022-02-12 10:13:13 +0000297 for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do
ichizok0d47ad42022-01-11 13:05:26 +0000298 asan_symbolize -l "$f"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100299 false # in order to fail a job
300 done
301
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100302 macos:
rhysde93d5ca2024-02-01 21:22:14 +0100303 runs-on: ${{ matrix.runner }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100304
305 env:
ichizok48c01962021-12-11 17:34:19 +0000306 CC: clang
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100307 TEST: test
308 SRCDIR: ./src
309 LEAK_CFLAGS: -DEXITFREE
310 TERM: xterm
311
312 strategy:
313 fail-fast: false
314 matrix:
ichizok48c01962021-12-11 17:34:19 +0000315 features: [tiny, normal, huge]
rhysde93d5ca2024-02-01 21:22:14 +0100316 runner: [macos-latest, macos-14]
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100317
318 steps:
Philip Hbfaa24f2022-06-01 21:26:34 +0100319 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200320 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100321
rhysde93d5ca2024-02-01 21:22:14 +0100322 - name: Install packages on Intel Mac
323 if: matrix.features == 'huge' && matrix.runner == 'macos-latest'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100324 run: |
325 brew install lua
326 echo "LUA_PREFIX=/usr/local" >> $GITHUB_ENV
327
rhysde93d5ca2024-02-01 21:22:14 +0100328 - name: Install packages on M1 Mac
329 if: matrix.features == 'huge' && matrix.runner == 'macos-14'
330 run: |
331 brew install lua libtool
332 echo "LUA_PREFIX=/opt/homebrew" >> $GITHUB_ENV
333
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100334 - name: Set up environment
335 run: |
336 (
337 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
338 case "${{ matrix.features }}" in
339 tiny)
340 echo "TEST=testtiny"
341 echo "CONFOPT=--disable-gui"
342 ;;
ichizok48c01962021-12-11 17:34:19 +0000343 normal)
344 ;;
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100345 huge)
Philip Hd094e582022-10-16 14:53:34 +0100346 echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100347 ;;
348 esac
349 ) >> $GITHUB_ENV
350
351 - name: Configure
352 run: |
353 ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing
354 # Append various warning flags to CFLAGS.
355 # BSD sed needs backup extension specified.
356 sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
357 # On macOS, the entity of gcc is clang.
358 sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk
ichizokdee78e12021-12-09 21:08:01 +0000359 # Suppress some warnings produced by clang 12 and later.
360 if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then
361 sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
362 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100363
364 - name: Build
Bram Moolenaar9aff9702020-12-21 13:37:28 +0100365 env:
Bram Moolenaared1e4c92020-12-28 15:46:47 +0100366 LC_ALL: C
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100367 run: |
368 make -j${NPROC}
369
370 - name: Check version
371 run: |
372 "${SRCDIR}"/vim --version
373 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
374 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
375
376 - name: Test
377 timeout-minutes: 20
378 run: |
379 make ${TEST}
380
381 windows:
Philip H361f9d22022-06-14 11:35:21 +0100382 runs-on: windows-2022
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100383
384 env:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100385 # Interfaces
386 # Lua
387 LUA_VER: 54
388 LUA_VER_DOT: '5.4'
Philip H18f75932022-02-12 10:53:07 +0000389 LUA_RELEASE: 5.4.2
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100390 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip
391 LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip
392 LUA_DIR: D:\Lua
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100393 # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l
394 LUA_DIR_SLASH: D:/Lua
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100395 # Python 2
396 PYTHON_VER: 27
397 PYTHON_VER_DOT: '2.7'
Philip H361f9d22022-06-14 11:35:21 +0100398 PYTHON_DIR: 'C:\Python27'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100399 # Python 3
Philip Hef91ae42022-12-30 17:41:17 +0000400 PYTHON3_VER: 311
401 PYTHON3_VER_DOT: '3.11'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100402 # Other dependencies
403 # winpty
404 WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip
ichizok2f147162023-04-26 15:43:39 +0100405 # libsodium
406 SODIUM_VER: '1.0.18'
407 SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip
408 SODIUM_MSVC_VER: v143
409 SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz
410 SODIUM_MINGW_VER: 23
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100411 # Escape sequences
412 COL_RED: "\x1b[31m"
413 COL_GREEN: "\x1b[32m"
414 COL_YELLOW: "\x1b[33m"
415 COL_RESET: "\x1b[m"
416
417 strategy:
418 fail-fast: false
419 matrix:
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100420 include:
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200421 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable }
422 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes }
K.Takata2da11a42022-09-10 13:03:12 +0100423 - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 }
424 - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes }
425 - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 }
426 - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 }
427 - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 }
428 - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 }
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100429
430 steps:
Bram Moolenaar53f7fcc2021-07-28 20:10:16 +0200431 - name: Initialize
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100432 id: init
433 shell: bash
434 run: |
K.Takata80613d62022-11-09 16:12:47 +0000435 # Show Windows version
436 cmd /c ver
437
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100438 git config --global core.autocrlf input
K.Takata2da11a42022-09-10 13:03:12 +0100439
ichizok2f147162023-04-26 15:43:39 +0100440 if ${{ matrix.arch == 'x64' }}; then
K.Takata2da11a42022-09-10 13:03:12 +0100441 cygreg=registry
442 pyreg=
443 echo "VCARCH=amd64" >> $GITHUB_ENV
444 echo "WARCH=x64" >> $GITHUB_ENV
445 echo "BITS=64" >> $GITHUB_ENV
446 echo "MSYSTEM=MINGW64" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100447 else
K.Takata2da11a42022-09-10 13:03:12 +0100448 cygreg=registry32
449 pyreg=-32
450 echo "VCARCH=x86" >> $GITHUB_ENV
451 echo "WARCH=ia32" >> $GITHUB_ENV
452 echo "BITS=32" >> $GITHUB_ENV
453 echo "MSYSTEM=MINGW32" >> $GITHUB_ENV
Philip H361f9d22022-06-14 11:35:21 +0100454 fi
K.Takata2da11a42022-09-10 13:03:12 +0100455
456 echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV
ichizok2f147162023-04-26 15:43:39 +0100457 if ${{ matrix.features != 'TINY' }}; then
458 if ${{ matrix.arch == 'x86' }}; then
K.Takata80613d62022-11-09 16:12:47 +0000459 choco install python2 --no-progress --forcex86
K.Takata2da11a42022-09-10 13:03:12 +0100460 else
K.Takata80613d62022-11-09 16:12:47 +0000461 choco install python2 --no-progress
K.Takata2da11a42022-09-10 13:03:12 +0100462 fi
463 fi
464 python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@")
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100465 echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV
466
ichizok2f147162023-04-26 15:43:39 +0100467 if ${{ matrix.toolchain == 'msvc' }}; then
468 SODIUM_DIR=D:\\libsodium
469 echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV
470 else
471 SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }}
472 echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV
473 fi
474 echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV
475
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100476 - uses: msys2/setup-msys2@v2
477 if: matrix.toolchain == 'mingw'
478 with:
Philip H361f9d22022-06-14 11:35:21 +0100479 update: true
480 install: tar
481 pacboy: >-
482 make:p gcc:p
K.Takata2da11a42022-09-10 13:03:12 +0100483 msystem: ${{ env.MSYSTEM }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100484 release: false
485
Philip Hbfaa24f2022-06-01 21:26:34 +0100486 - name: Checkout repository from github
dependabot[bot]213c3232023-09-11 19:43:33 +0200487 uses: actions/checkout@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100488
489 - name: Create a list of download URLs
490 shell: cmd
491 run: |
492 type NUL > urls.txt
493 echo %LUA_RELEASE%>> urls.txt
494 echo %WINPTY_URL%>> urls.txt
ichizok2f147162023-04-26 15:43:39 +0100495 echo %SODIUM_VER%>> urls.txt
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100496
497 - name: Cache downloaded files
dependabot[bot]1cee5092024-01-22 20:06:01 +0100498 uses: actions/cache@v4
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100499 with:
500 path: downloads
K.Takata2da11a42022-09-10 13:03:12 +0100501 key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100502
503 - name: Download dependencies
504 shell: cmd
505 run: |
506 path C:\Program Files\7-Zip;%path%
507 if not exist downloads mkdir downloads
508
509 echo %COL_GREEN%Download Lua%COL_RESET%
K.Takata2da11a42022-09-10 13:03:12 +0100510 call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100511 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1
512
513 echo %COL_GREEN%Download winpty%COL_RESET%
514 call :downloadfile %WINPTY_URL% downloads\winpty.zip
515 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1
K.Takata2da11a42022-09-10 13:03:12 +0100516 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll
517 copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100518
ichizok2f147162023-04-26 15:43:39 +0100519 echo %COL_GREEN%Download libsodium%COL_RESET%
520 if "${{ matrix.toolchain }}"=="msvc" (
521 call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip
522 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1
523 ) else (
524 call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz
525 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1
526 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll
527 )
528
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100529 goto :eof
530
531 :downloadfile
532 :: call :downloadfile <URL> <localfile>
533 if not exist %2 (
534 curl -f -L %1 -o %2
535 )
536 if ERRORLEVEL 1 (
537 rem Retry once.
538 curl -f -L %1 -o %2 || exit 1
539 )
540 goto :eof
541
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100542 - name: Build (MSVC)
543 if: matrix.toolchain == 'msvc'
544 shell: cmd
545 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100546 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100547 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100548 if "${{ matrix.VIMDLL }}"=="yes" (
549 set GUI=yes
550 ) else (
551 set GUI=${{ matrix.GUI }}
552 )
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200553 if "${{ matrix.python3 }}"=="stable" (
554 set PYTHON3_STABLE=yes
555 ) else (
556 set PYTHON3_STABLE=no
557 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100558 if "${{ matrix.features }}"=="HUGE" (
K.Takata47d16662022-01-26 16:20:21 +0000559 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100560 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 DYNAMIC_LUA=yes LUA=%LUA_DIR% ^
563 DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^
ichizok2f147162023-04-26 15:43:39 +0100564 DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200565 DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^
ichizok2f147162023-04-26 15:43:39 +0100566 DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100567 ) else (
K.Takata47d16662022-01-26 16:20:21 +0000568 nmake -nologo -f Make_mvc.mak ^
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100569 FEATURES=${{ matrix.features }} ^
K.Takata2da11a42022-09-10 13:03:12 +0100570 GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100571 )
572
573 - name: Build (MinGW)
574 if: matrix.toolchain == 'mingw'
575 shell: msys2 {0}
576 run: |
577 cd src
K.Takata2da11a42022-09-10 13:03:12 +0100578 if [ "${{ matrix.VIMDLL }}" = "yes" ]; then
579 GUI=yes
580 else
581 GUI=${{ matrix.GUI }}
582 fi
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200583 if [ "${{ matrix.python3 }}" = "stable" ]; then
584 PYTHON3_STABLE=yes
585 else
586 PYTHON3_STABLE=no
587 fi
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100588 if [ "${{ matrix.features }}" = "HUGE" ]; then
589 mingw32-make -f Make_ming.mak -j2 \
590 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100591 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Christian Brabandt2890c0b2022-05-02 10:34:15 +0100592 DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100593 DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \
594 DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \
Yee Cheng Chinc13b3d12023-08-20 21:18:38 +0200595 DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \
ichizok2f147162023-04-26 15:43:39 +0100596 DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR} \
ichizok0cd3e942022-02-14 11:36:57 +0000597 STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }}
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100598 else
599 mingw32-make -f Make_ming.mak -j2 \
600 FEATURES=${{ matrix.features }} \
K.Takata2da11a42022-09-10 13:03:12 +0100601 GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100602 STATIC_STDCPLUS=yes
603 fi
604
ichizok0cd3e942022-02-14 11:36:57 +0000605 - name: Check version
606 shell: cmd
K.Takata83e36c82022-02-21 17:49:28 +0000607 run: |
K.Takata2da11a42022-09-10 13:03:12 +0100608 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%
609 if "${{ matrix.GUI }}"=="yes" (
610 start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1
611 type version.txt
612 echo.
613 start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q"
614 start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q"
615 type version.txt
616 del version.txt
617 ) else (
618 src\vim --version || exit 1
619 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
620 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
621 )
ichizok0cd3e942022-02-14 11:36:57 +0000622
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100623 #- name: Prepare Artifact
624 # shell: cmd
625 # run: |
626 # mkdir artifacts
627 # copy src\*vim.exe artifacts
628 # copy src\vim*.dll artifacts
629 #
630 #- name: Upload Artifact
631 # uses: actions/upload-artifact@v1
632 # with:
633 # name: vim${{ matrix.bits }}-${{ matrix.toolchain }}
634 # path: ./artifacts
635
ichizok0cd3e942022-02-14 11:36:57 +0000636 - name: Test and show the result of testing gVim
K.Takata2da11a42022-09-10 13:03:12 +0100637 if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes'
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100638 shell: cmd
K.Takata2da11a42022-09-10 13:03:12 +0100639 timeout-minutes: 15
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100640 run: |
ichizok2f147162023-04-26 15:43:39 +0100641 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100642 call "%VCVARSALL%" %VCARCH%
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100643
ichizok0cd3e942022-02-14 11:36:57 +0000644 echo %COL_GREEN%Test gVim:%COL_RESET%
645 cd src\testdir
K.Takata2da11a42022-09-10 13:03:12 +0100646 if "${{ matrix.GUI }}"=="yes" (
647 nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1
648 ) else (
649 @rem Run only tiny tests.
650 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100651 )
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100652
K.Takata2da11a42022-09-10 13:03:12 +0100653 - name: Test and show the result of testing Vim
654 if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes'
655 shell: cmd
656 timeout-minutes: 15
657 run: |
ichizok2f147162023-04-26 15:43:39 +0100658 PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PATH%;%PYTHON3_DIR%;%SODIUM_LIB%
K.Takata2da11a42022-09-10 13:03:12 +0100659 call "%VCVARSALL%" %VCARCH%
ichizok0cd3e942022-02-14 11:36:57 +0000660
K.Takata2da11a42022-09-10 13:03:12 +0100661 echo %COL_GREEN%Test Vim:%COL_RESET%
662 cd src\testdir
663 nmake -nologo -f Make_mvc.mak clean
664 if "${{ matrix.GUI }}"=="no" (
665 nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1
666 ) else (
667 @rem Run only tiny tests.
668 nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1
Bram Moolenaar8ea05de2020-12-17 20:27:26 +0100669 )
ichizok41ee5b12022-02-12 10:13:13 +0000670
671 - name: Generate gcov files
ichizok0cd3e942022-02-14 11:36:57 +0000672 if: matrix.coverage
ichizok41ee5b12022-02-12 10:13:13 +0000673 shell: msys2 {0}
674 run: |
675 cd src
676 find . -type f -name '*.gcno' -exec gcov -pb {} + || true
ichizok41ee5b12022-02-12 10:13:13 +0000677
K.Takata2da11a42022-09-10 13:03:12 +0100678 - name: Codecov
Philip H982ded62023-06-22 18:12:46 +0100679 timeout-minutes: 20
ichizok0cd3e942022-02-14 11:36:57 +0000680 if: matrix.coverage
dependabot[bot]ea7f2f22024-02-06 10:46:10 +0100681 uses: codecov/codecov-action@v4
ichizok41ee5b12022-02-12 10:13:13 +0000682 with:
683 directory: src
ichizok41ee5b12022-02-12 10:13:13 +0000684 flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }}
K.Takatabd2f45a2024-02-10 02:18:11 +0900685 token: ${{ secrets.CODECOV_TOKEN }}