From ba97e1128805fa3645885954bf47d009a11911f2 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 27 Sep 2024 14:53:06 +0200 Subject: [PATCH 1/2] Add a test workflow in GH actions The workflow is currently more limited than the existing one that used Travis CI and tested various versions of Lua, but at least it works and will be executed for all pushed commits and pull requests from now on. --- .github/workflows/test-all.yml | 24 ++++++++++++++++++++++++ Makefile | 2 +- docker-compose.yml | 2 +- tests/Makefile | 2 ++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test-all.yml create mode 100644 tests/Makefile 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/Makefile b/Makefile index 5a4270b..f4e6fbb 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/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 From 99242c6c3e21986aa1fe26ba3cf3a14621d7b650 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 27 Sep 2024 15:44:52 +0200 Subject: [PATCH 2/2] Add a Luacheck workflow --- .github/workflows/luacheck.yml | 16 ++++++++++++++++ .luacheckrc | 3 +++ src/nats.lua | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/luacheck.yml create mode 100644 .luacheckrc 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/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..074308f --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,3 @@ +globals = { + "unique_id" +} diff --git a/src/nats.lua b/src/nats.lua index fe9236e..ea15afb 100644 --- a/src/nats.lua +++ b/src/nats.lua @@ -48,7 +48,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