Adds a new scripts/run-luatest.sh script to provide a consistent, self-contained way to run project unit tests, including locally. The script handles: - Checking for necessary tools (rg, ag) - Cloning or updating plenary.nvim into the target/tests/deps directory The Makefile is updated to use this new script, making make luatest the single entry point for running unit tests. The lua.yaml workflow is simplified to use this new make target, ensuring the CI environment uses the exact same testing logic.
75 lines
1.9 KiB
YAML
75 lines
1.9 KiB
YAML
name: Lua CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**/*.lua"
|
|
- ".github/workflows/lua.yaml"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**/*.lua"
|
|
- ".github/workflows/lua.yaml"
|
|
|
|
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"
|
|
}
|
|
sudo apt-get update
|
|
sudo apt-get install -y ripgrep
|
|
sudo apt-get install -y silversearcher-ag
|
|
|
|
- name: Run tests
|
|
run: |
|
|
export PATH="${PWD}/_neovim/bin:${PATH}"
|
|
export VIM="${PWD}/_neovim/share/nvim/runtime"
|
|
nvim --version
|
|
make luatest
|
|
|
|
typecheck:
|
|
name: Typecheck
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
nvim_version: [ stable ]
|
|
luals_version: [ 3.13.6 ]
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- uses: rhysd/action-setup-vim@v1
|
|
with:
|
|
neovim: true
|
|
version: ${{ matrix.nvim_version }}
|
|
|
|
- name: Typecheck
|
|
env:
|
|
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime
|
|
run: |
|
|
make lua-typecheck
|