1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

CI: Publish HTML report of tests as an artifact

This also lets ant print a message pointing to this artifact and
explaining the files inside briefly. To make sure this is only printed
inside the github action, an extra `-D` option is passed to `ant test`
from the workflow file.

To allow `if` / `unless` on the echo element, this adds some namespace
definitions (this allows them on *any* element, not just the ones that
explicitly allow it). See https://ant.apache.org/manual/ifunless.html
This commit is contained in:
Matthijs Kooijman 2020-05-07 23:17:51 +02:00 committed by Cristian Maglie
parent a665a3b9b4
commit bdfa7f305c
3 changed files with 15 additions and 5 deletions

View File

@ -24,6 +24,11 @@ jobs:
run: sudo apt-get install -y xvfb
- name: Run tests
working-directory: ./app
run: xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" ant test
run: xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" ant test -Drunning-from-github-action=1
- name: Publish results
uses: actions/upload-artifact@v1
with:
name: html-results
path: app/test-bin/results/html/
- name: Cleanup xvfb
uses: bcomnes/cleanup-xvfb@v1

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<project name="Arduino PDE" default="build">
<project name="Arduino PDE" xmlns:if="ant:if" xmlns:unless="ant:unless" default="build">
<path id="class.path">
<fileset dir="lib">
@ -160,14 +160,18 @@
<fileset dir="${test.reportdir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.htmldir}" />
<!-- Create a browsable frame-based HTML -->
<report format="frames" todir="${test.htmldir}" />
<!-- Also create a single-page version, to use as CI test result -->
<report format="noframes" todir="${test.htmldir}" />
</junitreport>
<!-- Make these paths relative to user.dir, which is the current directory when invoking ant (so the resulting paths are relative to the environment of the user. -->
<property name="test.htmldir.display" location="${test.htmldir}" relative="true" basedir="${user.dir}"/>
<property name="test.reportdir.display" location="${test.reportdir}" relative="true" basedir="${user.dir}"/>
<echo message="Detailed test results can be found in ${test.reportdir.display}"/>
<echo message="A browsable HTML summary is generated in ${test.htmldir.display}/index.html"/>
<echo unless:set="running-from-github-action" message="Detailed test results can be found in ${test.reportdir.display}"/>
<echo unless:set="running-from-github-action" message="A browsable HTML summary is generated in ${test.htmldir.display}/index.html"/>
<echo if:set="running-from-github-action" message="Detailed test results can be downloaded as an asset from this github action. Easiest to view is the single-file version in junit-noframes.html. Alternatively, the multi-file version can be viewed from index.html and includes full stdout/stderr output of tests."/>
<fail if="test.failed"/>
</target>

View File

@ -188,6 +188,7 @@
<!-- Forward these to subant. Use propertyset/propertyref instead of a direct property so we do not need to specify a value -->
<propertyref name="single-test-class"/>
<propertyref name="single-test-methods"/>
<propertyref name="running-from-github-actions"/>
</propertyset>
</subant>
</target>