22
.emmyrc.json
Normal file
22
.emmyrc.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
|
||||
"diagnostics": {
|
||||
"disable": [
|
||||
"access-invisible",
|
||||
"redefined-local"
|
||||
]
|
||||
},
|
||||
"runtime": {
|
||||
"version": "LuaJIT"
|
||||
},
|
||||
"workspace": {
|
||||
"ignoreDir": [
|
||||
".prefix"
|
||||
],
|
||||
"library": [
|
||||
"$VIMRUNTIME",
|
||||
"library/busted",
|
||||
"library/luv"
|
||||
]
|
||||
}
|
||||
}
|
||||
63
.github/workflows/ci.yaml
vendored
63
.github/workflows/ci.yaml
vendored
@@ -1,29 +1,52 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: NeoVim tests
|
||||
on: [push]
|
||||
name: ci
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
tags: ["*"]
|
||||
branches: ["*"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
MISE_EXPERIMENTAL: true
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
XDG_CONFIG_HOME: ${{ github.workspace }}/.config/
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
|
||||
- name: Populate Nix store
|
||||
run:
|
||||
nix-shell --pure --run 'true'
|
||||
- name: Setup environment
|
||||
run: |
|
||||
if [ -n "${{secrets.TOKEN}}" ]; then
|
||||
export GITHUB_TOKEN="${{secrets.TOKEN}}"
|
||||
fi
|
||||
export MISE_GITHUB_TOKEN="$GITHUB_TOKEN"
|
||||
echo "$GITHUB_TOKEN" >> $GITHUB_ENV
|
||||
echo "$MISE_GITHUB_TOKEN" >> $GITHUB_ENV
|
||||
|
||||
- name: Type-check with lua-language-server
|
||||
run:
|
||||
nix-shell --pure --run 'make lint'
|
||||
- name: Install mise
|
||||
run: |
|
||||
curl https://mise.run | sh
|
||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
|
||||
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
|
||||
mise use -g rust@1.92.0
|
||||
|
||||
- name: Check formatting with stylua
|
||||
run:
|
||||
nix-shell --pure --run 'make fmt-check'
|
||||
- name: Install mise dependencies
|
||||
run: mise install
|
||||
|
||||
- name: Run busted tests
|
||||
run:
|
||||
nix-shell --pure --run 'make test'
|
||||
- name: Check Lua formatting
|
||||
run: mise run fmt:check
|
||||
|
||||
- name: Lint with emmylua_check
|
||||
run: mise run lint
|
||||
|
||||
- name: Run tests
|
||||
run: mise run test:all
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.prefix/
|
||||
*.src.rock
|
||||
*.aider*
|
||||
luacov.*.out
|
||||
|
||||
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
[submodule "library/busted"]
|
||||
path = library/busted
|
||||
url = https://github.com/LuaCATS/busted
|
||||
branch = main
|
||||
[submodule "library/luv"]
|
||||
path = library/luv
|
||||
url = https://github.com/LuaCATS/luv
|
||||
branch = main
|
||||
[submodule "nvimv"]
|
||||
path = nvimv
|
||||
url = https://github.com/jrop/nvimv
|
||||
branch = main
|
||||
16
.luarc.json
Normal file
16
.luarc.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/refs/heads/master/setting/schema.json",
|
||||
"runtime": {
|
||||
"version": "LuaJIT"
|
||||
},
|
||||
"workspace": {
|
||||
"ignoreDir": [
|
||||
".prefix"
|
||||
],
|
||||
"library": [
|
||||
"$VIMRUNTIME",
|
||||
"library/busted",
|
||||
"library/luv"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
.styluaignore
Normal file
1
.styluaignore
Normal file
@@ -0,0 +1 @@
|
||||
library/
|
||||
24
Makefile
24
Makefile
@@ -1,24 +0,0 @@
|
||||
all: lint fmt-check test
|
||||
|
||||
lint:
|
||||
@echo "## Typechecking"
|
||||
@lua-language-server --check=lua/u/ --checklevel=Error
|
||||
|
||||
fmt-check:
|
||||
@echo "## Checking code format"
|
||||
@stylua --check .
|
||||
|
||||
fmt:
|
||||
@echo "## Formatting code"
|
||||
@stylua .
|
||||
|
||||
test:
|
||||
@rm -f luacov.*.out
|
||||
@echo "## Running tests"
|
||||
@busted --coverage --verbose
|
||||
@echo "## Generating coverage report"
|
||||
@luacov
|
||||
@awk '/^Summary$$/{flag=1;next} flag{print}' luacov.report.out
|
||||
|
||||
watch:
|
||||
@watchexec -c -e lua make
|
||||
1
library/busted
Submodule
1
library/busted
Submodule
Submodule library/busted added at 5ed85d0e01
1
library/luv
Submodule
1
library/luv
Submodule
Submodule library/luv added at 3615eb12c9
112
mise.toml
Normal file
112
mise.toml
Normal file
@@ -0,0 +1,112 @@
|
||||
################################################################################
|
||||
## Tool Alias
|
||||
################################################################################
|
||||
|
||||
[tool_alias]
|
||||
gh_emmylua_check = "github:EmmyLuaLs/emmylua-analyzer-rust"
|
||||
|
||||
################################################################################
|
||||
## Tools
|
||||
################################################################################
|
||||
|
||||
[tools]
|
||||
jq = "1.8.1"
|
||||
lua = "5.1.5"
|
||||
neovim = "0.11.5"
|
||||
stylua = "2.3.1"
|
||||
|
||||
[tools.gh_emmylua_check]
|
||||
version = "0.19.0"
|
||||
[tools.gh_emmylua_check.platforms]
|
||||
linux-x64 = { asset_pattern = "*_check-linux-x64*" }
|
||||
macos-x64 = { asset_pattern = "*_check-darwin-x64*" }
|
||||
macos-arm64 = { asset_pattern = "*_check-darwin-arm64*" }
|
||||
|
||||
################################################################################
|
||||
# Env
|
||||
################################################################################
|
||||
|
||||
[env]
|
||||
ASDF_LUA_LUAROCKS_VERSION = "3.12.2"
|
||||
_.source = { path = "./scripts/env.sh", tools = true }
|
||||
|
||||
################################################################################
|
||||
# Tasks
|
||||
################################################################################
|
||||
|
||||
[tasks]
|
||||
lint = "emmylua_check --ignore '.prefix/**/*.*' ."
|
||||
fmt = "stylua ."
|
||||
"fmt:check" = "stylua --check ."
|
||||
|
||||
[tasks.test]
|
||||
run = 'mise test:version 0.11.5'
|
||||
|
||||
[tasks."test:version:no-prep"]
|
||||
hide = true
|
||||
usage = '''
|
||||
arg "<version>" help="The version of Neovim to test with"
|
||||
'''
|
||||
run = '''
|
||||
echo
|
||||
echo -----------------------------
|
||||
echo -----------------------------
|
||||
echo Neovim version=$usage_version
|
||||
echo -----------------------------
|
||||
echo -----------------------------
|
||||
echo
|
||||
./nvimv/nvimv install $usage_version
|
||||
eval $(./nvimv/nvimv env $usage_version)
|
||||
busted --verbose
|
||||
'''
|
||||
|
||||
[tasks."test:version"]
|
||||
depends = ["test:prepare"]
|
||||
usage = '''
|
||||
arg "<version>" help="The version of Neovim to test with"
|
||||
'''
|
||||
run = 'mise test:version:no-prep $usage_version'
|
||||
|
||||
[tasks."test:prepare"]
|
||||
run = '''
|
||||
# Install Lua test dependencies (busted, etc.):
|
||||
luarocks test --prepare
|
||||
echo
|
||||
|
||||
# Check that the nightly version of Neovim is not more than a day old:
|
||||
if find .prefix -path '**/nightly/**/nvim' -mtime -1 2>/dev/null | grep -q .; then
|
||||
echo "Neovim Nightly is up-to-date"
|
||||
else
|
||||
if ./nvimv/nvimv ls | grep nightly >/dev/null; then
|
||||
./nvimv/nvimv upgrade nightly
|
||||
else
|
||||
./nvimv/nvimv install nightly
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
'''
|
||||
|
||||
[tasks."test:all"]
|
||||
depends = ["test:prepare"]
|
||||
run = '''
|
||||
VERSIONS="0.11.5 nightly"
|
||||
for v in $VERSIONS; do
|
||||
mise test:version:no-prep $v
|
||||
done
|
||||
'''
|
||||
|
||||
[tasks."test:coverage"]
|
||||
depends = ["test:prepare"]
|
||||
run = '''
|
||||
rm -f ./luacov.*.*
|
||||
busted --coverage --verbose
|
||||
luacov
|
||||
awk '/^Summary$/{flag=1;next} flag{print}' luacov.report.out
|
||||
'''
|
||||
|
||||
[tasks.ci]
|
||||
run = '''
|
||||
mise run fmt:check
|
||||
mise run lint
|
||||
mise run test:all
|
||||
'''
|
||||
1
nvimv
Submodule
1
nvimv
Submodule
Submodule nvimv added at bd5c243b96
6
scripts/env.sh
Normal file
6
scripts/env.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export PREFIX="$(pwd)/.prefix"
|
||||
export VIMRUNTIME="$(nvim -u NORC --headless +'echo $VIMRUNTIME' +'quitall' 2>&1)"
|
||||
|
||||
eval $(luarocks path)
|
||||
@@ -1,3 +1,4 @@
|
||||
--- @diagnostic disable: undefined-field
|
||||
local Buffer = require 'u.buffer'
|
||||
local withbuf = loadfile './spec/withbuf.lua'()
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
--- @diagnostic disable: undefined-field
|
||||
local CodeWriter = require 'u.codewriter'
|
||||
|
||||
describe('CodeWriter', function()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
--- @diagnostic disable: undefined-field
|
||||
local Pos = require 'u.pos'
|
||||
local withbuf = loadfile './spec/withbuf.lua'()
|
||||
|
||||
|
||||
16
u-0.0.0-0.rockspec
Normal file
16
u-0.0.0-0.rockspec
Normal file
@@ -0,0 +1,16 @@
|
||||
rockspec_format = '3.0'
|
||||
package = 'u'
|
||||
version = '0.0.0-0'
|
||||
|
||||
source = {
|
||||
url = 'https://github.com/jrop/u.nvim',
|
||||
}
|
||||
|
||||
dependencies = {
|
||||
'lua = 5.1',
|
||||
}
|
||||
|
||||
test_dependencies = {
|
||||
'busted == 2.2.0-1',
|
||||
'luacov == 0.16.0-1',
|
||||
}
|
||||
Reference in New Issue
Block a user