neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

test.yml (11437B)


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