diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..b6b05d7 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,16 @@ +name: Luacheck + +on: + push: + pull_request: + +jobs: + luacheck: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Luacheck linter + uses: lunarmodules/luacheck@v1 + with: + args: src/ diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml new file mode 100644 index 0000000..958cc8d --- /dev/null +++ b/.github/workflows/test-all.yml @@ -0,0 +1,24 @@ +name: Test features + +on: + push: + pull_request: + +jobs: + runner-job: + runs-on: ubuntu-latest + services: + nats: + image: nats + ports: + - "4222:4222" + steps: + - name: Install Luarocks + run: sudo apt-get update && sudo apt-get -y --no-install-recommends install luarocks + - name: Install telescope + run: sudo luarocks install telescope + - uses: actions/checkout@v4 + - name: Install deps + run: sudo make deps + - name: Test Features + run: make test diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..074308f --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,3 @@ +globals = { + "unique_id" +} diff --git a/Makefile b/Makefile index 3cb15eb..0aea749 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ test: - tsc -f tests/*.lua + make -C tests test test-deps: luarocks install telescope diff --git a/docker-compose.yml b/docker-compose.yml index 09935e8..1bed861 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,4 +4,4 @@ services: nats: image: nats ports: - - "4222:4222" \ No newline at end of file + - "4222:4222" diff --git a/src/nats.lua b/src/nats.lua index 1113c82..8da7e87 100644 --- a/src/nats.lua +++ b/src/nats.lua @@ -53,7 +53,7 @@ local function merge_defaults(parameters) if parameters == nil then parameters = {} end - for k, v in pairs(defaults) do + for k, _ in pairs(defaults) do if parameters[k] == nil then parameters[k] = defaults[k] end diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..8f19fe7 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,2 @@ +test: + tsc -f *.lua