name: GitHub CI on: push: branches: ["**"] pull_request: # Cancels all previous workflow runs for pull requests that have not completed. concurrency: # The concurrency group contains the workflow name and the branch name for # pull requests or the commit hash for any other events. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true permissions: contents: read # to fetch code (actions/checkout) jobs: linux: runs-on: ${{ matrix.architecture == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} env: CC: ${{ matrix.compiler }} GCC_VER: 14 CLANG_VER: 22 TEST: test SRCDIR: ./src LEAK_CFLAGS: -DEXITFREE LOG_DIR: ${{ github.workspace }}/logs TERM: xterm DISPLAY: ":99" DEBIAN_FRONTEND: noninteractive strategy: fail-fast: false matrix: features: [tiny, normal, huge] compiler: [clang, gcc] extra: [[]] # Only use non-native architecture when features != huge. # features=huge tries to install python3-dev, which fails to install # for the non-native architecture. architecture: [native] include: - features: tiny compiler: clang extra: [nogui] - features: tiny compiler: gcc extra: [nogui, syn_test_execs] - features: tiny compiler: gcc extra: [nogui] architecture: arm64 - features: normal shadow: ./src/shadow compiler: gcc architecture: i386 - features: huge coverage: true - features: huge compiler: clang interface: dynamic python3: stable-abi - features: huge compiler: gcc coverage: true interface: dynamic extra: [uchar, testgui] - features: huge compiler: gcc coverage: true extra: [unittests] - features: huge compiler: gcc coverage: true extra: [unittests] architecture: arm64 - features: normal compiler: gcc extra: [vimtags, proto, preproc_indent, encoding, codestyle] - features: huge compiler: gcc extra: [no_x11_wl] steps: - name: Checkout repository from GitHub uses: actions/checkout@v6 - name: Build timeout-minutes: 15 uses: ./.github/actions/build_vim_on_linux with: features: ${{ matrix.features }} compiler: ${{ matrix.compiler }} architecture: ${{ matrix.architecture }} extra: ${{ toJSON(matrix.extra) }} shadow: ${{ matrix.shadow }} interface: ${{ matrix.interface }} lua_ver: ${{ matrix.lua_ver }} python3: ${{ matrix.python3 }} coverage: ${{ matrix.coverage }} - name: Test timeout-minutes: 20 run: make ${SHADOWOPT} ${TEST} # Enable to debug failing tests live and ssh into the CI runners # - name: Setup tmate session # if: ${{ failure() }} # uses: mxschmitt/action-tmate@v3 # with: # limit-access-to-actor: true - name: Upload failed test artifacts if: ${{ !cancelled() }} uses: ./.github/actions/test_artifacts - name: Vim tags if: contains(matrix.extra, 'vimtags') run: | # This will exit with an error code if the generated vim tags differs from source. ( cd runtime/doc git diff --exit-code -- tags make html; rm *.html tags.ref; test -f errors.log && exit 3; true ) - name: Generate Proto files if: contains(matrix.extra, 'proto') run: | # This will exit with an error code if the generated proto files differ from source ( git diff --exit-code -- src/proto/ true ) - name: Check Source Code style if: contains(matrix.extra, 'codestyle') run: | make -C src/testdir codestyle - name: Check preprocessor indent if: contains(matrix.extra, 'preproc_indent') run: | # This will exit with an error code if the files differ from source ( "${SRCDIR}"/vim -u NONE --not-a-term -esNX +"cd runtime/tools" -S preproc_indent.vim git diff --exit-code -- src/*.[ch] src/xxd/xxd.c true ) - name: Check encoding of utf-8 runtime files if: contains(matrix.extra, 'encoding') run: | # This will exit with an error code if utf-8 runtime files are not in utf-8 encoding ( find . -type f -name "*utf-8*.vim" -exec sh -c \ 'iconv -f utf-8 -t utf-8 "$1" >/dev/null 2>&1 || echo "non utf-8 encoding detected in $1"' \ find-sh {} \; |grep "non utf-8 encoding" && exit 3 true ) - name: Generate gcov files if: matrix.coverage run: | cd "${SRCDIR}" find . -type f -name '*.gcno' -exec gcov -pb {} + || true - name: Codecov timeout-minutes: 20 if: matrix.coverage uses: codecov/codecov-action@v6 with: flags: linux,${{ matrix.features }}-${{ matrix.compiler }}-${{ join(matrix.extra, '-') }} token: ${{ secrets.CODECOV_TOKEN }} linux-asan: runs-on: ubuntu-24.04 env: CC: clang CLANG_VER: 21 SRCDIR: ./src LEAK_CFLAGS: -DEXITFREE LOG_DIR: ${{ github.workspace }}/logs TERM: xterm DISPLAY: ":99" DEBIAN_FRONTEND: noninteractive strategy: fail-fast: false matrix: testset: - tinytests - newtests.1 - newtests.2 steps: - name: Checkout repository from GitHub uses: actions/checkout@v6 - name: Build timeout-minutes: 15 uses: ./.github/actions/build_vim_on_linux with: features: huge compiler: clang extra: '["asan"]' # Lua5.1 is the most widely used version (since it's what LuaJIT is # compatible with), so ensure it works lua_ver: "5.1" - name: Test (tinytests) if: matrix.testset == 'tinytests' timeout-minutes: 20 run: make ${TEST} NEW_TESTS_RES= - name: Test (newtests) if: startsWith(matrix.testset, 'newtests') timeout-minutes: 20 env: JOB_INDEX: ${{ strategy.job-index }} JOB_TOTAL: ${{ strategy.job-total }} run: | set -x make -C src/testdir SCRIPTS_TINY_OUT= \ NEW_TESTS_RES="$(python3 ci/gen_testset.py $((JOB_TOTAL-1)) | jq -r --argjson i $((JOB_INDEX-1)) '.[$i]|join(" ")')" - name: ASan logs if: ${{ !cancelled() }} run: | for f in $(grep -lR '#[[:digit:]]* *0x[[:xdigit:]]*' "${LOG_DIR}"); do ( echo "$f" asan_symbolize -l "$f" ) | tee "$f".symbolized false # in order to fail a job done - name: Upload failed test artifacts if: ${{ !cancelled() }} uses: ./.github/actions/test_artifacts macos: runs-on: ${{ matrix.runner }} env: CC: clang TEST: test SRCDIR: ./src LEAK_CFLAGS: -DEXITFREE TERM: xterm strategy: fail-fast: false matrix: features: [tiny, normal, huge] runner: [macos-15-intel, macos-26] steps: - name: Checkout repository from GitHub uses: actions/checkout@v6 - name: Install packages if: matrix.features == 'huge' run: | brew install lua libtool echo "LUA_PREFIX=$(brew --prefix)" >> $GITHUB_ENV - name: Set up environment run: | ( echo "NPROC=$(getconf _NPROCESSORS_ONLN)" case "${{ matrix.features }}" in tiny) echo "TEST=testtiny" echo "CONFOPT=--disable-gui" ;; normal) ;; huge) echo "CONFOPT=--enable-perlinterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp" ;; esac ) >> $GITHUB_ENV - name: Configure run: | ./configure --with-features=${{ matrix.features }} ${CONFOPT} --enable-fail-if-missing # Append various warning flags to CFLAGS. # BSD sed needs backup extension specified. sed -i.bak -f ci/config.mk.sed ${SRCDIR}/auto/config.mk # On macOS, the entity of gcc is clang. sed -i.bak -f ci/config.mk.clang.sed ${SRCDIR}/auto/config.mk # Suppress some warnings produced by clang 12 and later. if clang --version | grep -qs 'Apple clang version \(1[3-9]\|[2-9]\)\.'; then sed -i.bak -f ci/config.mk.clang-12.sed ${SRCDIR}/auto/config.mk fi - name: Build env: LC_ALL: C run: | make -j${NPROC} - name: Check version run: | "${SRCDIR}"/vim --version "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit if ${{ matrix.features == 'huge' }}; then # Also check that optional and dynamic features are configured and working "${SRCDIR}"/vim -u NONE -i NONE --not-a-term -esNX -V1 \ -c "let g:required=['sound', 'perl', 'python3', 'lua', 'ruby', 'tcl']" \ -S ci/if_feat_check.vim -c quit fi - name: Install packages for testing run: | # Apple diff is broken. Use GNU diff instead. See #14032. brew install diffutils - name: Test timeout-minutes: 25 run: | make ${TEST} - name: Upload failed test artifacts if: ${{ !cancelled() }} uses: ./.github/actions/test_artifacts windows: runs-on: windows-2022 env: # Interfaces # Lua LUA_VER: 54 LUA_VER_DOT: "5.4" LUA_RELEASE: 5.4.2 LUA32_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win32_dllw6_lib.zip LUA64_URL: https://downloads.sourceforge.net/luabinaries/lua-%LUA_RELEASE%_Win64_dllw6_lib.zip LUA_DIR: D:\Lua # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l LUA_DIR_SLASH: D:/Lua # Python 2 PYTHON_VER: 27 PYTHON_VER_DOT: "2.7" PYTHON_DIR: 'C:\Python27' # Python 3 PYTHON3_VER: 313 PYTHON3_VER_DOT: "3.13" # Other dependencies # winpty WINPTY_URL: https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip # libsodium SODIUM_VER: "1.0.20" # SODIUM_MSVC_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-msvc.zip SODIUM_MSVC_URL: https://github.com/jedisct1/libsodium/releases/download/%SODIUM_VER%-RELEASE/libsodium-%SODIUM_VER%-msvc.zip SODIUM_MSVC_VER: v143 # SODIUM_MINGW_URL: https://download.libsodium.org/libsodium/releases/libsodium-%SODIUM_VER%-stable-mingw.tar.gz SODIUM_MINGW_URL: https://github.com/jedisct1/libsodium/releases/download/%SODIUM_VER%-RELEASE/libsodium-%SODIUM_VER%-mingw.tar.gz SODIUM_MINGW_VER: 26 # Gettext-tools, iconv and libraries GETTEXT32_URL: https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.21-v1.16/gettext0.21-iconv1.16-shared-32.zip GETTEXT64_URL: https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.21-v1.16/gettext0.21-iconv1.16-shared-64.zip # Escape sequences COL_RED: "\x1b[31m" COL_GREEN: "\x1b[32m" COL_YELLOW: "\x1b[33m" COL_RESET: "\x1b[m" strategy: fail-fast: false matrix: include: - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, python3: stable } - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: yes, arch: x86, python3: stable, coverage: yes } - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: yes, arch: x86 } - { features: HUGE, toolchain: mingw, VIMDLL: yes, GUI: no, arch: x64, coverage: yes } - { features: HUGE, toolchain: msvc, VIMDLL: no, GUI: no, arch: x64, ttytype: conpty } - { features: NORMAL, toolchain: msvc, VIMDLL: yes, GUI: no, arch: x86 } - { features: NORMAL, toolchain: mingw, VIMDLL: no, GUI: yes, arch: x64 } - { features: TINY, toolchain: msvc, VIMDLL: yes, GUI: yes, arch: x64 } - { features: TINY, toolchain: mingw, VIMDLL: no, GUI: no, arch: x86 } steps: - name: Initialize id: init shell: bash run: | # Show Windows version cmd /c ver if ${{ matrix.arch == 'x64' }}; then cygreg=registry pyreg= echo "VCARCH=amd64" >> $GITHUB_ENV echo "WARCH=x64" >> $GITHUB_ENV echo "BITS=64" >> $GITHUB_ENV echo "MSYSTEM=MINGW64" >> $GITHUB_ENV else cygreg=registry32 pyreg=-32 echo "VCARCH=x86" >> $GITHUB_ENV echo "WARCH=ia32" >> $GITHUB_ENV echo "BITS=32" >> $GITHUB_ENV echo "MSYSTEM=MINGW32" >> $GITHUB_ENV fi echo "VCVARSALL=$(vswhere -products \* -latest -property installationPath)\\VC\\Auxiliary\\Build\\vcvarsall.bat" >> $GITHUB_ENV if ${{ matrix.features != 'TINY' }}; then if ${{ matrix.arch == 'x86' }}; then choco install python2 --no-progress --forcex86 else choco install python2 --no-progress fi fi python3_dir=$(cat "/proc/$cygreg/HKEY_LOCAL_MACHINE/SOFTWARE/Python/PythonCore/${PYTHON3_VER_DOT}$pyreg/InstallPath/@") echo "PYTHON3_DIR=$python3_dir" >> $GITHUB_ENV if ${{ matrix.toolchain == 'msvc' }}; then SODIUM_DIR=D:\\libsodium echo "SODIUM_LIB=${SODIUM_DIR}\\${{ matrix.arch == 'x64' && 'x64' || 'Win32' }}\\Release\\${SODIUM_MSVC_VER}\\dynamic" >> $GITHUB_ENV else SODIUM_DIR=D:\\libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }} # do not want \L to end up in pathdef.c and compiler complaining about unknown escape sequences \l SODIUM_DIR_SLASH=D:/libsodium-win${{ matrix.arch == 'x64' && '64' || '32' }} echo "SODIUM_LIB=${SODIUM_DIR}\\bin" >> $GITHUB_ENV echo "SODIUM_DIR_SLASH=${SODIUM_DIR_SLASH}" >> $GITHUB_ENV fi echo "SODIUM_DIR=${SODIUM_DIR}" >> $GITHUB_ENV echo "GETTEXT_PATH=D:\gettext${{ matrix.arch == 'x64' && '64' || '32' }}" >> $GITHUB_ENV - uses: msys2/setup-msys2@v2.31.1 if: matrix.toolchain == 'mingw' with: update: true install: tar pacboy: >- make:p gcc:p msystem: ${{ env.MSYSTEM }} release: false - name: Checkout repository from GitHub uses: actions/checkout@v6 - name: Create a list of download URLs shell: cmd run: | type NUL > urls.txt echo %LUA_RELEASE%>> urls.txt echo %WINPTY_URL%>> urls.txt echo %SODIUM_VER%>> urls.txt echo %GETTEXT32_URL%>> urls.txt echo %GETTEXT64_URL%>> urls.txt - name: Cache downloaded files uses: actions/cache@v5.0.5 with: path: downloads key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('urls.txt') }} - name: Download dependencies shell: cmd run: | path C:\Program Files\7-Zip;%path% if not exist downloads mkdir downloads echo %COL_GREEN%Download Lua%COL_RESET% call :downloadfile %LUA${{ env.BITS }}_URL% downloads\lua.zip 7z x downloads\lua.zip -o%LUA_DIR% > nul || exit 1 if not "${{ matrix.ttytype }}" == "conpty" ( echo %COL_GREEN%Download winpty%COL_RESET% call :downloadfile %WINPTY_URL% downloads\winpty.zip 7z x -y downloads\winpty.zip -oD:\winpty > nul || exit 1 copy /Y D:\winpty\%WARCH%\bin\winpty.dll src\winpty%BITS%.dll copy /Y D:\winpty\%WARCH%\bin\winpty-agent.exe src\ ) echo %COL_GREEN%Download libsodium%COL_RESET% if "${{ matrix.toolchain }}"=="msvc" ( call :downloadfile %SODIUM_MSVC_URL% downloads\libsodium.zip 7z x -y downloads\libsodium.zip -oD:\ > nul || exit 1 ) else ( call :downloadfile %SODIUM_MINGW_URL% downloads\libsodium.tar.gz 7z x -y downloads\libsodium.tar.gz -so | 7z x -si -ttar -oD:\ > nul || exit 1 mklink %SODIUM_LIB%\libsodium.dll %SODIUM_LIB%\libsodium-%SODIUM_MINGW_VER%.dll ) echo %COL_GREEN%Download Gettext%COL_RESET% call :downloadfile %GETTEXT${{ env.BITS }}_URL% downloads\gettext${{ env.BITS }}.zip 7z e -y downloads\gettext${{ env.BITS }}.zip -oD:\gettext${{ env.BITS }} > nul || exit 1 copy /y D:\gettext${{ env.BITS }}\libintl-8.dll src\ || exit 1 copy /y D:\gettext${{ env.BITS }}\libiconv-2.dll src\ || exit 1 goto :eof :downloadfile :: call :downloadfile if not exist %2 ( curl -f -L %1 -o %2 ) if ERRORLEVEL 1 ( rem Retry once. curl -f -L %1 -o %2 || exit 1 ) goto :eof - name: Build (MSVC) if: matrix.toolchain == 'msvc' shell: cmd run: | call "%VCVARSALL%" %VCARCH% cd src if "${{ matrix.VIMDLL }}"=="yes" ( set GUI=yes ) else ( set GUI=${{ matrix.GUI }} ) if "${{ matrix.python3 }}"=="stable" ( set PYTHON3_STABLE=yes ) else ( set PYTHON3_STABLE=no ) if "${{ matrix.features }}"=="HUGE" ( nmake -nologo -f Make_mvc.mak ^ FEATURES=${{ matrix.features }} ^ GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^ DYNAMIC_LUA=yes LUA=%LUA_DIR% ^ DYNAMIC_PYTHON=yes PYTHON=%PYTHON_DIR% ^ DYNAMIC_PYTHON3=yes PYTHON3=%PYTHON3_DIR% ^ DYNAMIC_PYTHON3_STABLE_ABI=%PYTHON3_STABLE% ^ DYNAMIC_SODIUM=yes SODIUM=%SODIUM_DIR% ^ CI_FLAGS=/we4267 ) else ( nmake -nologo -f Make_mvc.mak ^ FEATURES=${{ matrix.features }} ^ GUI=%GUI% IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} ^ CI_FLAGS=/we4267 ) - name: Build (MinGW) if: matrix.toolchain == 'mingw' shell: msys2 {0} run: | cd src if [ "${{ matrix.VIMDLL }}" = "yes" ]; then GUI=yes else GUI=${{ matrix.GUI }} fi if [ "${{ matrix.python3 }}" = "stable" ]; then PYTHON3_STABLE=yes else PYTHON3_STABLE=no fi if [ "${{ matrix.features }}" = "HUGE" ]; then mingw32-make -f Make_ming.mak -j2 \ FEATURES=${{ matrix.features }} \ GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \ DYNAMIC_LUA=yes LUA=${LUA_DIR_SLASH} \ DYNAMIC_PYTHON=yes PYTHON=${PYTHON_DIR} \ DYNAMIC_PYTHON3=yes PYTHON3=${PYTHON3_DIR} \ DYNAMIC_PYTHON3_STABLE_ABI=${PYTHON3_STABLE} \ DYNAMIC_SODIUM=yes SODIUM=${SODIUM_DIR_SLASH} \ STATIC_STDCPLUS=yes COVERAGE=${{ matrix.coverage }} else mingw32-make -f Make_ming.mak -j2 \ FEATURES=${{ matrix.features }} \ GUI=$GUI IME=yes ICONV=yes VIMDLL=${{ matrix.VIMDLL }} \ STATIC_STDCPLUS=yes fi - name: Check version shell: cmd run: | PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PYTHON3_DIR%;%PATH% if "${{ matrix.GUI }}"=="yes" ( start /wait src\gvim -u NONE -i NONE -c "redir > version.txt | ver | q" || exit 1 type version.txt echo. start /wait src\gvim -u NONE -i NONE -c "redir! > version.txt | so ci\if_ver-1.vim | q" start /wait src\gvim -u NONE -i NONE -c "redir >> version.txt | so ci\if_ver-2.vim | q" type version.txt del version.txt ) else ( src\vim --version || exit 1 src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-1.vim -c quit src\vim -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit if "${{ matrix.features }}"=="HUGE" ( src\vim -u NONE -i NONE --not-a-term -esNX -V1 ^ -c "let g:required=['gettext', 'sodium', 'sound', 'python3', 'lua']" ^ -S ci/if_feat_check.vim -c quit ) ) #- name: Prepare Artifact # shell: cmd # run: | # mkdir artifacts # copy src\*vim.exe artifacts # copy src\vim*.dll artifacts # #- name: Upload Artifact # uses: actions/upload-artifact@v7 # with: # name: vim${{ matrix.bits }}-${{ matrix.toolchain }} # path: ./artifacts # disabled because of https://github.com/tunisiano187/Chocolatey-packages/issues/3916 #- name: Install packages for testing # shell: bash # run: | # if ${{ matrix.features != 'TINY' }}; then # if ${{ matrix.arch == 'x64' }}; then # choco install netbeans --no-progress # else # exit 0 # fi # fi - name: Test and show the result of testing gVim if: matrix.GUI == 'yes' || matrix.VIMDLL == 'yes' shell: cmd timeout-minutes: 15 run: | PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PYTHON3_DIR%;%PATH%;%SODIUM_LIB% call "%VCVARSALL%" %VCARCH% echo %COL_GREEN%Test gVim:%COL_RESET% cd src\testdir if "${{ matrix.GUI }}"=="yes" ( nmake -nologo -f Make_mvc.mak VIMPROG=..\gvim || exit 1 ) else ( @rem Run only tiny tests. nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\gvim || exit 1 ) - name: Test and show the result of testing Vim if: matrix.GUI == 'no' || matrix.VIMDLL == 'yes' shell: cmd timeout-minutes: 15 run: | PATH %LUA_DIR%;C:\msys64\%MSYSTEM%\bin;%PYTHON3_DIR%;%PATH%;%SODIUM_LIB% call "%VCVARSALL%" %VCARCH% echo %COL_GREEN%Test Vim:%COL_RESET% cd src\testdir nmake -nologo -f Make_mvc.mak clean if "${{ matrix.GUI }}"=="no" ( nmake -nologo -f Make_mvc.mak VIMPROG=..\vim || exit 1 ) else ( @rem Run only tiny tests. nmake -nologo -f Make_mvc.mak tiny VIMPROG=..\vim || exit 1 ) - name: Upload failed test artifacts if: ${{ !cancelled() }} uses: ./.github/actions/test_artifacts - name: Generate gcov files if: matrix.coverage shell: msys2 {0} run: | cd src find . -type f -name '*.gcno' -exec gcov -pb {} + || true - name: Codecov timeout-minutes: 20 if: matrix.coverage uses: codecov/codecov-action@v6 with: directory: src flags: windows,${{ matrix.toolchain }}-${{ matrix.arch }}-${{ matrix.features }} token: ${{ secrets.CODECOV_TOKEN }}