Skip to content

Commit

Permalink
ci: Improve nvim & treesitter setup in CI, remove format-queries script
Browse files Browse the repository at this point in the history
  • Loading branch information
liamwh committed Jul 4, 2024
1 parent cab9479 commit 57e31a6
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 466 deletions.
47 changes: 47 additions & 0 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)

-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Setup lazy.nvim
require("lazy").setup {
spec = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require "nvim-treesitter.configs"

configs.setup {
ensure_installed = { "query" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
}
end,
},
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
}
16 changes: 0 additions & 16 deletions .github/workflows/queries-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,3 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .

format-queries:
name: Lint queries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
tar -zxf nvim-linux64.tar.gz
sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin
- name: Lint Queries
run: |
nvim -l scripts/format-queries.lua
git diff --exit-code
26 changes: 26 additions & 0 deletions scripts/ci-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e

os=$(uname -s)
if [[ $os == Linux ]]; then
wget https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim-linux64.tar.gz
tar -zxf nvim-linux64.tar.gz
sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin
rm -rf "$PWD"/nvim-linux64/lib/nvim/parser
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
ln -s "$PWD" ~/.local/share/nvim/site/pack/nvim-treesitter/start
elif [[ $os == Darwin ]]; then
RELEASE_NAME="nvim-macos-$(uname -m)"
curl -L "https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/$RELEASE_NAME.tar.gz" | tar -xz
sudo ln -s "$PWD/$RELEASE_NAME/bin/nvim" /usr/local/bin
rm -rf "$PWD/$RELEASE_NAME/lib/nvim/parser"
mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
ln -s "$PWD" ~/.local/share/nvim/site/pack/nvim-treesitter/start
else
curl -L https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim-win64.zip -o nvim-win64.zip
unzip nvim-win64
mkdir -p ~/AppData/Local/nvim/pack/nvim-treesitter/start
mkdir -p ~/AppData/Local/nvim-data
cp -r "$PWD" ~/AppData/Local/nvim/pack/nvim-treesitter/start
fi
Loading

0 comments on commit 57e31a6

Please sign in to comment.