Skip to content

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-z committed Aug 1, 2022
1 parent fd69b60 commit 08211ec
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Validate

on: [push, pull_request]

jobs:
format:
name: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: JohnnyMorganz/stylua-action@1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --color always --check lua/

lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup
run: |
sudo apt-get update
sudo apt-get install -y luarocks
sudo luarocks install luacheck
- name: Lint
run: sudo make lint

# Neatly stolen from telescope.nvim
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
manager: sudo apt-get
packages: -y fd-find
- os: ubuntu-latest
url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz
manager: sudo apt-get
packages: -y fd-find
- os: macos-latest
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
manager: brew
packages: fd
- os: macos-latest
url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-macos.tar.gz
manager: brew
packages: fd
steps:
- uses: actions/checkout@v2
- run: date +%F > todays-date
- name: Restore from todays cache
uses: actions/cache@v2
with:
path: _neovim
key: ${{ runner.os }}-${{ matrix.url }}-${{ hashFiles('todays-date') }}

- name: Prepare
run: |
${{ matrix.manager }} update
${{ matrix.manager }} install ${{ matrix.packages }}
test -d _neovim || {
mkdir -p _neovim
curl -sL ${{ matrix.url }} | 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
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Run tests
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
make test
9 changes: 9 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cache = true

codes = true

self = false

read_globals = {
"vim",
}
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test:
nvim --headless \
-u scripts/minimal.vim \
-c "PlenaryBustedDirectory lua/tests/automated { minimal_init = './scripts/minimal.vim' }"

format:
stylua lua/

lint:
luacheck lua
8 changes: 8 additions & 0 deletions lua/java_util/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
local M = {}

function M.setup(opts)
opts = opts or {}
print(vim.inspect(opts))
end

return M
5 changes: 5 additions & 0 deletions lua/tests/automated/java_util_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("java_util", function()
it("delete me", function()
assert.is_true(true)
end)
end)
22 changes: 22 additions & 0 deletions scripts/minimal.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
" Grabbing source code
set rtp+=.

" Using local versions of plenary and nvim-treesitter if possible
" This is required for CI
set rtp+=../plenary.nvim
set rtp+=../nvim-treesitter

" If you use vim-plug if you got it locally
set rtp+=~/.vim/plugged/plenary.nvim
set rtp+=~/.vim/plugged/nvim-treesitter

" If you are using packer
set rtp+=~/.local/share/nvim/site/pack/packer/start/plenary.nvim
set rtp+=~/.local/share/nvim/site/pack/packer/start/nvim-treesitter

" If you are using lunarvim
set rtp+=~/.local/share/lunarvim/site/pack/packer/start/plenary.nvim
set rtp+=~/.local/share/lunarvim/site/pack/packer/start/nvim-treesitter

runtime! plugin/plenary.vim
runtime! plugin/nvim-treesitter.lua
6 changes: 6 additions & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "Always"

0 comments on commit 08211ec

Please sign in to comment.