2 - Copyright (c) 2017 Vojtech Horky
5 - Redistribution and use in source and binary forms, with or without
6 - modification, are permitted provided that the following conditions
9 - - Redistributions of source code must retain the above copyright
10 - notice, this list of conditions and the following disclaimer.
11 - - Redistributions in binary form must reproduce the above copyright
12 - notice, this list of conditions and the following disclaimer in the
13 - documentation and/or other materials provided with the distribution.
14 - - The name of the author may not be used to endorse or promote products
15 - derived from this software without specific prior written permission.
17 - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 <xsl:stylesheet version=
"1.0"
29 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
30 xmlns=
"http://www.w3.org/1999/xhtml">
32 <xsl:output method=
"html" indent=
"yes" />
34 <xsl:param name=
"CONFIG_RESOURCE_DIR" select=
"''" />
35 <xsl:param name=
"CONFIG_RSS_PATH" select=
"''" />
37 <xsl:template name=
"HTML_PAGE">
38 <xsl:param name=
"TITLE" />
39 <xsl:param name=
"EXTRA_HEAD" select=
"''" />
40 <xsl:param name=
"BODY" />
43 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
44 <title><xsl:value-of select=
"$TITLE" /></title>
45 <script type=
"text/javascript" src=
"{$CONFIG_RESOURCE_DIR}jquery-2.1.4.min.js"></script>
46 <link rel=
"stylesheet" href=
"{$CONFIG_RESOURCE_DIR}main.css" type=
"text/css" />
47 <xsl:if test=
"$CONFIG_RSS_PATH != ''">
48 <link rel=
"alternate" href=
"{$CONFIG_RSS_PATH}" type=
"application/rss+xml" title=
"Last builds" />
50 <xsl:copy-of select=
"$EXTRA_HEAD" />
53 <xsl:copy-of select=
"$BODY" />
59 <xsl:template match=
"build" mode=
"html-summary-table">
60 <table class=
"summary">
63 <th width=
"*">Task
</th>
64 <th style=
"width:8em">Success
</th>
65 <th width=
"width:40em">Details (total = ok + failed + skipped)
</th>
69 <xsl:call-template name=
"html-summary-table-row">
70 <xsl:with-param name=
"task" select=
"'checkout'" />
71 <xsl:with-param name=
"title" select=
"'Repository checkouts'" />
73 <xsl:call-template name=
"html-summary-table-row">
74 <xsl:with-param name=
"task" select=
"'helenos-build'" />
75 <xsl:with-param name=
"title" select=
"'HelenOS builds'" />
77 <xsl:call-template name=
"html-summary-table-row">
78 <xsl:with-param name=
"task" select=
"'harbour-fetch'" />
79 <xsl:with-param name=
"title" select=
"'Tarball fetches for Coastline'" />
81 <xsl:call-template name=
"html-summary-table-row">
82 <xsl:with-param name=
"task" select=
"'harbour-build'" />
83 <xsl:with-param name=
"title" select=
"'Coastline builds'" />
85 <xsl:call-template name=
"html-summary-table-row">
86 <xsl:with-param name=
"task" select=
"'test'" />
87 <xsl:with-param name=
"title" select=
"'Testing scenarios'" />
94 <xsl:template name=
"html-summary-table-row">
95 <xsl:param name=
"task" />
96 <xsl:param name=
"title" />
97 <xsl:variable name=
"taskOk" select=
"count(*[name()=$task and @result='ok'])" />
98 <xsl:variable name=
"taskFail" select=
"count(*[name()=$task and @result='fail'])" />
99 <xsl:variable name=
"taskSkip" select=
"count(*[name()=$task and @result='skip'])" />
100 <xsl:variable name=
"taskAll" select=
"count(*[name()=$task])" />
101 <xsl:variable name=
"percents">
103 <xsl:when test=
"$taskAll = 0">
104 <xsl:text>-
</xsl:text>
107 <xsl:value-of select=
"round(100 * $taskOk div $taskAll)" /><xsl:text> %
</xsl:text>
111 <xsl:variable name=
"trClass">
113 <xsl:when test=
"$taskAll = 0">
114 <xsl:text>results-none
</xsl:text>
117 <xsl:text>results-
</xsl:text>
118 <xsl:value-of select=
"10 * floor(10 * $taskOk div $taskAll)" />
123 <xsl:attribute name=
"class">
124 <xsl:value-of select=
"$trClass" />
127 <xsl:value-of select=
"$title" />
130 <xsl:value-of select=
"$percents" />
133 <xsl:value-of select=
"$taskAll" />
134 <xsl:text> =
</xsl:text>
135 <xsl:value-of select=
"$taskOk" />
136 <xsl:text> +
</xsl:text>
137 <xsl:value-of select=
"$taskFail" />
138 <xsl:text> +
</xsl:text>
139 <xsl:value-of select=
"$taskSkip" />