This commit is contained in:
mathew 2023-06-16 16:10:41 +08:00
parent fbb9b1248d
commit df1565e80c
8 changed files with 117 additions and 0 deletions

63
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Ci
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Stylua
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
docs:
runs-on: ubuntu-latest
name: pandoc to vimdoc
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: nvim-plugin-template.nvim
treesitter: true
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore(doc): auto generate docs'
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
test:
name: Run Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: rhysd/action-setup-vim@v1
id: vim
with:
neovim: true
version: nightly
- name: luajit
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "luajit-2.1.0-beta3"
- name: luarocks
uses: leafo/gh-actions-luarocks@v4
- name: run test
shell: bash
run: |
luarocks install luacheck
luarocks install vusted
vusted ./test

6
.stylua.toml Normal file
View File

@ -0,0 +1,6 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"

View File

@ -1,2 +1,21 @@
# nvim-plugin-template
neovim plugin template integration test and doc publish
## Usage
click `use this template` button generate a repo on your github. then clone your plugin repo.open
terminal then cd plugin directory , run `python3 rename.py your-plugin-name` this will replace all
`nvim-plugin-template` to your `pluing-name`. Then develope your plugin. Enjoy!
## Test
use vusted for test install by using `luarocks --lua-version=5.1 install vusted` then run `vusted test`
for your test cases
## Ci
Ci support auto generate doc from README and integration test.
## More
Other usage you can look at my plugins
## License MIT

View File

View File

View File

24
rename.py Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os, sys
if len(sys.argv) == 2:
new_name = sys.argv[1]
for dir in os.listdir(os.getcwd()):
if dir == "lua":
os.rename(os.path.join("lua", "nvim-plugin-template"), os.path.join("lua",new_name))
if dir == "plugin":
os.rename(os.path.join("plugin", "nvim-plugin-template.lua"),
os.path.join("plugin",new_name + ".lua"))
if dir == 'doc':
os.rename(os.path.join("doc", "nvim-plugin-template.txt"),
os.path.join("doc",new_name + ".txt"))
if dir == '.github':
with open(os.path.join(".github","workflows","ci.yml"), 'r+') as f:
d = f.read()
t = d.replace('nvim-plugin-template', new_name)
f.seek(0, 0)
f.write(t)
os.remove(os.path.join(os.getcwd(), 'rename.py'))

5
test/plugin_spec.lua Normal file
View File

@ -0,0 +1,5 @@
describe('neovim plugin', function()
it('work as expect', function()
assert.is_true(true)
end)
end)