blob: 97d78c58a36ef4240eb32fbb1917c90115c08ff1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
[tools]
lua = "5.4"
# `mise run deps` installs the rocks into ./.rocks (gitignored); `mise run check`
# puts that tree on package.path and runs the specs. Both pin --lua-version 5.4
# because a stray system luarocks may default to another Lua.
#
# lyaml is a C binding over libyaml and needs the system library present:
# `brew install libyaml` on macOS, `apt install libyaml-dev` on Debian. The
# YAML_DIR below points luarocks at Homebrew's prefix when brew is available and
# otherwise lets luarocks search the usual system paths.
[tasks.deps]
description = "Install the Lua rocks the extension and specs need into ./.rocks"
dir = "{{config_root}}"
run = """
set -e
if brew --prefix libyaml >/dev/null 2>&1; then
luarocks --lua-version 5.4 --tree .rocks install lyaml YAML_DIR="$(brew --prefix libyaml)"
else
luarocks --lua-version 5.4 --tree .rocks install lyaml
fi
luarocks --lua-version 5.4 --tree .rocks install toml2lua
luarocks --lua-version 5.4 --tree .rocks install luv
luarocks --lua-version 5.4 --tree .rocks install dkjson
"""
# `mise run e2e` drives the REAL panto binary against the REAL rock through a
# scripted provider protocol (see e2e/run.lua). It is deliberately not a
# dependency of `check`: it needs the sibling pantograph checkout built, which a
# rock-only contributor has no reason to have. Point PANTO_REPO elsewhere, or
# PANTO_BIN straight at a binary, to skip the build.
[tasks.e2e]
description = "End-to-end: the real panto binary, the real rock, a scripted provider"
dir = "{{config_root}}"
run = """
set -e
PANTO_REPO="${PANTO_REPO:-$(cd .. && pwd)/pantograph}"
if [ -z "${PANTO_BIN:-}" ] && [ -d "$PANTO_REPO" ]; then
(cd "$PANTO_REPO" && mise exec -- zig build)
PANTO_BIN="$PANTO_REPO/zig-out/bin/panto"
fi
# The rock's lazily required dependencies (lyaml, toml2lua, dkjson) are handed
# to the embedded interpreter from this tree; see e2e/fixture.lua.
[ -d .rocks ] || mise run deps
PANTO_BIN="$PANTO_BIN" lua e2e/run.lua
"""
[tasks.check]
description = "Run the specs against ./.rocks"
dir = "{{config_root}}"
run = """
set -e
# Without the tree the specs still pass, but every case that needs a rock skips
# itself; install once rather than reporting a green run that tested less.
[ -d .rocks ] || mise run deps
eval "$(luarocks --lua-version 5.4 --tree .rocks path)"
lua spec/run.lua
"""
|