From b4c5b526d4d0e1748d872260471cc6c72389ef0a Mon Sep 17 00:00:00 2001 From: Raezil Date: Sat, 29 Aug 2026 17:01:33 +0200 Subject: [PATCH 1/4] Fix CI LuaRocks module paths --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d310cc6..da3ecfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,12 +33,15 @@ jobs: luarocks install dkjson luarocks install luasec - - name: Verify JSON dependencies + - name: Verify dependencies run: | + eval "$(luarocks path)" + lua -e "assert(require('socket.http'))" lua -e "assert(require('dkjson'))" lua -e "assert(require('cjson.safe'))" - name: Run tests run: | + eval "$(luarocks path)" make test make integration From 18e45f1cce1d586a4bc9308915b3a824dc53aef2 Mon Sep 17 00:00:00 2001 From: Raezil Date: Sat, 29 Aug 2026 17:04:38 +0200 Subject: [PATCH 2/4] Fix CI LuaSocket runtime setup --- .github/workflows/ci.yml | 4 ++-- lua/utcp/transports/http.lua | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da3ecfa..c5a7b42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,12 +19,12 @@ jobs: uses: actions/checkout@v4 - name: Set up Lua - uses: leafo/gh-actions-lua@v11 + uses: leafo/gh-actions-lua@v13 with: luaVersion: ${{ matrix.lua }} - name: Set up LuaRocks - uses: leafo/gh-actions-luarocks@v5 + uses: leafo/gh-actions-luarocks@v6 - name: Install dependencies run: | diff --git a/lua/utcp/transports/http.lua b/lua/utcp/transports/http.lua index b4e8d48..fcc8871 100644 --- a/lua/utcp/transports/http.lua +++ b/lua/utcp/transports/http.lua @@ -8,7 +8,10 @@ local function socket_http() if cached_http then return cached_http, cached_ltn12 end if socket_error then return nil, socket_error end local ok, http = pcall(require, 'socket.http') - if not ok then socket_error = 'lua-socket is required'; return nil, socket_error end + if not ok then + socket_error = 'lua-socket is required: ' .. tostring(http) + return nil, socket_error + end local ok2, ltn12 = pcall(require, 'ltn12') if not ok2 then socket_error = 'ltn12 is required'; return nil, socket_error end cached_http, cached_ltn12 = http, ltn12 From c28c94907cb9e60aed07bace3dddc21259a36e84 Mon Sep 17 00:00:00 2001 From: Raezil Date: Sat, 29 Aug 2026 17:07:27 +0200 Subject: [PATCH 3/4] Isolate CI LuaRocks dependencies --- .github/workflows/ci.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5a7b42..20294e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ jobs: test: name: Lua ${{ matrix.lua }} runs-on: ubuntu-latest + env: + LUAROCKS_TREE: ${{ github.workspace }}/.luarocks strategy: fail-fast: false matrix: @@ -25,23 +27,26 @@ jobs: - name: Set up LuaRocks uses: leafo/gh-actions-luarocks@v6 + with: + withLuaPath: ${{ github.workspace }}/.lua - name: Install dependencies run: | - luarocks install luasocket - luarocks install lua-cjson - luarocks install dkjson - luarocks install luasec + luarocks --tree="$LUAROCKS_TREE" install luasocket + luarocks --tree="$LUAROCKS_TREE" install lua-cjson + luarocks --tree="$LUAROCKS_TREE" install dkjson + luarocks --tree="$LUAROCKS_TREE" install luasec - name: Verify dependencies run: | - eval "$(luarocks path)" + eval "$(luarocks --tree="$LUAROCKS_TREE" path)" + luarocks --tree="$LUAROCKS_TREE" show luasocket lua -e "assert(require('socket.http'))" lua -e "assert(require('dkjson'))" lua -e "assert(require('cjson.safe'))" - name: Run tests run: | - eval "$(luarocks path)" + eval "$(luarocks --tree="$LUAROCKS_TREE" path)" make test make integration From c68bc659dc852cd28c005640a19a117a88fd5033 Mon Sep 17 00:00:00 2001 From: Raezil Date: Sat, 29 Aug 2026 17:10:37 +0200 Subject: [PATCH 4/4] Preserve LuaRocks path in Makefile --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 864999b..406dbe1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ LUA ?= lua -LUA_PATH := ./lua/?.lua;./lua/?/init.lua;; +# Keep the project sources first, then expose pure-Lua dependencies from the +# active LuaRocks tree. This is evaluated by make because its exported +# LUA_PATH overrides any value set by a calling shell. +LUAROCKS_PATH_ARGS := $(if $(strip $(LUAROCKS_TREE)),--tree="$(LUAROCKS_TREE)") +LUAROCKS_LUA_PATH := $(shell luarocks $(LUAROCKS_PATH_ARGS) path --lr-path 2>/dev/null) +LUA_PATH := ./lua/?.lua;./lua/?/init.lua;$(LUAROCKS_LUA_PATH);; export LUA_PATH .PHONY: test examples examples-local integration check zip servers server-http server-sse server-streamable server-tcp server-udp server-graphql server-mcp \