From 023a2a8677a8bf3f3105093574c6cea1cd26b973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cas=C3=ADa?= <31012661+rcasia@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:17:22 +0200 Subject: [PATCH 1/4] feat(ci): check formatting with lx fmt instead of stylua-action --- .github/workflows/static-analysis.yml | 21 ++++++++++++++------- CONTRIBUTING.md | 3 +++ Makefile | 5 ++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index ebf124e3..08e89483 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -25,6 +25,12 @@ on: - ".github/workflows/lux.yml" jobs: + # NOTE: linting stays on the system luacheck action for now. + # `lx lint` (same luacheck under the hood) cannot run on + # GitHub-hosted ubuntu runners: lux's auto-installed static Lua + # can't dlopen the luafilesystem C module + # (`lfs.so: undefined symbol: lua_gettop`). Revisit when + # upstream lux fixes Linux C-module loading. luacheck: runs-on: ubuntu-latest steps: @@ -33,18 +39,19 @@ jobs: - name: Luacheck uses: lunarmodules/luacheck@v1.2.0 - stylua: + fmt: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - - name: Stylua - uses: JohnnyMorganz/stylua-action@v5 + - name: Install Lux + uses: lumen-oss/gh-actions-lux@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} - version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes - # CLI arguments - args: --check . + version: 0.46.0 + - name: Check formatting with lux + run: | + lx --lua-version 5.1 fmt + git diff --exit-code lua-language-server: runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15af9acf..d71cee14 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -108,6 +108,9 @@ make lux-sync # Build the project make lux-build +# Format via lux (stylua) +make lux-fmt + # Lint via lux (luacheck) make lux-lint diff --git a/Makefile b/Makefile index b8c6e361..36924914 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean test test-fail-fast test-e2e lux-sync lux-build lux-lint lux-test +.PHONY: clean test test-fail-fast test-e2e lux-sync lux-build lux-fmt lux-lint lux-test all: hooks test @@ -67,6 +67,9 @@ lux-sync: lux-build: lx --lua-version 5.1 build +lux-fmt: + lx --lua-version 5.1 fmt + lux-lint: lx --lua-version 5.1 lint From 32b9d145e14763f838f376b03623b5359265f9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cas=C3=ADa?= <31012661+rcasia@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:25:32 +0200 Subject: [PATCH 2/4] feat(ci): lint with lx lint instead of luacheck-action --- .github/workflows/static-analysis.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 08e89483..24019207 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -25,19 +25,17 @@ on: - ".github/workflows/lux.yml" jobs: - # NOTE: linting stays on the system luacheck action for now. - # `lx lint` (same luacheck under the hood) cannot run on - # GitHub-hosted ubuntu runners: lux's auto-installed static Lua - # can't dlopen the luafilesystem C module - # (`lfs.so: undefined symbol: lua_gettop`). Revisit when - # upstream lux fixes Linux C-module loading. - luacheck: + lint: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - - name: Luacheck - uses: lunarmodules/luacheck@v1.2.0 + - name: Install Lux + uses: lumen-oss/gh-actions-lux@v1 + with: + version: 0.46.0 + - name: Lint with lux + run: lx --lua-version 5.1 lint fmt: runs-on: ubuntu-latest From 560693195f9b8d86dd89aae105314890f9526e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cas=C3=ADa?= <31012661+rcasia@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:26:58 +0200 Subject: [PATCH 3/4] fix(ci): use system lua5.1 for lx lint so luafilesystem links dynamically --- .github/workflows/static-analysis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 24019207..5e736614 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -34,6 +34,13 @@ jobs: uses: lumen-oss/gh-actions-lux@v1 with: version: 0.46.0 + # lux's auto-installed static Lua can't dlopen C modules + # (`lfs.so: undefined symbol: lua_gettop`), which `lx lint` + # needs via luacheck → luafilesystem. A distro Lua links + # liblua dynamically, so luafilesystem loads fine when lux + # detects and uses the system interpreter instead. + - name: Install system Lua 5.1 + run: sudo apt-get update && sudo apt-get install -y lua5.1 liblua5.1-0-dev - name: Lint with lux run: lx --lua-version 5.1 lint From f659937601b0b00dd0a1f4327b472d7dc1d74063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Cas=C3=ADa?= <31012661+rcasia@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:43:42 +0200 Subject: [PATCH 4/4] docs: drop stale stylua/luacheck binaries, lint via lx --- .github/workflows/static-analysis.yml | 2 ++ .pre-commit-config.yaml | 16 ++++++++-------- CONTRIBUTING.md | 19 ++++++++++++++----- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 5e736614..93717463 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -8,6 +8,7 @@ on: - "*.lua" - ".stylua.toml" - ".luacheckrc" + - ".pre-commit-config.yaml" - "lux.toml" - "lux.lock" - ".github/workflows/static-analysis.yml" @@ -19,6 +20,7 @@ on: - "*.lua" - ".stylua.toml" - ".luacheckrc" + - ".pre-commit-config.yaml" - "lux.toml" - "lux.lock" - ".github/workflows/static-analysis.yml" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 81ad7b7b..7feb70bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,19 +40,19 @@ repos: - repo: local hooks: - - id: stylua_check - name: Stylua Check - entry: stylua + - id: lux_fmt + name: Lux Fmt + entry: lx --lua-version 5.1 fmt language: system - pass_filenames: true + pass_filenames: false types_or: [lua] stages: [pre-commit] - - id: luacheck - name: Luacheck - entry: luacheck + - id: lux_lint + name: Lux Lint + entry: lx --lua-version 5.1 lint language: system - pass_filenames: true + pass_filenames: false types_or: [lua] stages: [pre-commit] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d71cee14..f208ad1d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,13 +22,22 @@ You will need: - Java JDK 17 or 21 - The following tools available in your terminal: - pre-commit () - - `stylua` - - `luacheck` - - `make` - - `git` - `lx` () — for package management (`lux.toml` is the single source of truth - for the luarocks package) + for the luarocks package), formatting (`lx fmt`) + and linting (`lx lint`) + - `make` + - `git` + +> On Linux, `lx lint` needs a dynamically-linked Lua 5.1, +> otherwise luacheck's `luafilesystem` module fails to load +> (`lfs.so: undefined symbol: lua_gettop`): +> +> ```bash +> sudo apt-get install lua5.1 liblua5.1-0-dev +> ``` +> +> macOS works out of the box. #### First build