Skip to content

Commit

Permalink
coverage (#1)
Browse files Browse the repository at this point in the history
* coverage

* luacov app

* luarocks fix

* sed post processing

* leading slash

* remove leading slash

* proper path mapping

---------

Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
  • Loading branch information
BuckarooBanzay and BuckarooBanzay committed Mar 23, 2023
1 parent c7635e5 commit ab59567
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: test
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo apt-get install -y luarocks
sudo luarocks install luacov-coveralls
docker-compose up --exit-code-from sut
sudo docker cp mtt_sut_1:/root/.minetest /root/
sudo docker cp mtt_sut_1:/var/lib/minetest/luacov.stats.out .
sudo chmod 755 /root -R
ls -lha /root/.minetest .
luacov-coveralls -v
docker cp mtt_sut_1:/var/lib/minetest/luacov.report.out .
sed -i 's#/root/.minetest/worlds/world/worldmods/test_mod/#test/mod/#g' luacov.report.out
- name: Coveralls
uses: coverallsapp/github-action@v1
with:
path-to-lcov: "luacov.report.out"
1 change: 1 addition & 0 deletions execute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local function shutdown()
minetest.request_shutdown("success")
if mtt.luacov_runner then
mtt.luacov_runner.save_stats()
mtt.luacov_runner.run_report()
end
end

Expand Down
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ if mtt.enabled then
end

mtt.luacov_runner.init({
include = include_paths
include = include_paths,
reporter = "lcov"
})
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM registry.gitlab.com/minetest/minetest/server:${ENGINE_VERSION}
USER root

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

ENTRYPOINT minetestserver --config /minetest.conf

0 comments on commit ab59567

Please sign in to comment.