Gate pull requests on stylua formatting #3

Merged
benvin merged 2 commits from benvin/stylua-check into main 2026-09-10 21:50:38 +10:00
3 changed files with 45 additions and 5 deletions
+32
View File
@@ -17,3 +17,35 @@ steps:
limits:
memory: 2Gi
cpu: 2
# stylua ships no apk package, so pull the pinned musl release through the
# artifact proxy and check the checksum. The proxy's TLS leaf chains to the
# internal CA, which alpine does not trust, so fetch over the plain-HTTP
# listener and let the digest carry integrity.
- name: fmt
image: alpine:3.22
environment:
STYLUA_VERSION: v2.5.2
STYLUA_SHA256: ca6f1cf52eaf69e6632b81acef9c197aa24b85eb30d2455a35e7dbe28ae77c72
commands:
- apk add --no-cache curl unzip make
- |
HOST="http://artifactapi.k8s.syd1.au.unkin.net"
ZIP="stylua-linux-x86_64-musl.zip"
curl -fsSL -o /tmp/$$ZIP \
"$$HOST/api/v1/remote/github/JohnnyMorganz/StyLua/releases/download/$${STYLUA_VERSION}/$$ZIP"
echo "$${STYLUA_SHA256} /tmp/$$ZIP" | sha256sum -c -
unzip -o -d /usr/local/bin /tmp/$$ZIP
chmod +x /usr/local/bin/stylua
- stylua --version
- make fmt-check
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 256Mi
cpu: 500m
limits:
memory: 1Gi
cpu: 1
+7 -2
View File
@@ -1,4 +1,4 @@
.PHONY: test lint fmt pre-commit package verify-package patch minor major _tag
.PHONY: test lint fmt fmt-check pre-commit package verify-package patch minor major _tag
VERSION ?= $(shell git describe --tags --always)
# Archive names drop the leading "v", the way tag source archives do.
@@ -12,8 +12,13 @@ test:
lint:
luacheck lua tests
LUA_SOURCES = lua tests plugin
fmt:
stylua lua tests
stylua $(LUA_SOURCES)
fmt-check:
stylua --check $(LUA_SOURCES)
pre-commit:
@uvx pre-commit run --all-files
+6 -3
View File
@@ -60,9 +60,12 @@ local function run(ctx, specs)
installer.run(ctx, specs, function(r)
results = r
end)
assert(vim.wait(30000, function()
return results ~= nil
end, 20), 'installer.run never called back')
assert(
vim.wait(30000, function()
return results ~= nil
end, 20),
'installer.run never called back'
)
return results
end