feat: add luatest (#1064)

This commit is contained in:
yetone
2025-01-10 00:23:59 +08:00
committed by GitHub
parent 6c10081899
commit e14eb002d5
5 changed files with 319 additions and 6 deletions

View File

@@ -13,6 +13,41 @@ on:
- "**/*.lua"
jobs:
# reference from: https://github.com/nvim-lua/plenary.nvim/blob/2d9b06177a975543726ce5c73fca176cedbffe9d/.github/workflows/default.yml#L6C3-L43C20
run_tests:
name: unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rev: v0.10.0/nvim-linux64.tar.gz
steps:
- uses: actions/checkout@v3
- run: date +%F > todays-date
- name: Restore cache for today's nightly.
uses: actions/cache@v3
with:
path: _neovim
key: ${{ runner.os }}-${{ matrix.rev }}-${{ hashFiles('todays-date') }}
- name: Prepare
run: |
test -d _neovim || {
mkdir -p _neovim
curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
}
- name: Run tests
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
# install nvim-lua/plenary.nvim
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
nvim --version
make luatest
stylua:
name: Check Lua style
runs-on: ubuntu-latest
@@ -24,7 +59,8 @@ jobs:
crate: stylua
features: lua54
- run: stylua --version
- run: stylua --check ./lua/ ./plugin/
- run: stylua --color always --check ./lua/ ./plugin/ ./tests/
luacheck:
name: Lint Lua
runs-on: ubuntu-latest