mirror of
https://github.com/love2d/love.git
synced 2026-08-12 00:20:52 +02:00
use love-test-report action
added md support to work with love-test-report, a basic action made to just dump md files into repo checks
This commit is contained in:
+13
-11
@@ -205,14 +205,16 @@ jobs:
|
||||
with:
|
||||
name: love-windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}-dbg
|
||||
path: pdb/Release/*.pdb
|
||||
- name: Build Test Exe
|
||||
run: cmake --build build --config Release --target install
|
||||
- name: Run All Tests
|
||||
run: love-windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}.exe testing --console --runAllTests
|
||||
- name: Test Report
|
||||
uses: dorny/test-reporter@v1
|
||||
run: install\love.exe testing --console --runAllTests
|
||||
- name: Love Test Report
|
||||
uses: ellraiser/love-test-report@main
|
||||
with:
|
||||
name: Test Output
|
||||
path: testing/output/*.xml
|
||||
reporter: jest-junit
|
||||
name: Love Testsuite Windows
|
||||
title: windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}-test-report
|
||||
path: testing/output/lovetest_runAllTests.md
|
||||
macOS:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
@@ -243,12 +245,12 @@ jobs:
|
||||
path: love-macos.zip
|
||||
- name: Run All Tests
|
||||
run: love-macos/love.app/Contents/MacOS/love testing --runAllTests
|
||||
- name: Test Report
|
||||
uses: dorny/test-reporter@v1
|
||||
- name: Love Test Report
|
||||
uses: ellraiser/love-test-report@main
|
||||
with:
|
||||
name: Test Output
|
||||
path: testing/output/*.xml
|
||||
reporter: jest-junit
|
||||
name: Love Testsuite MacOS
|
||||
title: macos-test-report
|
||||
path: testing/output/lovetest_runAllTests.md
|
||||
iOS-Simulator:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
|
||||
@@ -71,3 +71,4 @@ stamp-h1
|
||||
.vscode/
|
||||
/testing/output/*.xml
|
||||
/testing/output/*.html
|
||||
/testing/output/*.md
|
||||
|
||||
@@ -303,18 +303,20 @@ TestMethod = {
|
||||
-- get failure/skip message for output (if any)
|
||||
local failure = ''
|
||||
local output = ''
|
||||
-- @NOTE if you don't put anything inside of the <failure></failure> then
|
||||
-- dorny/test-reporter@v1 will fail to parse it
|
||||
if self.passed == false and self.skipped == false then
|
||||
failure = '\t\t\t<failure message="' .. self.result.key .. ' ' ..
|
||||
self.result.message .. '">' .. self.result.key .. ' ' .. self.result.message .. '</failure>\n'
|
||||
output = self.result.key .. ' ' .. self.result.message
|
||||
-- append failures if any to report md
|
||||
love.test.mdfailures = love.test.mdfailures .. '> 🔴 ' .. self.method .. ' \n' ..
|
||||
'> ' .. output .. ' \n\n'
|
||||
end
|
||||
if output == '' and self.skipped == true then
|
||||
failure = '\t\t\t<skipped message="' .. self.skipreason .. '" />\n'
|
||||
output = self.skipreason
|
||||
end
|
||||
|
||||
|
||||
-- append XML for the test class result
|
||||
self.testmodule.xml = self.testmodule.xml .. '\t\t<testcase classname="' ..
|
||||
self.method .. '" name="' .. self.method .. '" assertions="' .. tostring(#self.asserts) ..
|
||||
|
||||
@@ -84,6 +84,15 @@ TestModule = {
|
||||
-- @return {nil}
|
||||
printResult = function(self)
|
||||
local finaltime = UtilTimeFormat(self.time)
|
||||
local status = '🔴'
|
||||
if self.failed == 0 then status = '🟢' end
|
||||
-- add md row to main output
|
||||
love.test.mdrows = love.test.mdrows .. '| ' .. status ..
|
||||
' love.' .. self.module ..
|
||||
' | ' .. tostring(self.passed) ..
|
||||
' | ' .. tostring(self.failed) ..
|
||||
' | ' .. tostring(self.skipped) ..
|
||||
' | ' .. finaltime .. 's |' .. '\n'
|
||||
-- add xml to main output
|
||||
love.test.xml = love.test.xml .. '\t<testsuite name="love.' .. self.module ..
|
||||
'" tests="' .. tostring(self.passed) ..
|
||||
@@ -91,8 +100,6 @@ TestModule = {
|
||||
'" skipped="' .. tostring(self.skipped) ..
|
||||
'" time="' .. finaltime .. '">\n' .. self.xml .. '\t</testsuite>\n'
|
||||
-- add html to main output
|
||||
local status = '🔴'
|
||||
if self.failed == 0 then status = '🟢' end
|
||||
love.test.html = love.test.html .. '<h2>' .. status .. ' love.' .. self.module .. '</h2><ul class="summary">' ..
|
||||
'<li>🟢 ' .. tostring(self.passed) .. ' Tests</li>' ..
|
||||
'<li>🔴 ' .. tostring(self.failed) .. ' Failures</li>' ..
|
||||
|
||||
@@ -17,6 +17,8 @@ TestSuite = {
|
||||
time = 0,
|
||||
xml = '',
|
||||
html = '',
|
||||
mdrows = '',
|
||||
mdfailures = '',
|
||||
fakequit = false,
|
||||
windowmode = true,
|
||||
|
||||
@@ -124,10 +126,23 @@ TestSuite = {
|
||||
|
||||
-- @method - TestSuite:printResult()
|
||||
-- @desc - prints the result of the whole test suite as well as writes
|
||||
-- the XML + HTML of the testsuite output
|
||||
-- the MD, XML + HTML of the testsuite output
|
||||
-- @return {nil}
|
||||
printResult = function(self)
|
||||
local finaltime = UtilTimeFormat(self.time)
|
||||
|
||||
local md = '<!-- PASSED ' .. tostring(self.totals[1]) ..
|
||||
' || FAILED ' .. tostring(self.totals[2]) ..
|
||||
' || SKIPPED ' .. tostring(self.totals[3]) ..
|
||||
' || TIME ' .. finaltime .. ' -->\n\n' ..
|
||||
'**' .. tostring(self.totals[1] + self.totals[2] + self.totals[3]) .. '** tests were completed in **' ..
|
||||
finaltime .. 's** with **' ..
|
||||
tostring(self.totals[1]) .. '** passed, **' ..
|
||||
tostring(self.totals[2]) .. '** failed, and **' ..
|
||||
tostring(self.totals[3]) .. '** skipped\n\n### Report\n' ..
|
||||
'| Module | Passed | Failed | Skipped | Time |\n' ..
|
||||
'| --------------------- | ------ | ------ | ------- | ------ |\n' ..
|
||||
self.mdrows .. '\n\n### Failures\n' .. self.mdfailures
|
||||
|
||||
local xml = '<testsuites name="love.test" tests="' .. tostring(self.totals[1]) ..
|
||||
'" failures="' .. tostring(self.totals[2]) ..
|
||||
@@ -147,6 +162,7 @@ TestSuite = {
|
||||
love.filesystem.mountFullPath(love.filesystem.getSource() .. "/output", "tempoutput", "readwrite")
|
||||
love.filesystem.write('tempoutput/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>')
|
||||
love.filesystem.write('tempoutput/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
|
||||
love.filesystem.write('tempoutput/' .. self.output .. '.md', md)
|
||||
|
||||
self.module:log('grey', '\nFINISHED - ' .. finaltime .. 's\n')
|
||||
local failedcol = '\27[31m'
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Testing Output
|
||||
Any tests run will output an XML and HTML file here, assuming the tests are run with readwrite permissions for this repo
|
||||
Any tests run will output an XML, MD, and HTML file here, assuming the tests are run with readwrite permissions for this repo
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
`/Applications/love_12.app/Contents/MacOS/love ./testing`
|
||||
|
||||
## Todo
|
||||
- fix XML format
|
||||
- check test runs for windows setup
|
||||
- add runs for linux + ios
|
||||
- add runs for linux + ios?
|
||||
- finish graphics state methods
|
||||
- start graphics drawing methods
|
||||
- start object methods
|
||||
|
||||
Reference in New Issue
Block a user