feat(ci): add luacov-console and enhance installation docs #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
neovim-version: ["stable", "nightly"] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
persist-credentials: false | |
- name: Setup Neovim | |
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2 | |
with: | |
neovim: true | |
version: ${{ matrix.neovim-version }} | |
- name: Setup Lua | |
uses: leafo/gh-actions-lua@8aace3457a2fcf3f3c4e9007ecc6b869ff6d74d6 # v11 | |
with: | |
luaVersion: "5.1" | |
- name: Setup Luarocks | |
uses: leafo/gh-actions-luarocks@4c082a5fad45388feaeb0798dbd82dbd7dc65bca # v5 | |
- name: Install dependencies | |
run: | | |
luarocks install luacheck | |
luarocks install busted | |
luarocks install luacov | |
luarocks install luacov-reporter-lcov | |
luarocks install luacov-console | |
- name: Run Luacheck | |
run: luacheck lua/ tests/ --no-unused-args --no-max-line-length | |
- name: Run tests | |
run: | | |
chmod +x ./run_tests.sh | |
./run_tests.sh | |
- name: Generate coverage report | |
run: | | |
luacov-console | |
luacov-console -r lcov > lcov.info | |
- name: Upload coverage report | |
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4 | |
with: | |
files: ./lcov.info | |
fail_ci_if_error: false | |
integration-tests: | |
runs-on: ubuntu-latest | |
needs: unit-tests | |
strategy: | |
matrix: | |
neovim-version: ["stable"] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
persist-credentials: false | |
- name: Setup Neovim | |
uses: rhysd/action-setup-vim@8e931b9954b19d4203d5caa5ff5521f3bc21dcc7 # v1.4.2 | |
with: | |
neovim: true | |
version: ${{ matrix.neovim-version }} | |
- name: Install test dependencies | |
run: | | |
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim | |
ln -s "$(pwd)" ~/.local/share/nvim/site/pack/vendor/start/claudecode.nvim | |
- name: Run integration tests | |
run: | | |
nvim --headless -u tests/minimal_init.lua -c "lua require('plenary.test_harness').test_directory('tests/integration', {minimal_init = 'tests/minimal_init.lua'})" |