convert to mise
Some checks failed
ci / ci (push) Failing after 43s

This commit is contained in:
2026-01-18 21:01:05 -07:00
parent 72b6886838
commit 6847707e22
16 changed files with 241 additions and 43 deletions

22
.emmyrc.json Normal file
View 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"
]
}
}

View File

@@ -1,29 +1,59 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: NeoVim tests name: ci
on: [push]
on:
workflow_dispatch:
pull_request:
push:
tags: ["*"]
branches: ["*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
MISE_EXPERIMENTAL: true
jobs: jobs:
code-quality: ci:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: timeout-minutes: 10
XDG_CONFIG_HOME: ${{ github.workspace }}/.config/
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with: with:
nix_path: nixpkgs=channel:nixos-unstable submodules: true
- name: Populate Nix store - name: Install apt dependencies
run: run: |
nix-shell --pure --run 'true' sudo apt-get update
sudo apt-get install -y libreadline-dev
- name: Type-check with lua-language-server - name: Setup environment
run: run: |
nix-shell --pure --run 'make lint' 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: Check formatting with stylua - name: Install mise
run: run: |
nix-shell --pure --run 'make fmt-check' 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: Run busted tests - name: Install mise dependencies
run: run: mise install
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
View File

@@ -1,3 +1,4 @@
.prefix/
*.src.rock *.src.rock
*.aider* *.aider*
luacov.*.out luacov.*.out

12
.gitmodules vendored Normal file
View 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
View 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
View File

@@ -0,0 +1 @@
library/

View File

@@ -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

Submodule library/busted added at 5ed85d0e01

1
library/luv Submodule

Submodule library/luv added at 3615eb12c9

112
mise.toml Normal file
View 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

Submodule nvimv added at bd5c243b96

6
scripts/env.sh Normal file
View 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)

View File

@@ -1,3 +1,4 @@
--- @diagnostic disable: undefined-field
local Buffer = require 'u.buffer' local Buffer = require 'u.buffer'
local withbuf = loadfile './spec/withbuf.lua'() local withbuf = loadfile './spec/withbuf.lua'()

View File

@@ -1,3 +1,4 @@
--- @diagnostic disable: undefined-field
local CodeWriter = require 'u.codewriter' local CodeWriter = require 'u.codewriter'
describe('CodeWriter', function() describe('CodeWriter', function()

View File

@@ -1,3 +1,4 @@
--- @diagnostic disable: undefined-field
local Pos = require 'u.pos' local Pos = require 'u.pos'
local withbuf = loadfile './spec/withbuf.lua'() local withbuf = loadfile './spec/withbuf.lua'()

16
u-0.0.0-0.rockspec Normal file
View 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',
}