-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
185 lines (154 loc) · 4.71 KB
/
mise.toml
File metadata and controls
185 lines (154 loc) · 4.71 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
[env]
MISE_USE_VERSIONS_HOST = "0"
_.path = [".luarocks/bin"]
[tasks.ci]
depends = ["lint", "test", "test-integration"]
description = "Run CI pipeline (lint + test)"
[tasks.clean]
description = "Clean up test installations"
run = '''
#!/usr/bin/env bash
set -euo pipefail
echo "Cleaning up..."
mise plugin uninstall postgres-binary 2>/dev/null || true
rm -rf ~/.local/share/mise/installs/postgres-binary* 2>/dev/null || true
rm -rf ~/.local/share/mise/downloads/postgres-binary* 2>/dev/null || true
echo "Clean complete"
'''
[tasks.coverage]
depends = ["test"]
description = "Generate coverage report with LuaCov"
run = '''
#!/usr/bin/env bash
set -euo pipefail
echo "Generating coverage report..."
.luarocks/bin/luacov
echo ""
echo "Coverage summary:"
grep -A 100 "^Summary" luacov.report.out | head -20
'''
[tasks.format]
description = "Format Lua code with stylua"
run = "stylua metadata.lua hooks/"
[tasks.lint]
description = "Run all linters (selene, stylua, actionlint)"
run = "hk run check --all"
[tasks.setup]
description = "Install development dependencies (busted, luacov)"
run = '''
#!/usr/bin/env bash
set -euo pipefail
echo "Installing Lua development dependencies via luarocks..."
luarocks install --tree .luarocks busted
luarocks install --tree .luarocks dkjson
luarocks install --tree .luarocks luacov
echo "Setup complete!"
'''
[tasks.test]
depends = ["setup"]
description = "Run unit tests with Busted"
run = '''
#!/usr/bin/env bash
set -euo pipefail
echo "Running unit tests with Busted..."
.luarocks/bin/busted
'''
[tasks.test-docker]
description = "Run Docker-based tests"
run = '''
#!/usr/bin/env bash
set -euo pipefail
FILTER="${1:-all}"
./docker/run-docker-tests.sh "$FILTER"
'''
[tasks.test-install]
description = "Full installation test with database operations"
run = '''
#!/usr/bin/env bash
set -euo pipefail
PG_VERSION="${1:-15.15.0}"
echo "Testing full installation of PostgreSQL $PG_VERSION..."
# Link plugin
mise plugin link --force postgres-binary "$PWD"
# Install
echo "Installing PostgreSQL $PG_VERSION..."
mise install "postgres-binary:postgres@$PG_VERSION"
# Verify binaries
echo "Verifying binaries..."
mise exec "postgres-binary:postgres@$PG_VERSION" -- postgres --version
mise exec "postgres-binary:postgres@$PG_VERSION" -- psql --version
mise exec "postgres-binary:postgres@$PG_VERSION" -- pg_dump --version
# Check environment - construct PGDATA from install path
echo "Checking environment..."
INSTALL_PATH="$HOME/.local/share/mise/installs/postgres-binary-postgres/$PG_VERSION"
PGDATA="$INSTALL_PATH/data"
echo "PGDATA=$PGDATA"
[ -d "$PGDATA" ] && echo "PGDATA directory exists" || exit 1
[ -f "$PGDATA/PG_VERSION" ] && echo "Database initialized" || exit 1
# Start and query
echo "Starting PostgreSQL..."
mise exec "postgres-binary:postgres@$PG_VERSION" -- pg_ctl start -D "$PGDATA" -l /tmp/pg-test.log -w
mise exec "postgres-binary:postgres@$PG_VERSION" -- psql -c "SELECT version();" postgres
mise exec "postgres-binary:postgres@$PG_VERSION" -- pg_ctl stop -D "$PGDATA" -m fast
echo "Full installation test passed!"
'''
[tasks.test-integration]
description = "Test the backend plugin (link and list versions)"
run = '''
#!/usr/bin/env bash
set -euo pipefail
echo "Testing mise-postgres-binary backend plugin..."
# Link plugin locally for testing
mise plugin link --force postgres-binary "$PWD"
# Test listing versions
echo "Listing available versions..."
mise ls-remote postgres-binary:postgres | head -5
echo "Backend plugin tests passed!"
'''
[tasks.test-version-matrix]
description = "Test multiple PostgreSQL versions (CI matrix simulation)"
run = '''
#!/usr/bin/env bash
set -euo pipefail
VERSIONS=("${@:-14.20.0 18.1.0}")
if [[ "$#" -eq 0 ]]; then
VERSIONS=("14.22.0" "18.3.0")
fi
mise plugin link --force postgres-binary "$PWD"
FAILED=()
for version in "${VERSIONS[@]}"; do
echo ""
echo "=== Testing PostgreSQL $version ==="
if mise install "postgres-binary:postgres@$version" && \
mise exec "postgres-binary:postgres@$version" -- postgres --version; then
echo "PASS: $version"
else
echo "FAIL: $version"
FAILED+=("$version")
fi
done
echo ""
echo "=== Summary ==="
echo "Tested: ${VERSIONS[*]}"
if [[ ${#FAILED[@]} -eq 0 ]]; then
echo "Result: All versions passed"
else
echo "Failed: ${FAILED[*]}"
exit 1
fi
'''
[tasks.versions-update-apply]
description = "Apply PostgreSQL version updates to CI matrix"
run = "./scripts/sync-postgres-versions.py --apply"
[tasks.versions-update-check]
description = "Check for new PostgreSQL versions and recommend CI matrix updates"
run = "./scripts/sync-postgres-versions.py"
[tools]
actionlint = "latest"
"cargo:selene" = "latest"
hk = "latest"
"pipx:toml-sort" = "latest"
pkl = "latest"
ruff = "latest"
stylua = "latest"
uv = "latest"