Skip to content

Commit

Permalink
ci: autodocs changes and lint tests (#62)
Browse files Browse the repository at this point in the history
Co-authored-by: tris203 <admin@snappeh.com>
  • Loading branch information
tris203 and tris203 authored Dec 30, 2023
1 parent d3d9521 commit 4eddc70
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .githooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
stylua --check lua/ --config-path ./.stylua.toml || exit 1
echo "Stylua check passed"

# Stylua Tests
stylua --check tests/ --config-path ./.stylua.toml || exit 1
echo "Stylua check tests passed"

# Luacheck
luacheck lua/ --globals vim || exit 1
echo "Luacheck passed"
Expand Down
37 changes: 19 additions & 18 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Format

on:
Expand All @@ -9,24 +10,24 @@ on:
- "main"

jobs:
format:
name: Stylua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: date +%W > weekly
format:
name: Stylua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: date +%W > weekly

- name: Restore cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('weekly') }}
- name: Restore cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('weekly') }}

- name: Install
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install stylua
- name: Install
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install stylua

- name: Format
run: stylua --check lua/ --config-path=.stylua.toml
- name: Format
run: stylua --check lua/ --config-path=.stylua.toml
33 changes: 33 additions & 0 deletions .github/workflows/format_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Format Tests

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
format:
name: Stylua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: date +%W > weekly

- name: Restore cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('weekly') }}

- name: Install
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install stylua

- name: Format
run: stylua --check tests/ --config-path=.stylua.toml
25 changes: 13 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Lint

on:
Expand All @@ -9,16 +10,16 @@ on:
- "main"

jobs:
lint:
name: Luacheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
run: |
sudo apt-get update
sudo apt-get install luarocks -y
sudo luarocks install luacheck
lint:
name: Luacheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
run: |
sudo apt-get update
sudo apt-get install luarocks -y
sudo luarocks install luacheck
- name: Lint
run: luacheck lua/ --globals vim
- name: Lint
run: luacheck lua/ --globals vim
4 changes: 3 additions & 1 deletion .github/workflows/panvimdoc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
name: Generate documentation

on:
push:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch:

permissions:
Expand All @@ -20,6 +21,7 @@ jobs:
vimdoc: hawtkeys
version: "NVIM >=0.9"
toc: true
description: "For NVIM >=0.9"
demojify: true
treesitter: true
- uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local shortIndex = vim.api

shortIndex.nvim_set_keymap("n", "<leader>4", ':echo "hello"<CR>', {})

10 changes: 5 additions & 5 deletions tests/hawtkeys/example_configs/blacklistCharacter_keymap.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
M = {}

vim.api.nvim_set_keymap('n', '<Plug>Test', '', {})
vim.api.nvim_set_keymap('n', '<leader>abÞ', '', {})
vim.api.nvim_set_keymap("n", "<Plug>Test", "", {})
vim.api.nvim_set_keymap("n", "<leader>abÞ", "", {})

M.reset = function()
vim.api.nvim_del_keymap('n', '<Plug>Test')
vim.api.nvim_del_keymap('n', '<leader>abÞ')
vim.api.nvim_del_keymap("n", "<Plug>Test")
vim.api.nvim_del_keymap("n", "<leader>abÞ")
end

return M
return M
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local normalMap = function(lhs, rhs)
vim.api.nvim_set_keymap('n', lhs, rhs, { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", lhs, rhs, { noremap = true, silent = true })
end
normalMap('<leader>5', ':echo "hello"<CR>')
normalMap("<leader>5", ':echo "hello"<CR>')
7 changes: 6 additions & 1 deletion tests/hawtkeys/example_configs/vim.api.nvim_set_keymap.lua
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
vim.api.nvim_set_keymap('n', '<leader>1', ':echo "hello"<CR>', {noremap = true})
vim.api.nvim_set_keymap(
"n",
"<leader>1",
':echo "hello"<CR>',
{ noremap = true }
)
2 changes: 1 addition & 1 deletion tests/hawtkeys/example_configs/vim.keymap.set_keymap.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
vim.keymap.set('n', '<leader>2', ':echo "hello"<CR>', {noremap = true})
vim.keymap.set("n", "<leader>2", ':echo "hello"<CR>', { noremap = true })

0 comments on commit 4eddc70

Please sign in to comment.