Skip to content

Commit

Permalink
Merge 8100962 into 0277403
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Apr 18, 2024
2 parents 0277403 + 8100962 commit f14a3b4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
- uses: buckaroobanzay/mtt@main
with:
modname: mtt
enable_coverage: "true"
enable_benchmarks: true
git_dependencies: |
https://github.com/BuckarooBanzay/promise
additional_config: |
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM registry.gitlab.com/minetest/minetest/server:5.6.1
USER root

RUN apk add --no-cache git
RUN apk add --no-cache git lua-dev luarocks &&\
luarocks-5.1 install luacov &&\
luarocks-5.1 install luacov-reporter-lcov

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT /entrypoint.sh
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ inputs:
description: "mapgen name"
required: false
default: "singlenode"
enable_coverage:
description: "enable lua code coverage"
required: false
default: "false"
enable_benchmarks:
description: "enable benchmarks"
required: false
default: "false"

runs:
using: docker
Expand Down
18 changes: 17 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ cat <<EOF > /minetest.conf
mg_name = ${INPUT_MAPGEN}
mtt_filter = ${INPUT_MODNAME}
mtt_enable = true
secure.trusted_mods = mtt
EOF
echo "${INPUT_ADDITIONAL_CONFIG}" >> /minetest.conf

test "${INPUT_ENABLE_COVERAGE}" == "true" && echo "mtt_enable_coverage = true" >> /minetest.conf
test "${INPUT_ENABLE_BENCHMARKS}" == "true" && echo "mtt_enable_benchmarks = true" >> /minetest.conf

# simple world.mt
cat <<EOF > ${WORLDPATH}/world.mt
enable_damage = false
Expand All @@ -40,4 +44,16 @@ world_name = mtt
EOF

# start the engine
minetestserver --config /minetest.conf --world ${WORLDPATH}
minetestserver --config /minetest.conf --world ${WORLDPATH}

# TODO: coverage filename replace
# sudo sed -i 's#/root/.minetest/worlds/world/worldmods/mtt/#/#g' coverage/lcov.info

ls -lha ${WORLDPATH}
ls -lha /var/lib/minetest

# coverage filename replace
test "${INPUT_ENABLE_COVERAGE}" == "true" &&{
sed -i "s#${WORLDPATH}/worldmods/${INPUT_MODNAME}/#/#g" lcov.info
cp lcov.info /github/workspace/
}

0 comments on commit f14a3b4

Please sign in to comment.