This implements mode mirroring github workflow in scripts/lua-typecheck.sh so that it can run locally. A supporting script scripts/setup_deps.sh is created to define and download/clone dependencies (plugins), as well as download luals, neovim runtime, and create luarc.json. setup_deps.sh is now the only and authoritative source of dependencies and luals version. Neovim version still comes from lua.yaml. To fetch neovim version from lua.yaml as well as figure out the right source of neovim package, dependency on yq is introduced when running locally in "managed" mode. Dependencies, neovim runtime, and luals are downloaded to target/tests subdirectory on local machine. luarc.json is created from a template there as well. The ability to run against the live system is preserved with "--live" option. In this case it assumes that neovim is using lazy package manager and optionally Mason, so if luals is not present in path the script will try to see if it is installed by Mason. When running in github CI neovim is set up through github action while dependencies and luals are handled by the scripts.
77 lines
2.1 KiB
YAML
77 lines
2.1 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"
|
|
# 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
|
|
|
|
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
|