Skip to content

Commit

Permalink
Tweak lua coverage runner, add badges to individual readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Sep 12, 2024
1 parent 3b9aa3b commit fd96429
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 33 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/lua-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- run: lua -v && make lu_test COV=true

- run: find ./lua -print | sort

- run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} -F Lua
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Lua
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Olivia's Project Euler Solutions
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Java
.. |Js-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=JavaScript&logo=codecov&label=Js%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=JavaScript
.. |Lu-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Lua&logo=codecov&label=Lu%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Lua
.. |Py-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Python&logo=codecov&label=Py%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Python
.. |Rs-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Rust&logo=codecov&label=Rs%20Cov
Expand Down Expand Up @@ -94,6 +96,7 @@ Olivia's Project Euler Solutions
| | | | |ESLint| |
+------------+----------------------------+--------+-------------------+
| Lua | Lua 5+ [#]_ | 12 | |Luai| |br| |
| | | | |Lu-Cov| |br| |
| | | | |LuaCheck| |
+------------+----------------------------+--------+-------------------+
| Python | CPython 3.6+ |br| | 80 | |Python| |br| |
Expand Down
14 changes: 9 additions & 5 deletions c/README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
C Section
=========

.. |C Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml/badge.svg
.. |Ci| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/c.yml?logo=github&label=C%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c.yml
.. |C-lint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/c-lint.yml?logo=github&label=Linting
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/c-lint.yml
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml
.. |C-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=C&logo=codecov&label=C%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=C

|C Check|
|Ci| |C-Cov| |C-lint| |CodeQL|

All problems are solved in C11, though most if not all of it is
C99-compatible. It is tested on clang, gcc, pcc, tcc, and msvc (the Visual Studios
compiler).
All problems are solved in C99. It is tested on clang, gcc, pcc, tcc, and msvc (the Visual Studios compiler).

Organization
------------
Expand Down
12 changes: 9 additions & 3 deletions cplusplus/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
C++ Section
===========

.. |C++ Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml/badge.svg
.. |Cpi| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/cplusplus.yml?logo=github&label=Cpp%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml

|C++ Check|
.. |Cp-lint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/cplusplus-lint.yml?logo=github&label=Linting
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus-lint.yml
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml
.. |Cp-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Cpp&logo=codecov&label=Cpp%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Cpp

|Cpi| |Cp-Cov| |Cp-lint| |CodeQL|

All problems are solved in C++98. It is tested on clang, g++, and msvc (the Visual Studios compiler).

Expand Down
12 changes: 9 additions & 3 deletions csharp/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
C# Section
==========

.. |C# Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml/badge.svg
.. |C#i| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/csharp.yml?logo=github&label=C%23%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp.yml

|C# Check|
.. |C#-lint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/csharp-lint.yml?logo=github&label=Linting
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/csharp-lint.yml
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml
.. |Cs-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Csharp&logo=codecov&label=C%23%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Csharp

|C#i| |Cs-Cov| |C#-lint| |CodeQL|

All problems are solved in .NET 2+.

Expand Down
12 changes: 9 additions & 3 deletions java/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Java Section
============

.. |Java Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/java.yml/badge.svg
.. |Javai| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/java.yml?logo=github&label=Java%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/java.yml

|Java Check|
.. |Java-lint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/java-lint.yml?logo=github&label=Linting
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/java-lint.yml
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml
.. |Ja-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Java&logo=codecov&label=Java%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Java

|Javai| |Ja-Cov| |Java-lint| |CodeQL|

All problems are solved in Java 8+.

Expand Down
12 changes: 9 additions & 3 deletions javascript/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
JavaScript Section
==================

.. |JavaScript Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml/badge.svg
.. |JavaScript| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/javascript.yml?logo=github&label=Js%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/javascript.yml

|JavaScript Check|
.. |ESLint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/eslint.yml?logo=github&label=ESLint
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml
.. |Js-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=JavaScript&logo=codecov&label=Js%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=JavaScript
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml

|JavaScript| |Js-Cov| |ESLint| |CodeQL|

All problems are solved in ES6+ Javascript

Expand Down
4 changes: 3 additions & 1 deletion lua/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Lua Section
: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
.. |Lu-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Lua&logo=codecov&label=Lu%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Lua

|Luai| |LuaCheck|
|Luai| |LuaCheck| |Lu-Cov|

Organization
------------
Expand Down
15 changes: 8 additions & 7 deletions lua/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ end
local function check_problem(file_name, expected_answer, is_slow, problem_name)
print("Starting: " .. file_name)
local problem_func = load_problem("src/" .. file_name)
if is_slow and has_luacov
then
return
end
local start_time = os.clock()
local success, result = pcall(problem_func)
local elapsed_time = os.clock() - start_time
Expand All @@ -61,7 +65,7 @@ local function check_problem(file_name, expected_answer, is_slow, problem_name)
)
end

if not is_slow and not has_luacov and elapsed_time > 60 then
if not is_slow and elapsed_time > 60 then
error(
"Problem " .. problem_name .. " took ~" .. string.format("%.3f", elapsed_time) ..
"s, exceeding the expected time limit of 60s."
Expand Down Expand Up @@ -96,11 +100,8 @@ for file_name, config in pairs(problems) do
end

-- Slow testing loop
if not has_luacov
then
for file_name, config in pairs(problems) do
if config[2] then
check_problem(file_name, config[1], config[2], file_name:match("(%d+)"))
end
for file_name, config in pairs(problems) do
if config[2] then
check_problem(file_name, config[1], config[2], file_name:match("(%d+)"))
end
end
12 changes: 9 additions & 3 deletions python/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
Python Section
==============

.. |Python Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python.yml/badge.svg
.. |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

|Python Check|
.. |PythonLint| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/python-lint.yml?logo=github&label=Linting
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python-lint.yml
.. |Py-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Python&logo=codecov&label=Py%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Python
.. |CodeQL| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/codeql.yml?logo=github&label=CodeQL
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/codeql.yml

|Python| |Py-Cov| |PythonLint| |CodeQL|

All problems are solved in type-hinted python3

Expand Down
8 changes: 6 additions & 2 deletions rust/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Rust Section
============

.. |Rust Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml/badge.svg
.. |Rust| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/rust.yml?logo=github&label=Rs%20Tests
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust.yml
.. |RustClippy| image:: https://img.shields.io/github/actions/workflow/status/LivInTheLookingGlass/Euler/rust-clippy.yml?logo=github&label=Clippy
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml
.. |Rs-Cov| image:: https://img.shields.io/codecov/c/github/LivInTheLookingGlass/Euler?flag=Rust&logo=codecov&label=Rs%20Cov
:target: https://app.codecov.io/github/LivInTheLookingGlass/Euler?flags%5B0%5D=Rust

|Rust Check|
|Rust| |Rs-Cov| |RustClippy|

Organization
------------
Expand Down

0 comments on commit fd96429

Please sign in to comment.