feat(ci): setup ci workflow and supporting configs

main
Scott McKendry 2024-06-22 21:26:00 +12:00
parent efbfe281aa
commit 0f455fbcab
6 changed files with 158 additions and 0 deletions

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

@ -0,0 +1,70 @@
name: CI
on:
push:
pull_request:
branches:
- main
jobs:
stylua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Stylua
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --color always --check .
selene:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Selene
run: cargo install selene
- name: Run Selene
run: selene --display-style quiet --config ./.selene.toml lua
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install codespell
run: pip install codespell
- name: Use codespell
run: make spell
generate-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: panvimdoc
uses: kdheepak/panvimdoc@main
with:
vimdoc: telescope-resession
version: "Neovim >= 0.9.0"
titledatepattern: "%Y"
demojify: true
treesitter: true
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "docs: auto-generate vimdoc"
release:
runs-on: ubuntu-latest
needs: [stylua, selene, codespell, generate-doc]
if: github.ref == 'refs/heads/main'
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple

27
.neovim.std.yml Normal file
View File

@ -0,0 +1,27 @@
---
base: lua51
globals:
jit:
any: true
vim:
any: true
assert:
args:
- type: bool
- type: string
required: false
after_each:
args:
- type: function
before_each:
args:
- type: function
describe:
args:
- type: string
- type: function
it:
args:
- type: string
- type: function

9
.selene.toml Normal file
View File

@ -0,0 +1,9 @@
std = ".neovim.std"
[rules]
global_usage = "warn"
multiple_statements = "allow"
incorrect_standard_library_use = "allow"
mixed_table = "allow"
unused_variable = "warn"
unescoped_variables = "warn"

4
.stylua.toml Normal file
View File

@ -0,0 +1,4 @@
column_width = 120
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"

48
Makefile Normal file
View File

@ -0,0 +1,48 @@
ifeq ($(OS),Windows_NT)
GREEN=
RESTORE=
else
GREEN="\033[0;32m"
RESTORE="\033[0m"
endif
# make the output of the message appear green
define style_calls
$(eval $@_msg = $(1))
echo ${GREEN}${$@_msg}${RESTORE}
endef
lint: style-lint
@$(call style_calls,"Running selene")
@selene --display-style quiet --config ./.selene.toml lua
@$(call style_calls,"Done!")
.PHONY: lint
style-lint:
@$(call style_calls,"Running stylua check")
@stylua --color always -f ./.stylua.toml --check lua
@$(call style_calls,"Done!")
.PHONY: style-lint
format:
@$(call style_calls,"Running stylua format")
@stylua --color always -f ./.stylua.toml lua
@$(call style_calls,"Done!")
.PHONY: format
spell:
@$(call style_calls,"Running codespell check")
@codespell --quiet-level=2 --check-hidden --skip=./.git,./CHANGELOG.md
@$(call style_calls,"Done!")
.PHONY: spell
spell-write:
@$(call style_calls,"Running codespell write")
@codespell --quiet-level=2 --check-hidden --skip=./.git,./CHANGELOG.md --write-changes
@$(call style_calls,"Done!")
.PHONY: spell-write

View File