172 lines
5.0 KiB
YAML
172 lines
5.0 KiB
YAML
name: Lua CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**/*.lua"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**/*.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"
|
|
}
|
|
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
|
|
|
|
stylua:
|
|
name: Check Lua style
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
|
- name: Install stylua
|
|
uses: baptiste0928/cargo-install@v3
|
|
with:
|
|
crate: stylua
|
|
features: lua54
|
|
- run: stylua --version
|
|
- run: stylua --color always --check ./lua/ ./plugin/ ./tests/
|
|
|
|
luacheck:
|
|
name: Lint Lua
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
|
- name: Luacheck linter
|
|
uses: lunarmodules/luacheck@cc089e3f65acdd1ef8716cc73a3eca24a6b845e4 # ratchet:lunarmodules/luacheck@v1
|
|
with:
|
|
args: ./lua/
|
|
|
|
typecheck:
|
|
name: Typecheck
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
nvim_version: [ stable ]
|
|
luals_version: [ 3.13.6 ]
|
|
steps:
|
|
- name: Checkout dependency neodev
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "folke/neodev.nvim"
|
|
path: "deps/neodev.nvim"
|
|
|
|
- name: Checkout dependency nvim-treesitter
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "nvim-treesitter/nvim-treesitter"
|
|
path: "deps/nvim-treesitter"
|
|
|
|
- name: Checkout dependency dressing.nvim
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "stevearc/dressing.nvim"
|
|
path: "deps/dressing.nvim"
|
|
|
|
- name: Checkout dependency plenary.nvim
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "nvim-lua/plenary.nvim"
|
|
path: "deps/plenary.nvim"
|
|
|
|
- name: Checkout dependency nui.nvim
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "MunifTanjim/nui.nvim"
|
|
path: "deps/nui.nvim"
|
|
|
|
- name: Checkout dependency mini.pick
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "echasnovski/mini.nvim"
|
|
path: "deps/mini.nvim"
|
|
|
|
- name: Checkout dependency telescope.nvim
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "nvim-telescope/telescope.nvim"
|
|
|
|
- name: Checkout dependency nvim-cmp
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "hrsh7th/nvim-cmp"
|
|
path: "deps/nvim-cmp"
|
|
|
|
- name: Checkout dependency fzf-lua
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "ibhagwan/fzf-lua"
|
|
path: "deps/fzf-lua"
|
|
|
|
- name: Checkout dependency nvim-web-devicons
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "nvim-tree/nvim-web-devicons"
|
|
path: "deps/nvim-web-devicons"
|
|
|
|
- name: Checkout dependency copilot.lua
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: "zbirenbaum/copilot.lua"
|
|
path: "deps/copilot.lua"
|
|
|
|
- uses: rhysd/action-setup-vim@v1
|
|
with:
|
|
neovim: true
|
|
version: ${{ matrix.nvim_version }}
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install luals
|
|
run: |
|
|
mkdir -p luals
|
|
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/${{ matrix.luals_version }}/lua-language-server-${{ matrix.luals_version }}-linux-x64.tar.gz" | tar zx --directory luals
|
|
|
|
- run: echo "luals/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Typecheck
|
|
env:
|
|
VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime
|
|
DEPS_PATH: /github/workspace/deps/
|
|
run: |
|
|
make lua-typecheck
|