Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test and luacheck workflows in GH actions #2

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Luacheck

on:
push:
pull_request:

jobs:
luacheck:
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always have mixed feelings on -latest. It's nice to run latest, but sometimes it gives you an annoying surprise. No specific opinion either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll stick with -latest for now, and will likely reconsider if/when I get burned :)

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Luacheck linter
uses: lunarmodules/luacheck@v1
with:
args: src/
24 changes: 24 additions & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
globals = {
"unique_id"
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test:
tsc -f tests/*.lua
make -C tests test

test-deps:
luarocks install telescope
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ services:
nats:
image: nats
ports:
- "4222:4222"
- "4222:4222"
2 changes: 1 addition & 1 deletion src/nats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
tsc -f *.lua