mirror of
https://github.com/nvim-telescope/telescope.nvim
synced 2024-09-16 21:24:02 +02:00
build: rework ci tests to include windows (#3011)
This commit is contained in:
parent
5a701e9990
commit
4d4ade7f2b
10 changed files with 67 additions and 50 deletions
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
|
@ -9,48 +9,33 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04, macos-12, windows-2022]
|
||||
rev: [nightly, v0.9.0]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
rev: nightly/nvim-linux64.tar.gz
|
||||
manager: sudo apt-get
|
||||
packages: -y ripgrep
|
||||
- os: ubuntu-22.04
|
||||
rev: v0.9.0/nvim-linux64.tar.gz
|
||||
manager: sudo apt-get
|
||||
packages: -y ripgrep
|
||||
install-rg: sudo apt-get update && sudo apt-get install -y ripgrep
|
||||
- os: macos-12
|
||||
rev: nightly/nvim-macos.tar.gz
|
||||
manager: brew
|
||||
packages: ripgrep
|
||||
- os: macos-12
|
||||
rev: v0.9.0/nvim-macos.tar.gz
|
||||
manager: brew
|
||||
packages: ripgrep
|
||||
install-rg: brew update && brew install ripgrep
|
||||
- os: windows-2022
|
||||
install-rg: choco install ripgrep
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: date +%F > todays-date
|
||||
- name: Restore from todays cache
|
||||
uses: actions/cache@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
path: _neovim
|
||||
key: ${{ runner.os }}-${{ matrix.rev }}-${{ hashFiles('todays-date') }}
|
||||
neovim: true
|
||||
version: ${{ matrix.rev }}
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
${{ matrix.manager }} update
|
||||
${{ matrix.manager }} install ${{ matrix.packages }}
|
||||
test -d _neovim || {
|
||||
mkdir -p _neovim
|
||||
curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
|
||||
}
|
||||
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
|
||||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
|
||||
git clone --depth 1 https://github.com/nvim-tree/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
|
||||
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
|
||||
${{ matrix.install-rg }}
|
||||
rg --version
|
||||
|
||||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ../plenary.nvim
|
||||
git clone --depth 1 https://github.com/nvim-tree/nvim-web-devicons ../nvim-web-devicons
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
export PATH="${PWD}/_neovim/bin:${PATH}"
|
||||
export VIM="${PWD}/_neovim/share/nvim/runtime"
|
||||
nvim --version
|
||||
make test
|
||||
|
|
6
.github/workflows/docgen.yml
vendored
6
.github/workflows/docgen.yml
vendored
|
@ -14,12 +14,12 @@ jobs:
|
|||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
|
||||
url: https://github.com/neovim/neovim/releases/download/v0.9.5/nvim-linux64.tar.gz
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- run: date +%F > todays-date
|
||||
- name: Restore cache for today's nightly.
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: _neovim
|
||||
key: ${{ runner.os }}-${{ matrix.url }}-${{ hashFiles('todays-date') }}
|
||||
|
|
6
.github/workflows/lint.yml
vendored
6
.github/workflows/lint.yml
vendored
|
@ -7,7 +7,7 @@ jobs:
|
|||
name: Luacheck
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
|
@ -22,8 +22,8 @@ jobs:
|
|||
name: stylua
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: JohnnyMorganz/stylua-action@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: JohnnyMorganz/stylua-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: latest
|
||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -7,7 +7,7 @@ jobs:
|
|||
luarocks-upload:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: LuaRocks Upload
|
||||
uses: nvim-neorocks/luarocks-tag-release@v1.0.2
|
||||
env:
|
||||
|
|
2
Makefile
2
Makefile
|
@ -1,3 +1,5 @@
|
|||
.PHONY: test lint docgen
|
||||
|
||||
test:
|
||||
nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' }"
|
||||
|
||||
|
|
|
@ -2536,6 +2536,31 @@ UTILS *telescope.utils*
|
|||
|
||||
Utilities for writing telescope pickers
|
||||
|
||||
utils.path_expand({path}) *telescope.utils.path_expand()*
|
||||
Hybrid of `vim.fn.expand()` and custom `vim.fs.normalize()`
|
||||
|
||||
Paths starting with '%', '#' or '<' are expanded with `vim.fn.expand()`.
|
||||
Otherwise avoids using `vim.fn.expand()` due to its overly aggressive
|
||||
expansion behavior which can sometimes lead to errors or the creation of
|
||||
non-existent paths when dealing with valid absolute paths.
|
||||
|
||||
Other paths will have '~' and environment variables expanded. Unlike
|
||||
`vim.fs.normalize()`, backslashes are preserved. This has better
|
||||
compatibility with `plenary.path` and also avoids mangling valid Unix paths
|
||||
with literal backslashes.
|
||||
|
||||
Trailing slashes are trimmed. With the exception of root paths. eg. `/` on
|
||||
Unix or `C:\` on Windows
|
||||
|
||||
|
||||
|
||||
Parameters: ~
|
||||
{path} (string)
|
||||
|
||||
Return: ~
|
||||
string
|
||||
|
||||
|
||||
utils.transform_path({opts}, {path}) *telescope.utils.transform_path()*
|
||||
Transform path is a util function that formats a path based on path_display
|
||||
found in `opts` or the default value from config. It is meant to be used in
|
||||
|
@ -2546,9 +2571,9 @@ utils.transform_path({opts}, {path}) *telescope.utils.transform_path()*
|
|||
|
||||
|
||||
Parameters: ~
|
||||
{opts} (table) The opts the users passed into the picker. Might
|
||||
contains a path_display key
|
||||
{path} (string) The path that should be formatted
|
||||
{opts} (table) The opts the users passed into the picker. Might
|
||||
contains a path_display key
|
||||
{path} (string|nil) The path that should be formatted
|
||||
|
||||
Return: ~
|
||||
string: The transformed path ready to be displayed
|
||||
|
|
|
@ -269,7 +269,7 @@ end
|
|||
--- this function outside of telescope might yield to undefined behavior and will
|
||||
--- not be addressed by us
|
||||
---@param opts table: The opts the users passed into the picker. Might contains a path_display key
|
||||
---@param path string?: The path that should be formatted
|
||||
---@param path string|nil: The path that should be formatted
|
||||
---@return string: The transformed path ready to be displayed
|
||||
utils.transform_path = function(opts, path)
|
||||
if path == nil then
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-- Just skip on mac, it has flaky CI for some reason
|
||||
if vim.fn.has "mac" == 1 then
|
||||
if vim.fn.has "mac" == 1 or require("telescope.utils").iswin then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
local picker = require "telescope.pickers"
|
||||
local Path = require "plenary.path"
|
||||
|
||||
local eq = assert.are.same
|
||||
|
||||
local function new_path(unix_path)
|
||||
return Path:new(unpack(vim.split(unix_path, "/"))).filename
|
||||
end
|
||||
|
||||
describe("telescope", function()
|
||||
describe("Picker", function()
|
||||
describe("window_dimensions", function()
|
||||
|
@ -84,8 +89,8 @@ describe("telescope", function()
|
|||
it("sorts matches after last os sep better", function()
|
||||
local sorter = require("telescope.sorters").get_fuzzy_file()
|
||||
|
||||
local better_match = sorter:score("aaa", { ordinal = "bbb/aaa" })
|
||||
local worse_match = sorter:score("aaa", { ordinal = "aaa/bbb" })
|
||||
local better_match = sorter:score("aaa", { ordinal = new_path "bbb/aaa" })
|
||||
local worse_match = sorter:score("aaa", { ordinal = new_path "aaa/bbb" })
|
||||
|
||||
assert(better_match < worse_match, "Final match should be stronger")
|
||||
end)
|
||||
|
@ -103,6 +108,7 @@ describe("telescope", function()
|
|||
describe("fzy", function()
|
||||
local sorter = require("telescope.sorters").get_fzy_sorter()
|
||||
local function score(prompt, line)
|
||||
line = new_path(line)
|
||||
return sorter:score(prompt, { ordinal = line }, function(val)
|
||||
return val
|
||||
end, function()
|
||||
|
@ -171,7 +177,7 @@ describe("telescope", function()
|
|||
end)
|
||||
|
||||
local function positions(prompt, line)
|
||||
return sorter:highlighter(prompt, line)
|
||||
return sorter:highlighter(prompt, new_path(line))
|
||||
end
|
||||
|
||||
describe("positioning", function()
|
||||
|
|
|
@ -4,6 +4,5 @@ set rtp+=../tree-sitter-lua/
|
|||
|
||||
runtime! plugin/plenary.vim
|
||||
runtime! plugin/telescope.lua
|
||||
runtime! plugin/ts_lua.vim
|
||||
|
||||
let g:telescope_test_delay = 100
|
||||
|
|
Loading…
Reference in a new issue