build: rework ci tests to include windows (#3011)

This commit is contained in:
James Trew 2024-04-13 11:27:53 -04:00 committed by GitHub
parent 5a701e9990
commit 4d4ade7f2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 67 additions and 50 deletions

View file

@ -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

View file

@ -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') }}

View file

@ -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

View file

@ -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:
@ -15,8 +15,8 @@ jobs:
with:
summary: "Find, Filter, Preview, Pick. All lua, all the time."
detailed_description: |
A highly extendable fuzzy finder over lists.
Built on the latest awesome features from neovim core.
A highly extendable fuzzy finder over lists.
Built on the latest awesome features from neovim core.
Telescope is centered around modularity, allowing for easy customization.
dependencies: |
plenary.nvim

View file

@ -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' }"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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