update CI

This commit is contained in:
glepnir 2025-01-19 19:58:59 +08:00
parent 3db95f2ba7
commit 6af2c7463c
3 changed files with 31 additions and 39 deletions

View File

@ -14,7 +14,6 @@ jobs:
version: latest version: latest
args: --check . args: --check .
docs: docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: pandoc to vimdoc name: pandoc to vimdoc
@ -24,40 +23,11 @@ jobs:
- name: panvimdoc - name: panvimdoc
uses: kdheepak/panvimdoc@main uses: kdheepak/panvimdoc@main
with: with:
vimdoc: nvim-plugin-template vimdoc: guard.nvim
treesitter: true treesitter: true
- uses: stefanzweifel/git-auto-commit-action@v4 - uses: stefanzweifel/git-auto-commit-action@v4
with: with:
commit_message: 'chore(doc): auto generate docs' commit_message: "chore(doc): auto generate docs"
commit_user_name: "github-actions[bot]" commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com" commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <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-openresty"
- name: luarocks
uses: leafo/gh-actions-luarocks@v4
- name: run test
shell: bash
run: |
luarocks install luacheck
luarocks install vusted
vusted ./test

27
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Run tests
on:
pull_request: ~
push:
branches:
- main
jobs:
build:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
neovim_version: ['nightly', 'stable']
steps:
- uses: actions/checkout@v4
- name: Download stylua
shell: bash
run: |
wget "https://github.com/JohnnyMorganz/StyLua/releases/download/v0.18.0/stylua-linux.zip" -P /home/runner/.local/bin
unzip /home/runner/.local/bin/stylua-linux.zip -d /home/runner/.local/bin
chmod +x /home/runner/.local/bin/stylua
- name: Run tests
uses: nvim-neorocks/nvim-busted-action@v1
with:
nvim_version: ${{ matrix.neovim_version }}

View File

@ -18,19 +18,14 @@ The CI uses `stylua` to format the code; customize the formatting by editing `.s
## Test ## Test
Uses [busted](https://lunarmodules.github.io/busted/) for testing. Installs by using `luarocks --lua-version=5.1 install vusted` then runs `vusted ./test` See [Running tests locally](https://github.com/nvim-neorocks/nvim-busted-action?tab=readme-ov-file#running-tests-locally)
for your test cases. `vusted` is a wrapper of Busted especially for testing Neovim plugins.
Create test cases in the `test` folder. Busted expects files in this directory to be named `foo_spec.lua`, with `_spec` as a suffix before the `.lua` file extension. For more usage details please check
[busted usage](https://lunarmodules.github.io/busted/)
## CI ## CI
- Auto generates doc from README. - Auto generates doc from README.
- Runs the Busted/vusted integration tests - Runs the [nvim-busted-action](https://github.com/nvim-neorocks/nvim-busted-action) for test.
- Lints with `stylua`. - Lints with `stylua`.
## More ## More
To see this template in action, take a look at my other plugins. To see this template in action, take a look at my other plugins.