diff options
Diffstat (limited to '.github')
25 files changed, 437 insertions, 203 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 11f27dde21..5fd7bc37b6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,6 +8,33 @@ body: value: | _Before reporting:_ search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). Usage questions such as "How do I...?" belong on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will be closed. + - type: textarea + attributes: + label: "Describe the bug" + description: "Describe the current behavior. May include logs, images, or videos." + validations: + required: true + + - type: textarea + attributes: + label: "Steps to reproduce" + description: | + - For build failures: list the exact steps including CMake flags (if any). + - For startup or shell-related problems: try `env -i TERM=ansi-256color "$(which nvim)"`. + placeholder: | + nvim --clean + :edit foo + yiwp + validations: + required: true + + - type: textarea + attributes: + label: "Expected behavior" + description: "Describe the behavior you expect." + validations: + required: true + - type: input attributes: label: "Neovim version (nvim -v)" @@ -47,29 +74,3 @@ body: placeholder: "Arch User Repository (AUR)" validations: required: true - - - type: textarea - attributes: - label: "How to reproduce the issue" - description: | - - Steps to reproduce using `nvim --clean` ("factory defaults"). - - For build failures: list the exact steps including CMake flags (if any). - - For shell-related problems: try `env -i TERM=ansi-256color "$(which nvim)"`. - placeholder: | - nvim --clean - :edit foo - yiwp - validations: - required: true - - - type: textarea - attributes: - label: "Expected behavior" - description: "Describe the behavior you expect. May include logs, images, or videos." - validations: - required: true - - type: textarea - attributes: - label: "Actual behavior" - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 2b6fa3daf4..4b9a443064 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -8,14 +8,17 @@ body: value: | Before requesting: search [existing issues](https://github.com/neovim/neovim/labels/enhancement) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). - - type: input + - type: textarea attributes: - label: "Feature already in Vim?" - description: "Does the feature already exist in Vim? If possible, specify which version (or commit) that introduced it." - placeholder: "Yes, Vim 7.3.432" + label: "Problem" + description: "Describe the problem to be solved. Include references to other projects (Vim, Emacs, etc.) if relevant." + placeholder: "No smurf icons available. Smurfs are useful because ..." + validations: + required: true - type: textarea attributes: - label: "Feature description" + label: "Expected behavior" + description: "Describe what the new feature or behavior would look like. How does it solve the problem? Is it worth the cost?" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml index 0ed163c9be..88867ce644 100644 --- a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml @@ -31,8 +31,38 @@ body: attributes: label: 'Steps to reproduce using "nvim -u minimal_init.lua"' description: | - - Download the minimal config with `curl -LO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua` and modify it to include any specific commands or servers pertaining to your issues. - - _Note_: if the issue is with an autocompletion or other LSP plugin, report to that plugin's issue tracker. + - Create a minimal_init.lua using vim.lsp.start: + + ```lua + --- CHANGE THESE + local pattern = 'the-filetype' + local cmd = {'name-of-language-server-executable'} + -- Add files/folders here that indicate the root of a project + local root_markers = {'.git', '.editorconfig'} + -- Change to table with settings if required + local settings = vim.empty_dict() + + vim.api.nvim_create_autocmd('FileType', { + pattern = pattern, + callback = function(args) + local match = vim.fs.find(root_markers, { path = args.file, upward = true })[1] + local root_dir = match and vim.fn.fnamemodify(match, ':p:h') or vim.NIL + vim.lsp.start({ + name = 'bugged-ls', + cmd = cmd, + root_dir = root_dir, + settings = settings + }) + end + }) + ``` + + See `:h lsp-quickstart` and `:h vim.lsp.start` for more information + + - Provide a short code example and describe the folder layout + - Describe how to trigger the issue. E.g. using `:lua vim.lsp.buf.*` commands + + _Note_: if the issue is with an autocompletion or other LSP plugin, report to that plugin's issue tracker. validations: required: true diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000000..a376d87912 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,2 @@ +To report a security vulnerability to Neovim, use +https://github.com/neovim/neovim/security/advisories/new diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 0000000000..858045c02a --- /dev/null +++ b/.github/actions/cache/action.yml @@ -0,0 +1,22 @@ +name: 'Cache' +description: "This action caches neovim dependencies" +runs: + using: "composite" + steps: + - run: echo "CACHE_KEY=${{ github.job }}-${{ github.base_ref }}" >> $GITHUB_ENV + shell: bash + + - if: ${{ matrix }} + run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.*, '-') }}" >> $GITHUB_ENV + shell: bash + + # Avoid using '**/CMakeLists.txt' (or any pattern starting with '**/') even + # if it makes the expression below simpler. hashFiles() has a timer that + # will fail the job if it times out, which can happen if there are too many + # files to search through. + - uses: actions/cache@v3 + with: + path: ${{ env.CACHE_NVIM_DEPS_DIR }} + key: ${{ env.CACHE_KEY }}-${{ hashFiles('cmake**', 'ci/**', + '.github/workflows/ci.yml', 'CMakeLists.txt', + 'runtime/CMakeLists.txt', 'src/nvim/**/CMakeLists.txt') }} diff --git a/.github/labeler.yml b/.github/labeler.yml index e86c7aabe8..ad48287246 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -13,6 +13,7 @@ - src/nvim/lua/treesitter.* - runtime/lua/vim/treesitter.lua - runtime/lua/vim/treesitter/* + - runtime/queries/**/* "diagnostic": - runtime/lua/vim/diagnostic.lua @@ -62,3 +63,8 @@ "filetype": - runtime/lua/vim/filetype.lua + - runtime/lua/vim/filetype/detect.lua + +"platform:nix": + - contrib/flake.lock + - contrib/flake.nix diff --git a/.github/scripts/install_deps_ubuntu.sh b/.github/scripts/install_deps_ubuntu.sh new file mode 100755 index 0000000000..012409ba4a --- /dev/null +++ b/.github/scripts/install_deps_ubuntu.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +PACKAGES=( + autoconf + automake + build-essential + cmake + cpanminus + curl + gettext + libtool-bin + locales-all + ninja-build + pkg-config + unzip +) + +sudo apt-get update +sudo apt-get install -y "${PACKAGES[@]}" diff --git a/.github/scripts/remove-reviewers.js b/.github/scripts/remove-reviewers.js index 631f08e57d..40a8eca423 100644 --- a/.github/scripts/remove-reviewers.js +++ b/.github/scripts/remove-reviewers.js @@ -6,11 +6,13 @@ module.exports = async ({github, context}) => { }); const reviewers = requestedReviewers.data.users.map(e => e.login) + const team_reviewers = requestedReviewers.data.teams.map(e => e.name); github.rest.pulls.removeRequestedReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.issue.number, - reviewers: reviewers + reviewers: reviewers, + team_reviewers: team_reviewers }); } diff --git a/.github/scripts/reviews.js b/.github/scripts/reviews.js index 6e9a829353..cc6aaa1e8b 100644 --- a/.github/scripts/reviews.js +++ b/.github/scripts/reviews.js @@ -7,24 +7,29 @@ module.exports = async ({github, context}) => { const labels = pr_data.data.labels.map(e => e.name) const reviewers = new Set() + const team_reviewers = new Array() if (labels.includes('api')) { reviewers.add("bfredl") - reviewers.add("gpanders") reviewers.add("muniter") } if (labels.includes('build')) { reviewers.add("jamessan") + reviewers.add("justinmk") } if (labels.includes('ci')) { - reviewers.add("jamessan") + team_reviewers.push('ci'); } if (labels.includes('column')) { reviewers.add("lewis6991") } + if (labels.includes('dependencies')) { + reviewers.add("jamessan") + } + if (labels.includes('diagnostic')) { reviewers.add("gpanders") } @@ -33,10 +38,6 @@ module.exports = async ({github, context}) => { reviewers.add("lewis6991") } - if (labels.includes('dependencies')) { - reviewers.add("jamessan") - } - if (labels.includes('distribution')) { reviewers.add("jamessan") } @@ -52,20 +53,32 @@ module.exports = async ({github, context}) => { if (labels.includes('filetype')) { reviewers.add("clason") reviewers.add("gpanders") + reviewers.add("smjonas") } - if (labels.includes('gui')) { - reviewers.add("glacambre") - reviewers.add("smolck") + if (labels.includes('lsp')) { + team_reviewers.push('lsp'); } - if (labels.includes('lsp')) { - reviewers.add("mfussenegger") + if (labels.includes('platform:nix')) { + reviewers.add("teto") } - if (labels.includes('treesitter')) { + if (labels.includes('project-management')) { + reviewers.add("bfredl") + reviewers.add("justinmk") + } + + if (labels.includes('refactor')) { reviewers.add("bfredl") - reviewers.add("vigoux") + } + + if (labels.includes('test')) { + reviewers.add("justinmk") + } + + if (labels.includes('treesitter')) { + team_reviewers.push('treesitter'); } if (labels.includes('typo')) { @@ -89,6 +102,7 @@ module.exports = async ({github, context}) => { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.issue.number, - reviewers: Array.from(reviewers) + reviewers: Array.from(reviewers), + team_reviewers: team_reviewers }); } diff --git a/.github/scripts/unstale.js b/.github/scripts/unstale.js new file mode 100644 index 0000000000..f645fca5cb --- /dev/null +++ b/.github/scripts/unstale.js @@ -0,0 +1,19 @@ +module.exports = async ({ github, context }) => { + const commenter = context.actor; + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const author = issue.data.user.login; + const labels = issue.data.labels.map((e) => e.name); + + if (author === commenter && labels.includes("needs:response")) { + github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + name: "needs:response", + }); + } +}; diff --git a/.github/workflows/reviews.yml b/.github/workflows/add-reviewers.yml index 34ce19d830..f1abab5c53 100644 --- a/.github/workflows/reviews.yml +++ b/.github/workflows/add-reviewers.yml @@ -1,7 +1,7 @@ name: "Request reviews" on: pull_request_target: - types: [labeled, ready_for_review] + types: [labeled, ready_for_review, reopened] jobs: request-reviewer: if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false @@ -13,6 +13,7 @@ jobs: - name: 'Request reviewers' uses: actions/github-script@v6 with: + github-token: ${{ secrets.TEAM_REVIEW }} script: | const script = require('./.github/scripts/reviews.js') await script({github, context}) diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml index 83554e2a3d..fa8a7dbca0 100644 --- a/.github/workflows/api-docs.yml +++ b/.github/workflows/api-docs.yml @@ -21,13 +21,17 @@ on: jobs: regen-api-docs: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: write pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: nightly - uses: actions/checkout@v3 with: # Fetch depth 0 is required if called through workflow_call. In order @@ -38,7 +42,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y doxygen python3 python3-msgpack luajit + sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y doxygen python3 python3-msgpack - name: Setup git config run: | @@ -52,7 +56,7 @@ jobs: run: | git checkout -b ${DOC_BRANCH} python3 scripts/gen_vimdoc.py - printf '::set-output name=UPDATED_DOCS::%s\n' $([ -z "$(git diff)" ]; echo $?) + printf 'UPDATED_DOCS=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT - name: FAIL, PR has not committed doc changes if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 && inputs.check_only }} diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index b5fd22d036..019fb20689 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - name: Create backport PRs - uses: zeebe-io/backport-action@v0.0.7 + uses: zeebe-io/backport-action@v0 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_workspace: ${{ github.workspace }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e22d99067a..b158d966e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,17 +9,22 @@ on: - 'master' - 'release-[0-9]+.[0-9]+' paths-ignore: - - 'runtime/doc/*' + - 'contrib/**' # Cancel any in-progress CI runs for a PR if it is updated concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true +env: + UNCRUSTIFY_VERSION: uncrustify-0.75.0 + # TEST_FILE: test/functional/core/startup_spec.lua + # TEST_FILTER: foo + jobs: lint: if: (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref == 'refs/heads/master') - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 10 env: CC: gcc @@ -31,34 +36,8 @@ jobs: - name: Install apt packages run: | - sudo add-apt-repository ppa:neovim-ppa/stable - sudo apt-get update - sudo apt-get install -y \ - autoconf \ - automake \ - build-essential \ - cmake \ - flake8 \ - gettext \ - libluajit-5.1-dev \ - libmsgpack-dev \ - libtermkey-dev \ - libtool-bin \ - libtree-sitter-dev \ - libunibilium-dev \ - libuv1-dev \ - libvterm-dev \ - locales \ - lua-busted \ - lua-check \ - lua-filesystem \ - lua-inspect \ - lua-lpeg \ - lua-luv-dev \ - lua-nvim \ - luajit \ - ninja-build \ - pkg-config + ./.github/scripts/install_deps_ubuntu.sh + sudo apt-get install -y lua-check - name: Cache uncrustify id: cache-uncrustify @@ -85,41 +64,40 @@ jobs: mkdir -p $HOME/.cache cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }} - - name: Cache artifacts - uses: actions/cache@v3 - with: - path: | - ${{ env.CACHE_NVIM_DEPS_DIR }} - key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!cmake.deps/**CMakeLists.txt') }}-${{ github.base_ref }} + - uses: ./.github/actions/cache - name: Build third-party deps run: ./ci/before_script.sh - if: "!cancelled()" + name: Determine if run should be aborted + id: abort_job + run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT + + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: lintstylua - uses: JohnnyMorganz/stylua-action@1.0.0 + uses: JohnnyMorganz/stylua-action@v2 with: token: ${{ secrets.GITHUB_TOKEN }} + version: latest args: --check runtime/ - - if: "!cancelled()" - name: lintlua - run: make lintlua - - - if: "!cancelled()" - name: lintpy - run: make lintpy + - if: success() || failure() && steps.abort_job.outputs.status == 'success' + name: luacheck + run: | + cmake -B $BUILD_DIR -G Ninja + cmake --build $BUILD_DIR --target lintlua-luacheck - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: lintsh run: make lintsh - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: uncrustify run: | ${{ env.CACHE_UNCRUSTIFY }} -c ./src/uncrustify.cfg -q --replace --no-backup $(find ./src/nvim -name "*.[ch]") - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: suggester / uncrustify uses: reviewdog/action-suggester@v1 with: @@ -127,7 +105,7 @@ jobs: tool_name: uncrustify cleanup: false - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: check uncrustify run: | git diff --color --exit-code @@ -142,7 +120,7 @@ jobs: # of the bundled dependencies. if: (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref == 'refs/heads/master') - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 10 env: CC: gcc @@ -155,39 +133,24 @@ jobs: - name: Install apt packages run: | sudo add-apt-repository ppa:neovim-ppa/stable - sudo apt-get update + ./.github/scripts/install_deps_ubuntu.sh sudo apt-get install -y \ - autoconf \ - automake \ - build-essential \ - cmake \ - gettext \ libluajit-5.1-dev \ libmsgpack-dev \ libtermkey-dev \ - libtool-bin \ libtree-sitter-dev \ libunibilium-dev \ libuv1-dev \ libvterm-dev \ - locales \ lua-busted \ - lua-check \ lua-filesystem \ lua-inspect \ lua-lpeg \ lua-luv-dev \ lua-nvim \ - luajit \ - ninja-build \ - pkg-config + luajit - - name: Cache artifacts - uses: actions/cache@v3 - with: - path: | - ${{ env.CACHE_NVIM_DEPS_DIR }} - key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!cmake.deps/**CMakeLists.txt') }}-${{ github.base_ref }} + - uses: ./.github/actions/cache - name: Build third-party deps run: ./ci/before_script.sh @@ -196,10 +159,15 @@ jobs: run: ./ci/run_tests.sh build_nvim - if: "!cancelled()" - name: lintc - run: make lintc + name: Determine if run should be aborted + id: abort_job + run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' + name: clint.py + run: cmake --build build --target lintc-clint + + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: check-single-includes run: make check-single-includes @@ -213,19 +181,19 @@ jobs: matrix: include: - flavor: asan - cc: clang-13 - runner: ubuntu-20.04 + cc: clang + runner: ubuntu-22.04 os: linux - flavor: tsan - cc: clang-13 - runner: ubuntu-20.04 + cc: clang + runner: ubuntu-22.04 os: linux - flavor: uchar cc: gcc - runner: ubuntu-20.04 + runner: ubuntu-22.04 os: linux - cc: clang - runner: macos-11 + runner: macos-12 os: osx # functionaltest-lua is our dumping ground for non-mainline configurations. @@ -236,7 +204,7 @@ jobs: # 3. No treesitter parsers installed. - flavor: functionaltest-lua cc: gcc - runner: ubuntu-20.04 + runner: ubuntu-22.04 os: linux cmake: minimum_required runs-on: ${{ matrix.runner }} @@ -252,9 +220,7 @@ jobs: - name: Install apt packages if: matrix.os == 'linux' - run: | - sudo apt-get update - sudo apt-get install -y autoconf automake build-essential cmake cpanminus cscope gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip + run: ./.github/scripts/install_deps_ubuntu.sh - name: Install minimum required version of cmake if: matrix.cmake == 'minimum_required' @@ -274,14 +240,6 @@ jobs: exit 1 } - - name: Install new clang - if: matrix.flavor == 'asan' || matrix.flavor == 'tsan' - run: | - wget https://apt.llvm.org/llvm.sh - chmod a+x llvm.sh - sudo ./llvm.sh 13 - rm llvm.sh - - name: Install brew packages if: matrix.os == 'osx' run: | @@ -291,12 +249,7 @@ jobs: - name: Setup interpreter packages run: ./ci/install.sh - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - ${{ env.CACHE_NVIM_DEPS_DIR }} - key: ${{ matrix.runner }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'cmake.deps/**', '**/CMakeLists.txt') }}-${{ github.base_ref }} + - uses: ./.github/actions/cache - name: Build third-party deps run: ./ci/before_script.sh @@ -304,19 +257,24 @@ jobs: - name: Build run: ./ci/run_tests.sh build_nvim - - if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && !cancelled() + - if: "!cancelled()" + name: Determine if run should be aborted + id: abort_job + run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT + + - if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && (success() || failure() && steps.abort_job.outputs.status == 'success') name: Unittests run: ./ci/run_tests.sh unittests - - if: matrix.flavor != 'tsan' && !cancelled() + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: Functionaltests run: ./ci/run_tests.sh functionaltests - - if: "!cancelled()" + - if: matrix.flavor != 'tsan' && (success() || failure() && steps.abort_job.outputs.status == 'success') name: Oldtests run: ./ci/run_tests.sh oldtests - - if: "!cancelled()" + - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: Install nvim run: ./ci/run_tests.sh install_nvim @@ -327,32 +285,67 @@ jobs: runs-on: windows-2019 timeout-minutes: 45 env: - DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }} - DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }} - CMAKE_BUILD_TYPE: "RelWithDebInfo" + DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps + CACHE_NVIM_DEPS_DIR: ${{ github.workspace }}/nvim-deps + DEPS_PREFIX: ${{ github.workspace }}/nvim-deps/usr name: windows (MSVC_64) steps: - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: ${{ env.DEPS_BUILD_DIR }} - key: ${{ hashFiles('cmake.deps\**') }} + - uses: ./.github/actions/cache + + - name: Set env + run: ./.github/workflows/env.ps1 - name: Build deps - run: .\ci\build.ps1 -BuildDeps + run: | + cmake -S cmake.deps -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' + cmake --build $env:DEPS_BUILD_DIR - name: Build nvim - run: .\ci\build.ps1 -Build + run: | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX" -DCI_BUILD=ON + cmake --build build - name: Install test deps - continue-on-error: false - run: .\ci\build.ps1 -EnsureTestDeps + run: | + $PSNativeCommandArgumentPassing = 'Legacy' - - if: "!cancelled()" - name: Run tests - run: .\ci\build.ps1 -Test + & build\bin\nvim.exe "--version" + + # Ensure that the "win32" feature is set. + & build\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' + + python -m pip install pynvim + # Sanity check + python -c "import pynvim; print(str(pynvim))" + + gem.cmd install --pre neovim + Get-Command -CommandType Application neovim-ruby-host.bat + + node --version + npm.cmd --version + + npm.cmd install -g neovim + Get-Command -CommandType Application neovim-node-host.cmd + npm.cmd link neovim - if: "!cancelled()" - name: Run old tests - run: .\ci\build.ps1 -TestOld + name: Determine if run should be aborted + id: abort_job + run: | + "status=${{ job.status }}" >> $env:GITHUB_OUTPUT + + - if: success() || failure() && steps.abort_job.outputs.status == 'success' + name: Run functionaltests + run: cmake --build build --target functionaltest + + - if: success() || failure() && steps.abort_job.outputs.status == 'success' + name: Run oldtests + run: | + # Add MSYS to path, required for e.g. `find` used in test scripts. + # But would break functionaltests, where its `more` would be used then. + $OldPath = $env:PATH + $env:PATH = "C:\msys64\usr\bin;$env:PATH" + & "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path src\nvim\testdir) VERBOSE=1 + $env:PATH = $OldPath diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql.yml index b31382af37..a11a87f93a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'cpp', 'python' ] + language: [ 'cpp' ] steps: - name: Checkout repository @@ -26,9 +26,7 @@ jobs: run: ./.github/workflows/env.sh - name: Install apt packages - run: | - sudo apt-get update - sudo apt-get install -y autoconf automake build-essential cmake cpanminus cscope gcc-multilib gdb gettext language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip + run: ./.github/scripts/install_deps_ubuntu.sh - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity.yml index ce7822b5c1..87e2cb1453 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity.yml @@ -37,7 +37,7 @@ jobs: --form email=$EMAIL \ --form file=@cov-scan.tgz \ --form version="$(git rev-parse HEAD)" \ - --form description="Weekly GHA scan" \ + --form description="Daily GHA scan" \ 'https://scan.coverity.com/builds?project=neovim%2Fneovim' env: TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} diff --git a/.github/workflows/env.ps1 b/.github/workflows/env.ps1 new file mode 100644 index 0000000000..8ac267f2f9 --- /dev/null +++ b/.github/workflows/env.ps1 @@ -0,0 +1,7 @@ +$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath +if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) { + & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object { + $name, $value = $_ -split '=', 2 + "$name=$value" >> $env:GITHUB_ENV + } +} diff --git a/.github/workflows/env.sh b/.github/workflows/env.sh index 061588da1a..d93552fed3 100755 --- a/.github/workflows/env.sh +++ b/.github/workflows/env.sh @@ -18,7 +18,6 @@ VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker CACHE_UNCRUSTIFY=$HOME/.cache/uncrustify -UNCRUSTIFY_VERSION=uncrustify-0.75.0 EOF DEPS_CMAKE_FLAGS= @@ -30,7 +29,6 @@ case "$FLAVOR" in BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON" cat <<EOF >> "$GITHUB_ENV" CLANG_SANITIZER=ASAN_UBSAN -SYMBOLIZER=asan_symbolize-13 ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan:intercept_tls_get_addr=0 UBSAN_OPTIONS=print_stacktrace=1 log_path=$GITHUB_WORKSPACE/build/log/ubsan EOF @@ -57,7 +55,7 @@ EOF functionaltest-lua) BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON" FUNCTIONALTEST=functionaltest-lua - DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF -DUSE_BUNDLED_TS_PARSERS=OFF" + DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF" ;; *) ;; diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f85f9d0cda..60689029a3 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -44,6 +44,7 @@ jobs: - name: 'Request reviewers' uses: actions/github-script@v6 with: + github-token: ${{ secrets.TEAM_REVIEW }} script: | const script = require('./.github/scripts/reviews.js') await script({github, context}) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/lintcommit.yml index 68be5436f6..a7a227865d 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/lintcommit.yml @@ -1,8 +1,6 @@ name: "Commit Linter" on: - # Only pull_request and push honor [skip ci]. Since this workflow must pass - # to merge a PR, it can't be skipped, so use pull_request_target - pull_request_target: + pull_request: types: [opened, synchronize, reopened, ready_for_review] branches: - 'master' @@ -10,6 +8,8 @@ jobs: lint-commits: runs-on: ubuntu-latest if: github.event.pull_request.draft == false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/news.yml b/.github/workflows/news.yml new file mode 100644 index 0000000000..46ac0ec02d --- /dev/null +++ b/.github/workflows/news.yml @@ -0,0 +1,31 @@ +name: "news.txt check" +on: + pull_request: + branches: + - 'master' +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + - name: news.txt needs to be updated + run: | + for commit in $(git rev-list HEAD~${{ github.event.pull_request.commits }}..HEAD); do + message=$(git log -n1 --pretty=format:%s $commit) + type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" + breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" + if [[ "$type" == "feat" ]] || [[ "$breaking" == "breaking-change" ]]; then + ! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt || + { + echo " + Pull request includes a new feature or a breaking change, but + news.txt hasn't been updated yet. news.txt is our primary way of + communicating changes to users so it's important to keep it up to + date." + exit 1 + } + fi + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6933e9330..1df33962e5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,8 +36,10 @@ jobs: id: build run: | CC=gcc-10 make CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=" - printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')" - printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)" + printf 'version<<END\n' >> $GITHUB_OUTPUT + ./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT + printf 'END\n' >> $GITHUB_OUTPUT + printf 'release=%s\n' "$(./build/bin/nvim --version | head -n 1)" >> $GITHUB_OUTPUT make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install cd "$GITHUB_WORKSPACE/build/" cpack -C $NVIM_BUILD_TYPE @@ -51,14 +53,28 @@ jobs: appimage: runs-on: ubuntu-20.04 + container: + image: ubuntu:18.04 + options: --privileged # Privileged mode is needed to load fuse module. steps: + - name: Prepare container + run: | + apt-get update + apt-get install -y software-properties-common + add-apt-repository -y ppa:ubuntu-toolchain-r/test # For gcc-10. + add-apt-repository -y ppa:git-core/ppa # For git>=2.18. + apt-get update + apt-get install -y git gcc-10 + apt-get install -y fuse libfuse2 # For linuxdeploy. + # Workaround for https://github.com/actions/checkout/issues/766. + git config --global --add safe.directory "$GITHUB_WORKSPACE" - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install dependencies run: | - sudo apt-get update - sudo apt-get install -y autoconf automake build-essential cmake gettext libtool-bin locales ninja-build pkg-config unzip + apt-get update + apt-get install -y autoconf automake build-essential cmake gettext libtool-bin locales ninja-build pkg-config unzip - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') run: CC=gcc-10 make appimage-latest - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') @@ -113,6 +129,11 @@ jobs: DEPS_CMAKE_FLAGS="$OSX_FLAGS" make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-macos" install cd "$GITHUB_WORKSPACE/build/" + # Make sure we build everything for M1 as well + for macho in bin/* lib/nvim/parser/*.so + do + lipo -info "$macho" | grep -q arm64 || exit 1 + done cpack -C "$NVIM_BUILD_TYPE" - uses: actions/upload-artifact@v3 with: @@ -126,26 +147,27 @@ jobs: DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }} DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }} CMAKE_BUILD_TYPE: "RelWithDebInfo" - strategy: - matrix: - include: - - config: MSVC_64 - archive: nvim-win64 - name: windows (${{ matrix.config }}) + name: windows (MSVC_64) steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Set env + run: ./.github/workflows/env.ps1 - name: Build deps - run: .\ci\build.ps1 -BuildDeps + run: | + cmake -S cmake.deps -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' + cmake --build $env:DEPS_BUILD_DIR - name: build package - run: .\ci\build.ps1 -Package + run: | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX" + cmake --build build --target package - uses: actions/upload-artifact@v3 with: - name: ${{ matrix.archive }} + name: nvim-win64 path: | - build/${{ matrix.archive }}.msi - build/${{ matrix.archive }}.zip + build/nvim-win64.msi + build/nvim-win64.zip retention-days: 1 publish: @@ -227,16 +249,31 @@ jobs: if [ "$TAG_NAME" != "nightly" ]; then gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos/* nvim-linux64/* appimage/* nvim-win64/* fi + publish-winget: - needs: publish # run after publish job is finished - # publish to winget only on stable releases - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') - runs-on: windows-latest # action can only be run on windows + needs: publish + runs-on: windows-latest steps: - - uses: vedantmgoyal2009/winget-releaser@latest + - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') + name: Publish stable + uses: vedantmgoyal2009/winget-releaser@v1 with: identifier: Neovim.Neovim - # the latter one is a fallback value, reference: - # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value - release-tag: ${{ github.event.inputs.tag_name || github.ref }} + release-tag: ${{ github.event.inputs.tag_name || github.ref_name }} + token: ${{ secrets.WINGET_TOKEN }} + - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') + name: Get nightly version + id: get-version + run: | + Invoke-WebRequest https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.msi -OutFile setup.msi + Install-Module -Name 'Carbon.Windows.Installer' -Force + $VERSION = (Get-CMsi (Resolve-Path .\setup.msi).Path).ProductVersion + "version=$VERSION" >> $env:GITHUB_OUTPUT + - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') + name: Publish nightly + uses: vedantmgoyal2009/winget-releaser@v1 + with: + identifier: Neovim.Neovim.Nightly + version: ${{ steps.get-version.outputs.version }} + release-tag: nightly token: ${{ secrets.WINGET_TOKEN }} diff --git a/.github/workflows/remove-reviewers-on-draft.yml b/.github/workflows/remove-reviewers.yml index f707f79737..7ab3ef568c 100644 --- a/.github/workflows/remove-reviewers-on-draft.yml +++ b/.github/workflows/remove-reviewers.yml @@ -12,6 +12,7 @@ jobs: - name: 'Remove reviewers' uses: actions/github-script@v6 with: + github-token: ${{ secrets.TEAM_REVIEW }} script: | const script = require('./.github/scripts/remove-reviewers.js') await script({github, context}) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..c1d3ee3ff3 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,42 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' # Run every day at 01:30 + workflow_dispatch: + issue_comment: + +jobs: + close: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v7 + with: + days-before-close: 30 + days-before-stale: -1 + stale-issue-label: needs:response + stale-pr-label: needs:response + remove-stale-when-updated: false + close-issue-message: "This issue has been closed since a request for + information has not been answered for 30 days. It can be reopened + when the requested information is provided." + close-pr-message: "This PR has been closed since a request for + changes has not been answered for 30 days. It can be reopened when + the requested changes are provided." + + remove-label: + if: github.event_name == 'issue_comment' + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v3 + - uses: actions/github-script@v6 + with: + script: | + const script = require('./.github/scripts/unstale.js') + await script({github, context}) diff --git a/.github/workflows/vim-patches.yml b/.github/workflows/vim-patches.yml index df8c8116b5..159eb09e7c 100644 --- a/.github/workflows/vim-patches.yml +++ b/.github/workflows/vim-patches.yml @@ -2,6 +2,7 @@ name: vim-patches on: schedule: - cron: '3 3 * * *' + workflow_dispatch: jobs: update-vim-patches: @@ -24,6 +25,8 @@ jobs: path: ${{ env.VIM_SOURCE_DIR }} fetch-depth: 0 + - run: sudo apt-get install libfuse2 + - run: | gh release download -R neovim/neovim -p nvim.appimage chmod a+x nvim.appimage @@ -40,8 +43,8 @@ jobs: id: update-version run: | git checkout -b ${VERSION_BRANCH} - nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q - printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?) + nvim -V1 -es -i NONE +'luafile scripts/vimpatch.lua' +q + printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT - name: Automatic PR if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }} |