Debian Codegraph @

.github/actions/build_vim_on_linux/action.yml

raw
1 name: Build Vim on Linux
2 description: Build Vim on Linux
3
4 inputs:
5 features:
6 description: Vim features
7 required: true
8 compiler:
9 description: Compiler
10 required: true
11 architecture:
12 description: Architecture
13 required: false
14 extra:
15 description: Extra flags
16 required: true
17 shadow:
18 description: Shadow directory
19 required: false
20 interface:
21 description: Interface of language interpreter
22 required: false
23 lua_ver:
24 description: Lua version
25 required: false
26 python3:
27 description: Python3 ABI type
28 required: false
29 coverage:
30 description: Enable coverage
31 required: false
32
33 runs:
34 using: "composite"
35 steps:
36 - name: Check Filelist (for packaging)
37 shell: bash
38 run: |
39 echo '::group::Check Filelist (for packaging)'
40 # If any files in the repository are not listed in Filelist this will
41 # exit with an error code and list the missing entries.
42 make -f ci/unlisted.make
43 echo '::endgroup::'
44
45 - name: Check hlgroups (are any new hlgroups added, but not handled in highlight.c)
46 shell: bash
47 run: |
48 echo '::group::Check hlgroups (are any new hlgroups added, but not handled in highlight.c)'
49 # If any highlight groups have been documented, but not handled in
50 # highlight.c, nor listed as 'intentionally left out' in hlgroups.ignore,
51 # exit with an error code and list the missing entries.
52 make -C ci -f hlgroups.make
53 echo '::endgroup::'
54
55 - name: Report executable syntax tests
56 if: contains(fromJSON(inputs.extra), 'syn_test_execs')
57 shell: bash
58 run: |
59 echo '::group::Report executable syntax tests'
60 # Search and list all found executable syntax tests, and exit with
61 # an error code.
62 make -C runtime/syntax executables
63 echo '::endgroup::'
64
65 - name: Add i386 packages to dpkg
66 if: inputs.architecture == 'i386'
67 shell: bash
68 run: |
69 echo '::group::Add i386 packages to dpkg'
70 sudo dpkg --add-architecture i386
71 echo '::endgroup::'
72
73 - name: Uninstall snap
74 shell: bash
75 run: |
76 echo '::group::Uninstall snap'
77 sudo bash ci/remove_snap.sh
78 echo '::endgroup::'
79
80 - name: Enable debug packages
81 shell: bash
82 run: |
83 echo '::group::Enable debug packages'
84 # Some of the ASAN suppressions are in libraries linked with dlopen
85 # and symbolization of them requires these debug packages.
86 sudo apt install ubuntu-dbgsym-keyring
87 sudo cp ci/ddebs.list /etc/apt/sources.list.d/ddebs.list
88 sudo cp ci/pinned-pkgs /etc/apt/preferences.d/pinned-pkgs
89 echo '::endgroup::'
90
91 # TODO: switch to GTK4 GUI
92 - name: Install packages
93 shell: bash
94 run: |
95 echo '::group::Install packages'
96 # This is added by default, and it is often broken, but we don't need anything from it
97 sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
98 PKGS=( \
99 gettext \
100 x11-utils \
101 labwc \
102 wl-clipboard \
103 wayland-utils \
104 libgtk-3-dev:${{ inputs.architecture }} \
105 libgtk-3-bin:${{ inputs.architecture }} \
106 desktop-file-utils \
107 libc6-dbgsym:${{ inputs.architecture }} \
108 libtool-bin \
109 libncurses-dev:${{ inputs.architecture }} \
110 libxt-dev:${{ inputs.architecture }} \
111 libegl-mesa0:${{ inputs.architecture }} \
112 libegl1:${{ inputs.architecture }} \
113 libegl1-mesa-dev:${{ inputs.architecture }} \
114 libepoxy-dev:${{ inputs.architecture }} \
115 libwayland-egl1:${{ inputs.architecture }} \
116 libwayland-client0:${{ inputs.architecture }} \
117 libwayland-cursor0:${{ inputs.architecture }} \
118 locales-all \
119 software-properties-common \
120 )
121 if ${{ contains(fromJSON(inputs.extra), 'asan') }} && ${{ contains(inputs.architecture, 'native') }}; then
122 PKGS+=( \
123 libepoxy0-dbgsym:${{ inputs.architecture }} \
124 libxdamage1-dbgsym:${{ inputs.architecture }} \
125 libxcb1-dbgsym:${{ inputs.architecture }} \
126 libgtk-3-bin-dbgsym:${{ inputs.architecture }} \
127 libgtk-3-0t64-dbgsym:${{ inputs.architecture }} \
128 libglib2.0-0t64-dbgsym:${{ inputs.architecture }} \
129 libglib2.0-bin-dbgsym:${{ inputs.architecture }} \
130 libglib2.0-dev-bin-dbgsym:${{ inputs.architecture }} \
131 )
132 fi
133 if ${{ inputs.features == 'huge' }}; then
134 LUA_VER=${{ inputs.lua_ver || '5.4' }}
135 PKGS+=( \
136 autoconf \
137 gdb \
138 lcov \
139 libcanberra-dev \
140 libperl-dev \
141 python3-dev \
142 liblua${LUA_VER}-dev \
143 lua${LUA_VER} \
144 ruby-dev \
145 tcl-dev \
146 cscope \
147 libsodium-dev \
148 attr \
149 libattr1-dev
150 )
151 fi
152 if ${{ contains(fromJSON(inputs.extra), 'proto') }}; then
153 PKGS+=( python3-clang )
154 fi
155 sudo apt-get update && sudo apt-get upgrade -y --allow-downgrades && sudo apt-get install -y --allow-downgrades "${PKGS[@]}"
156
157 - name: Install gcc-${{ env.GCC_VER }}
158 if: inputs.compiler == 'gcc'
159 shell: bash
160 run: |
161 echo '::group::Install gcc-${{ env.GCC_VER }}'
162 # ubuntu-toolchain-r/test PPA for gcc-13 compiler
163 # disabled because the installation failed, causing test failures
164 # sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
165 sudo apt-get update -y
166 sudo apt-get install -y gcc-${{ env.GCC_VER }}:${{ inputs.architecture }}
167 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VER }} 100
168 sudo update-alternatives --set gcc /usr/bin/gcc-${{ env.GCC_VER }}
169 echo '::endgroup::'
170
171 - name: Install clang-${{ env.CLANG_VER }}
172 if: inputs.compiler == 'clang'
173 shell: bash
174 run: |
175 echo '::group::Install clang-${{ env.CLANG_VER }}'
176 . /etc/lsb-release
177 curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/llvm-archive-keyring.gpg > /dev/null
178 echo "Types: deb
179 URIs: https://apt.llvm.org/${DISTRIB_CODENAME}/
180 Suites: llvm-toolchain-${DISTRIB_CODENAME}-${{ env.CLANG_VER }}
181 Components: main
182 Signed-By: /usr/share/keyrings/llvm-archive-keyring.gpg" | sudo tee /etc/apt/sources.list.d/llvm-toolchain.sources > /dev/null
183 sudo apt-get update -y
184 sudo apt-get install -y clang-${{ env.CLANG_VER }} llvm-${{ env.CLANG_VER }}
185 sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VER }} 100
186 sudo update-alternatives --set clang /usr/bin/clang-${{ env.CLANG_VER }}
187 sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${{ env.CLANG_VER }} 100
188 sudo update-alternatives --install /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-${{ env.CLANG_VER }} 100
189 echo '::endgroup::'
190
191 - name: Set up environment
192 shell: bash
193 run: |
194 echo '::group::Set up environment'
195 mkdir -p "${LOG_DIR}"
196 mkdir -p "${HOME}/bin"
197 echo "${HOME}/bin" >> $GITHUB_PATH
198 (
199 echo "LINUX_VERSION=$(uname -r)"
200 echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
201 echo "TMPDIR=$(mktemp -d -p /tmp)"
202
203 case "${{ inputs.features }}" in
204 tiny)
205 echo "TEST=testtiny"
206 if ${{ contains(fromJSON(inputs.extra), 'nogui') }}; then
207 CONFOPT="--disable-gui"
208 fi
209 ;;
210 normal)
211 ;;
212 huge)
213 echo "TEST=scripttests test_libvterm indenttest syntaxtest"
214 INTERFACE=${{ inputs.interface || 'yes' }}
215 if ${{ inputs.python3 == 'stable-abi' }}; then
216 PYTHON3_CONFOPT="--with-python3-stable-abi=3.8"
217 fi
218 # The ubuntu-24.04 CI runner does not provide a python2 package.
219 CONFOPT="--enable-perlinterp=${INTERFACE} --enable-pythoninterp=no --enable-python3interp=${INTERFACE} --enable-rubyinterp=${INTERFACE} --enable-luainterp=${INTERFACE} --enable-tclinterp=${INTERFACE} ${PYTHON3_CONFOPT}"
220 ;;
221 esac
222
223 if ${{ contains(fromJSON(inputs.extra), 'no_x11_wl') }}; then
224 CONFOPT="${CONFOPT} --without-x --disable-gui --without-wayland --enable-socketserver"
225 fi
226 if ${{ inputs.coverage == true }}; then
227 CFLAGS="${CFLAGS} --coverage -DUSE_GCOV_FLUSH"
228 echo "LDFLAGS=--coverage"
229 fi
230 if ${{ contains(fromJSON(inputs.extra), 'uchar') }}; then
231 CFLAGS="${CFLAGS} -funsigned-char"
232 fi
233 if ${{ contains(fromJSON(inputs.extra), 'testgui') }}; then
234 echo "TEST=-C src testgui"
235 fi
236 if ${{ contains(fromJSON(inputs.extra), 'unittests') }}; then
237 echo "TEST=unittests"
238 fi
239 if ${{ contains(fromJSON(inputs.extra), 'asan') }}; then
240 echo "SANITIZER_CFLAGS=-g -O0 -DABORT_ON_INTERNAL_ERROR -DEXITFREE -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer"
241 echo "ASAN_OPTIONS=print_stacktrace=1:log_path=${LOG_DIR}/asan"
242 echo "UBSAN_OPTIONS=print_stacktrace=1:log_path=${LOG_DIR}/ubsan"
243 echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/src/testdir/lsan-suppress.txt"
244 fi
245 if ${{ contains(fromJSON(inputs.extra), 'vimtags') }}; then
246 echo "TEST=-C runtime/doc vimtags VIMEXE=../../${SRCDIR}/vim"
247 fi
248 if ${{ contains(fromJSON(inputs.extra), 'proto') }}; then
249 echo "TEST=-C src protoclean proto"
250 fi
251 echo "CFLAGS=${CFLAGS}"
252 echo "CONFOPT=${CONFOPT}"
253 # Disables GTK attempt to integrate with the accessibility service that does run in CI.
254 echo "NO_AT_BRIDGE=1"
255 ) >> $GITHUB_ENV
256 echo '::endgroup::'
257
258 - name: Set up system
259 shell: bash
260 run: |
261 echo '::group::Set up system'
262 if [[ ${CC} = clang ]]; then
263 # Use llvm-cov instead of gcov when compiler is clang.
264 ln -fs /usr/bin/llvm-cov ${HOME}/bin/gcov
265 fi
266 sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
267 sudo usermod -a -G audio "${USER}"
268 sudo bash ci/setup-xvfb.sh
269 echo '::endgroup::'
270
271 - name: Check autoconf
272 if: contains(fromJSON(inputs.extra), 'unittests')
273 shell: bash
274 run: |
275 echo '::group::Check autoconf'
276 make -C src autoconf
277 echo '::endgroup::'
278
279 - name: Set up shadow dir
280 if: inputs.shadow
281 shell: bash
282 run: |
283 echo '::group::Set up shadow dir'
284 make -C src shadow
285 echo "SRCDIR=${{ inputs.shadow }}" >> $GITHUB_ENV
286 echo "SHADOWOPT=-C ${{ inputs.shadow }}" >> $GITHUB_ENV
287 echo '::endgroup::'
288
289 - name: Configure
290 shell: bash
291 run: |
292 echo '::group::Configure'
293 ./configure --with-features=${{ inputs.features }} ${CONFOPT} --enable-fail-if-missing
294 # Append various warning flags to CFLAGS.
295 sed -i -f ci/config.mk.sed ${SRCDIR}/auto/config.mk
296 sed -i -f ci/config.mk.${CC}.sed ${SRCDIR}/auto/config.mk
297 if [[ ${CC} = clang ]]; then
298 # Suppress some warnings produced by clang 12 and later.
299 sed -i -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk
300 fi
301 echo '::endgroup::'
302
303 - name: Build
304 if: (!contains(fromJSON(inputs.extra), 'unittests'))
305 shell: bash
306 run: |
307 echo '::group::Build'
308 make ${SHADOWOPT} -j${NPROC}
309 echo '::endgroup::'
310
311 - name: Check version
312 if: (!contains(fromJSON(inputs.extra), 'unittests'))
313 shell: bash
314 run: |
315 echo '::group::Check version'
316 "${SRCDIR}"/vim --version
317 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit
318 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
319 if ${{ inputs.features == 'huge' }}; then
320 # Also check that optional and dynamic features are configured and working
321 "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 \
322 -c "let g:required=['gettext', 'sodium', 'sound', 'perl', 'python3', 'lua', 'ruby', 'tcl']" \
323 -S ci/if_feat_check.vim -c quit
324 fi
325 echo '::endgroup::'