refactor(tests): use package manager (#422)

This commit is contained in:
Null Chilly 2023-03-02 01:06:48 +07:00 committed by GitHub
parent 1b18b5850a
commit f08590be32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 44 deletions

56
.github/workflows/neovim.yml vendored Normal file
View file

@ -0,0 +1,56 @@
---
name: Neovim
on:
pull_request: ~
push:
paths-ignore:
- "*.md"
branches:
- main
jobs:
ubuntu:
name: Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Neovim
shell: bash
run: |
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.deb -O /tmp/nvim.deb
sudo dpkg -i /tmp/nvim.deb
- name: Run neovim
run: |
nvim --version
nvim --headless -u tests/init.lua +q
macos:
name: Macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Neovim
run: |
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
xattr -c ./nvim-macos.tar.gz
tar xzvf nvim-macos.tar.gz &> /dev/null
ln -s $(pwd)/nvim-macos/bin/nvim /usr/local/bin/nvim
- name: Run neovim
run: |
nvim --version
nvim --headless -u tests/init.lua +q
windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Neovim
run: |
C:\msys64\usr\bin\wget.exe -q https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip
7z x nvim-win64.zip
Add-Content $env:GITHUB_PATH ".\nvim-win64\bin\"
- name: Run neovim
run: |
nvim --version
nvim --headless -u tests/init.lua +q

View file

@ -10,7 +10,7 @@ on:
jobs:
ubuntu:
name: Run tests on Ubuntu
name: Plenary
runs-on: ubuntu-latest
steps:
@ -23,51 +23,9 @@ jobs:
- name: Fetch dependencies
run: |
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/kyazdani42/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: |
nvim --version
[ ! -d tests ] && exit 0
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal_init.vim', sequential = true}"
macos:
name: Run tests on Macos
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Neovim
run: |
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
xattr -c ./nvim-macos.tar.gz
tar xzvf nvim-macos.tar.gz &> /dev/null
ln -s $(pwd)/nvim-macos/bin/nvim /usr/local/bin/nvim
- name: Fetch dependencies
run: |
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/kyazdani42/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: |
nvim --version
[ ! -d tests ] && exit 0
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal_init.vim', sequential = true}"
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Neovim
run: |
C:\msys64\usr\bin\wget.exe -q https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip
7z x nvim-win64.zip
Add-Content $env:GITHUB_PATH ".\nvim-win64\bin\"
# - name: Fetch dependencies
# run: |
# 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/kyazdani42/nvim-web-devicons ~/.local/share/nvim/site/pack/vendor/start/nvim-web-devicons
# ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: |
nvim --version
nvim --headless -c "0cq" +q # PLENNARY DOESN'T WORK ON WINDOWS
# nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal_init.vim', sequential = true}"
nvim --headless -u tests/minimal_init.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal_init.vim', sequential = true}"

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
doc/tags
.vscode/
.DS_Store
.repro

27
tests/init.lua Normal file
View file

@ -0,0 +1,27 @@
local status, error = pcall(function()
local root = vim.fn.fnamemodify(".repro", ":p")
for _, name in ipairs { "config", "data", "state", "cache" } do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }
end
vim.opt.runtimepath:prepend(lazypath)
require("lazy").setup({
{ "catppuccin/nvim", dev = true },
}, {
root = root .. "/plugins",
dev = {
path = debug.getinfo(1).source:sub(2, -21),
},
})
require("catppuccin").setup()
vim.cmd.colorscheme "catppuccin"
end)
if error then print(error) end
vim.cmd(status and "0cq" or "1cq")