Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: rework ci tests to include windows #3011

Merged
merged 2 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
build: rework ci tests to include windows
- add windows runner as part of test ci and fix any windows sensitive
  tests

- tweak Makefile & minimal_init so running tests locally isn't dependent
  on local directory structure (I wanted to do this with docgen as well
  but it's so flaky and impossible on nightly neovim anyways)
  • Loading branch information
jamestrew committed Apr 9, 2024
commit 14b73122bc881f4de01d7abdba093debaafb788e
49 changes: 17 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- os: macos-12
rev: nightly/nvim-macos.tar.gz
manager: brew
packages: ripgrep
install-rg: sudo apt-get update && sudo apt-get install -y 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 changes: 3 additions & 3 deletions .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Luacheck
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Prepare
run: |
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ jobs:
luarocks-upload:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: LuaRocks Upload
uses: nvim-neorocks/[email protected]
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
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
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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' }"

Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,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
Expand Down
2 changes: 1 addition & 1 deletion lua/tests/automated/pickers/find_files_spec.lua
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 9 additions & 3 deletions lua/tests/automated/telescope_spec.lua
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion scripts/minimal_init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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