test.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. name: test
  2. on:
  3. push:
  4. branches:
  5. - 'master'
  6. - 'release-[0-9]+.[0-9]+'
  7. pull_request:
  8. branches:
  9. - 'master'
  10. - 'release-[0-9]+.[0-9]+'
  11. workflow_dispatch:
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ github.ref }}
  14. cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  15. env:
  16. ASAN_OPTIONS: detect_leaks=1:check_initialization_order=1:log_path=${{ github.workspace }}/build/log/asan:intercept_tls_get_addr=0
  17. BIN_DIR: ${{ github.workspace }}/bin
  18. BUILD_DIR: ${{ github.workspace }}/build
  19. INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
  20. LOG_DIR: ${{ github.workspace }}/build/log
  21. NVIM_LOG_FILE: ${{ github.workspace }}/build/.nvimlog
  22. TSAN_OPTIONS: log_path=${{ github.workspace }}/build/log/tsan
  23. VALGRIND_LOG: ${{ github.workspace }}/build/log/valgrind-%p.log
  24. # TEST_FILE: test/functional/core/startup_spec.lua
  25. # TEST_FILTER: foo
  26. jobs:
  27. lint:
  28. runs-on: ubuntu-24.04
  29. timeout-minutes: 10
  30. env:
  31. CC: clang
  32. steps:
  33. - uses: actions/checkout@v4
  34. - uses: ./.github/actions/setup
  35. - name: Install stylua
  36. run: |
  37. wget --directory-prefix="$BIN_DIR" https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-x86_64.zip
  38. (cd "$BIN_DIR"; unzip stylua*.zip)
  39. - name: Build third-party deps
  40. run: |
  41. cmake -S cmake.deps -B .deps -G Ninja
  42. cmake --build .deps
  43. - run: cmake -B build -G Ninja -D CI_LINT=ON
  44. - if: "!cancelled()"
  45. name: Determine if run should be aborted
  46. id: abort_job
  47. run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT
  48. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  49. name: stylua
  50. run: cmake --build build --target lintlua-stylua
  51. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  52. name: luacheck
  53. run: cmake --build build --target lintlua-luacheck
  54. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  55. name: lintsh
  56. run: cmake --build build --target lintsh
  57. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  58. name: clint.py
  59. run: cmake --build build --target lintc-clint
  60. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  61. name: clang-tidy
  62. run: cmake --build build --target lintc-clang-tidy
  63. - if: success() || failure() && steps.abort_job.outputs.status == 'success'
  64. name: uncrustify
  65. run: cmake --build build --target lintc-uncrustify
  66. clang-analyzer:
  67. runs-on: ubuntu-24.04
  68. timeout-minutes: 20
  69. env:
  70. CC: clang
  71. steps:
  72. - uses: actions/checkout@v4
  73. - uses: ./.github/actions/setup
  74. - name: Build third-party deps
  75. run: |
  76. cmake -S cmake.deps --preset ci
  77. cmake --build .deps
  78. cmake --preset ci
  79. - run: cmake --build build --target clang-analyzer
  80. posix:
  81. name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
  82. strategy:
  83. fail-fast: false
  84. matrix:
  85. # The `os` field is not needed to differentiate between the different
  86. # matrix builds. It is needed to not change the required checks (which
  87. # uses jobs names) each time we bump the runner version. It may be
  88. # possible to remove if we e.g. start using `-latest` runner versions
  89. # or if github introduces a wildcard for required checks in the future.
  90. build:
  91. [
  92. { runner: ubuntu-24.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
  93. { runner: ubuntu-24.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
  94. { runner: ubuntu-24.04, os: ubuntu, flavor: release, cc: gcc, flags: -D CMAKE_BUILD_TYPE=Release },
  95. { runner: macos-13, os: macos, flavor: intel, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
  96. { runner: macos-15, os: macos, flavor: arm, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
  97. { runner: ubuntu-24.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
  98. ]
  99. test: [unittest, functionaltest, oldtest]
  100. exclude:
  101. - test: unittest
  102. build: { flavor: tsan }
  103. - test: unittest
  104. build: { flavor: puc-lua }
  105. - test: oldtest
  106. build: { flavor: tsan }
  107. runs-on: ${{ matrix.build.runner }}
  108. timeout-minutes: 45
  109. env:
  110. CC: ${{ matrix.build.cc }}
  111. steps:
  112. - uses: actions/checkout@v4
  113. - uses: ./.github/actions/setup
  114. with:
  115. install_flags: "--test"
  116. - name: Create log dir
  117. run: mkdir -p "$LOG_DIR"
  118. - if: ${{ matrix.test != 'unittest' }}
  119. name: Set up interpreter packages
  120. run: |
  121. echo "Install neovim RubyGem."
  122. gem install --no-document --bindir "$BIN_DIR" --user-install --pre neovim
  123. echo "Install neovim npm package"
  124. npm install -g neovim
  125. npm link neovim
  126. sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log"
  127. perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'
  128. - name: Remove .git directory
  129. if: ${{ matrix.build.os == 'ubuntu' }}
  130. run: cmake -E rm -rf -- .git
  131. - name: Build third-party deps
  132. run: |
  133. cmake -S cmake.deps --preset ci -D CMAKE_BUILD_TYPE=Debug ${{ matrix.build.deps_flags }}
  134. cmake --build .deps
  135. - name: Build
  136. run: |
  137. cmake --preset ci -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.build.flags }}
  138. cmake --build build
  139. - if: ${{ matrix.test == 'oldtest' }}
  140. name: ${{ matrix.test }}
  141. timeout-minutes: 20
  142. run: make -C test/old/testdir NVIM_PRG=$(realpath build)/bin/nvim
  143. - if: ${{ matrix.test != 'oldtest' }}
  144. name: ${{ matrix.test }}
  145. timeout-minutes: 20
  146. run: cmake --build build --target ${{ matrix.test }}
  147. - name: Install
  148. run: |
  149. cmake --install build
  150. "$INSTALL_PREFIX/bin/nvim" --version
  151. if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
  152. echo "Running ':help' in the installed nvim failed."
  153. echo "Maybe the helptags have not been generated properly."
  154. echo 'Failed running :help'
  155. exit 1
  156. fi
  157. # Check that all runtime files were installed
  158. for file in $(git -C runtime ls-files '*.vim' '*.ps' '*.dict' '*.py' '*.tutor' '*.awk' '*.sh' '*.bat'); do
  159. if ! test -e "$INSTALL_PREFIX/share/nvim/runtime/$file"; then
  160. printf "It appears that %s is not installed." "$file"
  161. exit 1
  162. fi
  163. done
  164. # Check that generated syntax file has function names, #5060.
  165. genvimsynf=syntax/vim/generated.vim
  166. gpat='syn keyword vimFuncName .*eval'
  167. if ! grep -q "$gpat" "$INSTALL_PREFIX/share/nvim/runtime/$genvimsynf"; then
  168. echo "It appears that $genvimsynf does not contain $gpat."
  169. exit 1
  170. fi
  171. - if: '!cancelled()'
  172. name: Show logs
  173. run: cat $(find "$LOG_DIR" -type f)
  174. windows:
  175. uses: ./.github/workflows/test_windows.yml
  176. # This job tests the following things:
  177. # - Check if MinSizeRel and RelWithDebInfo compiles correctly.
  178. # - Test the above build types with the GCC compiler specifically.
  179. # Empirically the difference in warning levels between GCC and other
  180. # compilers is particularly big.
  181. # - Test if the build works with multi-config generators. We mostly use
  182. # single-config generators so it's nice to have a small sanity check for
  183. # multi-config.
  184. build-types:
  185. runs-on: ubuntu-24.04
  186. timeout-minutes: 10
  187. env:
  188. CC: gcc
  189. steps:
  190. - uses: actions/checkout@v4
  191. - uses: ./.github/actions/setup
  192. - name: Build third-party deps
  193. run: |
  194. cmake -S cmake.deps -B .deps -G "Ninja Multi-Config"
  195. cmake --build .deps
  196. - name: Configure
  197. run: cmake --preset ci -G "Ninja Multi-Config"
  198. - name: RelWithDebInfo
  199. run: cmake --build build --config RelWithDebInfo
  200. - name: MinSizeRel
  201. run: cmake --build build --config MinSizeRel
  202. with-external-deps:
  203. runs-on: ubuntu-24.04
  204. timeout-minutes: 10
  205. env:
  206. CC: gcc
  207. steps:
  208. - uses: actions/checkout@v4
  209. - uses: ./.github/actions/setup
  210. - name: Install dependencies
  211. run: |
  212. sudo add-apt-repository ppa:neovim-ppa/stable
  213. sudo apt-get install -y \
  214. libluajit-5.1-dev \
  215. libunibilium-dev \
  216. libuv1-dev \
  217. lua-filesystem \
  218. lua-lpeg \
  219. luajit \
  220. lua-luv-dev
  221. # libtree-sitter-dev \
  222. # Remove comments from packages once we start using these external
  223. # dependencies.
  224. - name: Build third-party deps
  225. run: |
  226. cmake -S cmake.deps --preset external_deps
  227. cmake --build .deps
  228. - name: Build
  229. run: |
  230. cmake --preset ci
  231. cmake --build build