From 1b4277636ad00369374d378092974190668b225b Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Sun, 21 Apr 2024 09:55:50 +0200 Subject: [PATCH] add luacheck and basic integration test --- .github/workflows/luacheck.yml | 10 ++++++++++ .github/workflows/test.yml | 13 +++++++++++++ .luacheckrc | 20 ++++++++++++++++++++ init.lua | 7 ++++++- mod.conf | 2 +- nodenames.txt | 5 +++++ 6 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/luacheck.yml create mode 100644 .github/workflows/test.yml create mode 100644 .luacheckrc create mode 100644 nodenames.txt diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..e930ebe --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,10 @@ +name: luacheck +on: [push, pull_request] +jobs: + luacheck: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + - name: Luacheck + uses: lunarmodules/luacheck@master \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..91a8d7b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,13 @@ +name: test + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: buckaroobanzay/mtt@main + with: + modname: framedglass diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..78fab36 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,20 @@ +globals = { + "framedglass" +} + +read_globals = { + -- Stdlib + string = {fields = {"split", "trim"}}, + table = {fields = {"copy", "getn"}}, + + -- Minetest + "minetest", + "ItemStack", + "dump", "dump2", + "VoxelArea", "vector", + + -- deps + "default", + "unifieddyes", + "mtt" +} diff --git a/init.lua b/init.lua index 5f72247..16d546f 100644 --- a/init.lua +++ b/init.lua @@ -142,7 +142,7 @@ if minetest.get_modpath("unifieddyes") then } local old_nodes = {} - for k, v in pairs(static_colors) do + for k in pairs(static_colors) do table.insert(old_nodes, "framedglass:steel_framed_obsidian_glass" .. k) end @@ -167,3 +167,8 @@ if minetest.get_modpath("unifieddyes") then end }) end + +if minetest.get_modpath("mtt") and mtt.enabled then + -- validate nodenames + mtt.validate_nodenames(minetest.get_modpath("framedglass") .. "/nodenames.txt") +end \ No newline at end of file diff --git a/mod.conf b/mod.conf index 017dd7b..7047e90 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,2 @@ name = framedglass -optional_depends = default, unifieddyes \ No newline at end of file +optional_depends = default, unifieddyes, mtt \ No newline at end of file diff --git a/nodenames.txt b/nodenames.txt new file mode 100644 index 0000000..2900fa7 --- /dev/null +++ b/nodenames.txt @@ -0,0 +1,5 @@ +framedglass:wooden_framed_glass +framedglass:steel_framed_obsidian_glass +framedglass:steel_framed_obsidian_glass_tinted +framedglass:steel_framed_glass +framedglass:wooden_framed_obsidian_glass