Skip to content

Commit

Permalink
Attempt lua code coverage, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Sep 9, 2024
1 parent a7f5053 commit bd47605
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ component_management:
name: JavaScript
paths:
- javascript/**
- component_id: module_lua
name: Lua
paths:
- lua/**
- component_id: module_python
name: Python
paths:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/lua-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lua Lint

on:
push:
paths:
- 'lua/**'
- '!lua/README.rst'
schedule:
- cron: "0 0 1 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Luacheck linter
uses: lunarmodules/luacheck@v1
17 changes: 14 additions & 3 deletions .github/workflows/lua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ on:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
cancel-in-progress: true

jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
Expand Down Expand Up @@ -45,4 +44,16 @@ jobs:
brew install lua@${{ matrix.version }}
fi
- run: make lu_test
- uses: leafo/gh-actions-luarocks@v4
with:
withLuaPath: "lua"

- run: luarocks install luacov

- run: make lu_test COV=true

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Lua
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Olivia's Project Euler Solutions
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml
.. |Luai| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/lua.yml?logo=github&label=Lua%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/lua.yml
.. |LuaCheck| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/lua-lint.yml?logo=github&label=LuaCheck
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/lua-lint.yml
.. |Python| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/python.yml?logo=github&label=Py%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml
.. |PythonLint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/python-lint.yml?logo=github&label=Linting
Expand Down Expand Up @@ -91,7 +93,8 @@ Olivia's Project Euler Solutions
| | Browser [#]_ | | |CodeQL| |br| |
| | | | |ESLint| |
+------------+----------------------------+--------+-------------------+
| Lua | Lua 5+ [#]_ | 7 | |Luai| |
| Lua | Lua 5+ [#]_ | 7 | |Luai| |br| |
| | | | |LuaCheck| |
+------------+----------------------------+--------+-------------------+
| Python | CPython 3.6+ |br| | 80 | |Python| |br| |
| | Pypy 3.6+ |br| | | |Py-Cov| |br| |
Expand Down
9 changes: 8 additions & 1 deletion lua/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
BLUE=\033[0;34m
NC=\033[0m # No Color

COV?=false
ifneq ($(COV),false)
cov_args= -lluacov
else
cov_args=
endif

.PHONY: help
help:
@echo " $(BLUE)test$(NC) Run through all Lua tests in sequence."
Expand All @@ -9,7 +16,7 @@ help:

.PHONY: test
test: ../LICENSE
@lua test.lua
@lua test.lua $(cov_args)

test_%:
@$(MAKE) test $(MFLAGS)
Expand Down

0 comments on commit bd47605

Please sign in to comment.