Merge pull request #11321 from magefree/travis-improved-logs

dev: improved test logs
This commit is contained in:
Oleg Agafonov 2023-10-18 13:34:18 +04:00 committed by GitHub
commit 5e60e1311f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 4 deletions

View file

@ -7,6 +7,8 @@ git:
submodules: false
before_install:
- echo "MAVEN_OPTS='-Xmx2g'" > ~/.mavenrc
script:
- mvn test -B -Dlog4j.configuration=file:${TRAVIS_BUILD_DIR}/.travis/log4j.properties
cache:
directories:
- $HOME/.m2

14
.travis/log4j.properties Normal file
View file

@ -0,0 +1,14 @@
# logs settings for github/travis ci builds, used by travis.yml
# 1. Only console logs
log4j.rootLogger=info, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %d{yyyy-MM-dd HH:mm:ss,SSS} %-90m =>[%t] %C{1}.%M %n
log4j.appender.console.Threshold=info
# 2. Hide db/sql logs
log4j.logger.com.j256.ormlite=warn
# 3. Hide AI decision logs ("info" to enable and "warn" to disable)
log4j.logger.mage.player.ai=warn

65
pom.xml
View file

@ -90,15 +90,69 @@
</configuration>
</plugin>
<plugin>
<!-- test runner for maven, travis-ci (IDE uses own test runner) -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<!--
for compatible with jacoco code coverage - argLine moved to properties section
<version>3.1.2</version>
<dependencies>
<!-- tree reporter deps -->
<dependency>
<groupId>me.fabriciorby</groupId>
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<configuration>
<!-- ******************** -->
<!-- default plain report -->
<!-- ******************** -->
<!--
printSummary: print elapsed time and other stats per test file
- if you disable this, you will not be able to trace the name of the test
from where the logs are printed
- failed tests will be shown anyway
-->
<printSummary>true</printSummary>
<!--
reportFormat: summary format
- brief: print total elapsed time only
- plain: print brief + elapsed time for each test name
-->
<reportFormat>brief</reportFormat>
<!--
useFile: enable txt and xml reports in .\target\surefire-reports
- useless, so disable it for more performance
-->
<useFile>false</useFile>
<!-- **************** -->
<!-- tree view report -->
<!-- **************** -->
<!-- for full logs: use xmage.build.tests.treeViewRunnerShowAllLogs -->
<!-- for ai logs in ci build: use .travis/log4j.properties -->
<!-- for default maven logs: delete or comment all settings below -->
<consoleOutputReporter>
<disable>true</disable>
</consoleOutputReporter>
<statelessTestsetInfoReporter
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
<theme>ASCII</theme>
<printStacktraceOnError>true</printStacktraceOnError>
<printStacktraceOnFailure>true</printStacktraceOnFailure>
<printStdoutOnError>true</printStdoutOnError>
<printStdoutOnFailure>true</printStdoutOnFailure>
<printStdoutOnSuccess>${xmage.build.tests.treeViewRunnerShowAllLogs}</printStdoutOnSuccess>
<printStderrOnError>true</printStderrOnError>
<printStderrOnFailure>true</printStderrOnFailure>
<printStderrOnSuccess>${xmage.build.tests.treeViewRunnerShowAllLogs}</printStderrOnSuccess>
</statelessTestsetInfoReporter>
<!-- for compatible with jacoco code coverage - argLine moved to properties section
<argLine>-Dfile.encoding=UTF-8</argLine>
-->
</configuration>
-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -191,6 +245,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
<!-- logs settings for maven tests and travis ci builds -->
<xmage.build.tests.treeViewRunnerShowAllLogs>false</xmage.build.tests.treeViewRunnerShowAllLogs>
<!--
JaCoCo code coverage disabled by default. If you need to generate
execute stats and reports then run tests by maven command