robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
13.2 KiB384 linesraw
1name: test
2on:
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
13permissions:
14  contents: read
15
16concurrency:
17  group: ${{ github.workflow }}-${{ github.ref }}
18  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
19
20env:
21  ASAN_OPTIONS: detect_leaks=1:check_initialization_order=1:log_path=${{ github.workspace }}/build/log/asan:intercept_tls_get_addr=0
22  BIN_DIR: ${{ github.workspace }}/bin
23  BUILD_DIR: ${{ github.workspace }}/build
24  INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
25  LOG_DIR: ${{ github.workspace }}/build/log
26  NVIM_LOG_FILE: ${{ github.workspace }}/build/nvim.log
27  TSAN_OPTIONS: log_path=${{ github.workspace }}/build/log/tsan
28  VALGRIND_LOG: ${{ github.workspace }}/build/log/valgrind-%p.log
29  # TEST_FILE: test/functional/core/startup_spec.lua
30  # TEST_FILTER: foo
31
32jobs:
33  lintc:
34    runs-on: ubuntu-24.04
35    timeout-minutes: 20
36    env:
37      NVIM_LOG_FILE: ${{ github.workspace }}/zig-out/nvim.log
38      OPTS: -Doptimize=ReleaseFast -Dci-build
39    steps:
40      - uses: actions/checkout@v7.0.1
41        with:
42          persist-credentials: false
43
44      - uses: ./.github/actions/setup
45
46      - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
47        with:
48          version: 0.16.0
49      - run: sudo apt-get install -y inotify-tools
50
51      - name: nvim_bin
52        id: nvim_bin
53        run: zig build nvim_bin $OPTS
54
55      - if: success() || failure() && steps.nvim_bin.outcome == 'success'
56        name: clint.lua
57        run: zig build lintc-clint $OPTS
58
59      - if: success() || failure() && steps.nvim_bin.outcome == 'success'
60        name: clang-tidy
61        run: zig build lintc-clang-tidy $OPTS
62
63      - if: success() || failure() && steps.nvim_bin.outcome == 'success'
64        name: uncrustify
65        run: zig build lintc-uncrustify $OPTS
66
67  lint:
68    runs-on: ubuntu-24.04-arm
69    timeout-minutes: 10
70    env:
71      CC: clang
72    steps:
73      - uses: actions/checkout@v7.0.1
74        with:
75          persist-credentials: false
76
77      - uses: ./.github/actions/setup
78
79      - name: Install stylua
80        run: |
81          wget --directory-prefix="$BIN_DIR" https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-aarch64.zip
82          (cd "$BIN_DIR"; unzip stylua*.zip)
83
84      - name: Install ts_query_ls
85        run: |
86          wget --directory-prefix="$BIN_DIR" https://github.com/ribru17/ts_query_ls/releases/latest/download/ts_query_ls-aarch64-unknown-linux-gnu.tar.gz
87          (cd "$BIN_DIR"; tar -xzvf ts_query_ls-aarch64-unknown-linux-gnu.tar.gz)
88
89      - name: Build third-party deps
90        run: |
91          cmake -S cmake.deps -B .deps -G Ninja
92          cmake --build .deps
93
94      - run: cmake -B build -G Ninja -D CI_LINT=ON
95
96      - if: "!cancelled()"
97        name: Determine if run should be aborted
98        id: abort_job
99        env:
100          JOB_STATUS: ${{ job.status }}
101        run: echo "status=${JOB_STATUS}" >> $GITHUB_OUTPUT
102
103      - if: success() || failure() && steps.abort_job.outputs.status == 'success'
104        name: stylua
105        run: cmake --build build --target lintlua-stylua
106
107      - if: success() || failure() && steps.abort_job.outputs.status == 'success'
108        name: emmylua
109        run: cmake --build build --target emmylua-check
110
111      - if: success() || failure() && steps.abort_job.outputs.status == 'success'
112        name: lintsh
113        run: cmake --build build --target lintsh
114
115      - if: success() || failure() && steps.abort_job.outputs.status == 'success'
116        name: lintquery
117        run: cmake --build build --target lintquery
118
119  clang-analyzer:
120    runs-on: ubuntu-24.04-arm
121    timeout-minutes: 20
122    env:
123      CC: clang
124    steps:
125      - uses: actions/checkout@v7.0.1
126        with:
127          persist-credentials: false
128
129      - uses: ./.github/actions/setup
130      - name: Build third-party deps
131        run: |
132          cmake -S cmake.deps --preset ci
133          cmake --build .deps
134          cmake --preset ci
135      - run: cmake --build build --target clang-analyzer
136
137  posix:
138    name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
139    strategy:
140      fail-fast: false
141      matrix:
142        # The `os` field is not needed to differentiate between the different
143        # matrix builds. It is needed to not change the required checks (which
144        # uses jobs names) each time we bump the runner version. It may be
145        # possible to remove if we e.g. start using `-latest` runner versions
146        # or if github introduces a wildcard for required checks in the future.
147        build:
148          [
149            { runner: ubuntu-24.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
150            { runner: ubuntu-24.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
151            { runner: ubuntu-24.04, os: ubuntu, flavor: release, cc: gcc, flags: -D CMAKE_BUILD_TYPE=Release -D ENABLE_TRANSLATIONS=ON },
152            { runner: ubuntu-24.04-arm, os: ubuntu, flavor: arm, cc: clang, flags: -D CMAKE_BUILD_TYPE=RelWithDebInfo },
153            { runner: macos-15-intel, os: macos, flavor: intel, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
154            { runner: macos-26, os: macos, flavor: arm, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
155            { 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 },
156          ]
157        test: [unittest, functionaltest, oldtest]
158        exclude:
159          - test: unittest
160            build: { flavor: tsan }
161          - test: unittest
162            build: { flavor: puc-lua }
163          - test: oldtest
164            build: { flavor: tsan }
165          - test: oldtest
166            build: { runner: ubuntu-24.04-arm }
167    runs-on: ${{ matrix.build.runner }}
168    timeout-minutes: 45
169    env:
170      # The setup action adds this to PATH for neovim-ruby-host.
171      BIN_DIR: ${{ github.workspace }}/.deps/bin
172      CC: ${{ matrix.build.cc }}
173      # Install and load Ruby gems from the dependency cache.
174      GEM_HOME: ${{ github.workspace }}/.deps/ruby
175      NVIM_TEST_INTEG: ${{ matrix.build.flavor == 'release' && '1' || '0' }}
176      # Add cached provider dependencies to Perl's module search path.
177      PERL5LIB: ${{ github.workspace }}/.deps/perl5/lib/perl5
178    steps:
179      - uses: actions/checkout@v7.0.1
180        with:
181          persist-credentials: false
182
183      - uses: ./.github/actions/setup
184        with:
185          install_flags: "--test"
186
187      - name: Create log dir
188        run: mkdir -p "$LOG_DIR"
189
190      - if: ${{ matrix.test != 'unittest' }}
191        name: Set up interpreter packages
192        run: |
193          echo "Install neovim RubyGem."
194          gem install --no-document --bindir "$BIN_DIR" --conservative --pre neovim
195
196          cpanm -n -L .deps/perl5 --skip-satisfied Neovim::Ext || cat "$HOME/.cpanm/build.log"
197          perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'
198
199      - name: List runtime files
200        run: git -C runtime ls-files -z '*.vim' '*.ps' '*.dict' '*.py' '*.tutor' '*.awk' '*.sh' '*.bat' > "$RUNNER_TEMP/runtime-files"
201
202      - name: Remove .git directory
203        if: ${{ matrix.build.os == 'ubuntu' }}
204        run: cmake -E rm -rf -- .git
205
206      - name: Build third-party deps
207        env:
208          BUILD_DEPS_FLAGS: ${{ matrix.build.deps_flags }}
209        run: |
210          cmake -S cmake.deps --preset ci -D CMAKE_BUILD_TYPE=Debug $BUILD_DEPS_FLAGS
211          cmake --build .deps
212
213      - name: Build
214        env:
215          BUILD_FLAGS: ${{ matrix.build.flags }}
216        run: |
217          cmake --preset ci -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX $BUILD_FLAGS
218          cmake --build build
219
220      - if: ${{ matrix.test == 'unittest' }}
221        name: unittest
222        timeout-minutes: 20
223        run: cmake --build build --target unittest
224
225      - if: ${{ matrix.test == 'functionaltest' }}
226        name: functionaltest
227        timeout-minutes: 20
228        env:
229          # With parallel tests, use shorter timeout for a single group.
230          TEST_TIMEOUT: 600
231        run: |
232          set +e
233          # `-k 0` tells ninja to continue running all targets even if some fail.
234          cmake --build build --target functionaltest-parallel -j 2 -- -k 0
235          exit_code="$?"
236          cmake --build build --target functionaltest-summary
237          exit "$exit_code"
238
239      - if: ${{ matrix.test == 'oldtest' }}
240        name: oldtest
241        timeout-minutes: 20
242        run: make -C test/old/testdir NVIM_PRG=$(realpath build)/bin/nvim
243
244      - name: Install
245        run: |
246          cmake --install build
247          "$INSTALL_PREFIX/bin/nvim" -V1 --version
248          if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
249            echo "Running ':help' in the installed nvim failed."
250            echo "Maybe the helptags have not been generated properly."
251            echo 'Failed running :help'
252            exit 1
253          fi
254
255          # Check that all runtime files were installed
256          while IFS= read -r -d '' file; do
257            if ! test -e "$INSTALL_PREFIX/share/nvim/runtime/$file"; then
258              printf "It appears that %s is not installed." "$file"
259              exit 1
260            fi
261          done < "$RUNNER_TEMP/runtime-files"
262
263          # Check that generated syntax file has function names, #5060.
264          genvimsynf=syntax/vim/generated.vim
265          gpat='syn keyword vimFuncName .*eval'
266          if ! grep -q "$gpat" "$INSTALL_PREFIX/share/nvim/runtime/$genvimsynf"; then
267            echo "It appears that $genvimsynf does not contain $gpat."
268            exit 1
269          fi
270
271      - if: '!cancelled()'
272        name: Show logs
273        run: cat $(find "$LOG_DIR" -type f)
274
275  # TODO: matrixify
276  zig-build-linux:
277    runs-on: ubuntu-24.04
278    timeout-minutes: 45
279    name: build using zig build (linux)
280    env:
281      # NB: tests assume there is a chosen install path, but nothing needs to be actually installed
282      OPTS: -Doptimize=ReleaseSafe -Dinstall-path=/usr/
283    steps:
284      - uses: actions/checkout@v7.0.1
285        with:
286          persist-credentials: false
287
288      - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
289        with:
290          version: 0.16.0
291      - run: sudo apt-get install -y inotify-tools
292
293      - run: zig fmt --check . # run first, otherwise it will descend into zig-pkg..
294      - run: mkdir -p build/ # build/ is used for shared log paths, see global ENV defs
295      - run: zig build $OPTS test_nlua0
296      - run: zig build $OPTS nvim_bin && ./zig-out/bin/nvim --version
297      - run: zig build $OPTS unittest
298      - run: zig build $OPTS functionaltest
299      - run: zig build $OPTS oldtest
300      # `zig build` uses a lua script for doctags in order to support cross-compiling
301      # compare with the builtin generator that they match
302      - run: cd runtime; ../zig-out/bin/nvim -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
303      - run: diff -u runtime/doc/tags zig-out/runtime/doc/tags
304
305  zig-build-macos-15:
306    runs-on: macos-15
307    timeout-minutes: 45
308    name: build using zig build (macos 15)
309    env:
310      OPTS: -Dinstall-path=/usr/
311    steps:
312      - uses: actions/checkout@v7.0.1
313        with:
314          persist-credentials: false
315
316      - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
317        with:
318          version: 0.16.0
319
320      - run: mkdir -p build/ # build/ is used for shared log paths, see global ENV defs
321      - run: zig build $OPTS test_nlua0
322      - run: zig build $OPTS nvim_bin && ./zig-out/bin/nvim --version
323      - run: zig build $OPTS functionaltest
324      - run: zig build $OPTS oldtest
325
326  zig-build-windows:
327    runs-on: windows-2025
328    timeout-minutes: 45
329    name: build using zig build (windows)
330    steps:
331      - uses: actions/checkout@v7.0.1
332        with:
333          persist-credentials: false
334
335      - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
336        with:
337          version: 0.16.0
338
339      - run: mkdir -p build/ # build/ is used for shared log paths, see global ENV defs
340      - run: zig build test_nlua0
341      - run: zig build nvim_bin
342      - run: ./zig-out/bin/nvim --version
343      # TODO: support entire test suite
344      - run: zig build functionaltest -- test/functional/api/buffer_spec.lua
345
346  windows:
347    uses: ./.github/workflows/test_windows.yml
348
349  with-external-deps:
350    runs-on: ubuntu-24.04-arm
351    timeout-minutes: 10
352    env:
353      CC: gcc
354    steps:
355      - uses: actions/checkout@v7.0.1
356        with:
357          persist-credentials: false
358
359      - uses: ./.github/actions/setup
360
361      - name: Install dependencies
362        run: |
363          sudo apt-get install -y \
364            libluajit-5.1-dev \
365            libunibilium-dev \
366            libuv1-dev \
367            lua-filesystem \
368            lua-lpeg \
369            luajit \
370            lua-luv-dev
371            # libtree-sitter-dev \
372
373            # Remove comments from packages once we start using these external
374            # dependencies.
375
376      - name: Build third-party deps
377        run: |
378          cmake -S cmake.deps --preset external_deps
379          cmake --build .deps
380
381      - name: Build
382        run: |
383          cmake --preset ci
384          cmake --build build