mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-03-02 03:40:21 +00:00
add example email notification scripts
This commit is contained in:
21
examples/format-test-results
Executable file
21
examples/format-test-results
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat <<EOF
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Laminar</title>
|
||||
<link href="/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="col-xs-12">
|
||||
<h2>Test report for $lJobName #$lBuildNum</h2>
|
||||
EOF
|
||||
xsltproc "$(dirname ${BASH_SOURCE[0]})/testreport.xsl" "$1";
|
||||
cat <<EOF
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
42
examples/junit-bs-style.xsl
Normal file
42
examples/junit-bs-style.xsl
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" indent="no"/>
|
||||
<xsl:template match="testsuite">
|
||||
<h3>Test Suite: <xsl:value-of select="@name" /></h3>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Tests run:</dt><dd><xsl:value-of select="@tests" /></dd>
|
||||
<dt>Failures:</dt><dd><xsl:value-of select="@failures" /></dd>
|
||||
<dt>Errors:</dt><dd><xsl:value-of select="@errors" /></dd>
|
||||
<dt>Elapsed time:</dt><dd><xsl:value-of select="@time" /></dd>
|
||||
</dl>
|
||||
<ul class="list-group">
|
||||
<xsl:apply-templates select="testcase" />
|
||||
</ul>
|
||||
<xsl:apply-templates select="system-out" />
|
||||
<xsl:apply-templates select="system-err" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="testcase">
|
||||
<xsl:choose>
|
||||
<xsl:when test="*">
|
||||
<li class="list-group-item list-group-item-danger"><xsl:value-of select="@name" />
|
||||
<xsl:apply-templates select="failure" />
|
||||
</li>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<li class="list-group-item list-group-item-success"><xsl:value-of select="@name" /></li>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="failure">
|
||||
<pre>
|
||||
<xsl:value-of select="@message"/>
|
||||
</pre>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="system-out"><h5>Standard output:</h5><pre><xsl:value-of select="." /></pre></xsl:template>
|
||||
<xsl:template match="system-err"><h5>Standard error:</h5><pre><xsl:value-of select="." /></pre></xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
55
examples/notify-email-pretty.sh
Executable file
55
examples/notify-email-pretty.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# IMPORTANT: change these to appropriate values, or fetch them, for example
|
||||
# from the environment or from $(git show -s --format='%ae' $rev)
|
||||
TO_EMAIL=engineering@example.com
|
||||
FROM_EMAIL=laminar@example.com
|
||||
|
||||
LAMINAR_URL=${LAMINAR_BASE_URL:-http://localhost:8080}
|
||||
LAMINAR_TITLE=${LAMINAR_TITLE:-Laminar CI}
|
||||
|
||||
if [[ $RESULT = "success" ]]; then
|
||||
SVGICON=$(cat <<-EOF
|
||||
<svg viewBox="0 0 100 100" width="24px">
|
||||
<path fill="#74af77" d="m 23,46 c -6,0 -17,3 -17,11 0,8 9,30 12,32 3,2 14,5 20,-2 6,-6 24,-36
|
||||
56,-71 5,-3 -9,-8 -23,-2 -13,6 -33,42 -41,47 -6,-3 -5,-12 -8,-15 z" />
|
||||
</svg>
|
||||
EOF
|
||||
)
|
||||
else
|
||||
SVGICON=$(cat <<-EOF
|
||||
<svg viewBox="0 0 100 100" width="24px">
|
||||
<path fill="#883d3d" d="m 19,20 c 2,8 12,29 15,32 -5,5 -18,21 -21,26 2,3 8,15 11,18 4,-6 17,-21
|
||||
21,-26 5,5 11,15 15,20 8,-2 15,-9 20,-15 -3,-3 -17,-18 -20,-24 3,-5 23,-26 30,-33 -3,-5 -8,-9
|
||||
-12,-12 -6,5 -26,26 -29,30 -6,-8 -11,-15 -15,-23 -3,0 -12,5 -15,7 z" />
|
||||
</svg>
|
||||
EOF
|
||||
)
|
||||
fi
|
||||
|
||||
sendmail -t <<EOF
|
||||
From: $FROM_EMAIL
|
||||
To: $TO_EMAIL
|
||||
Subject: $JOB #$RUN: $RESULT
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/html; charset=utf-8
|
||||
|
||||
<html lang="en">
|
||||
<body bgcolor="#efefef" style="margin: 0; font-family: Helvetica Neue, Helvetica, Arial, sans-serif">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr><td align="center">
|
||||
<table border="0" cellspacing="0" cellpadding="15" bgcolor="#ffffff">
|
||||
<tr bgcolor="#2f3340">
|
||||
<td style="font-size: 28px; color: #ffffff;">$LAMINAR_TITLE</td></tr>
|
||||
<tr>
|
||||
<td style="font-size: 26px">
|
||||
$SVGICON
|
||||
<a href="$LAMINAR_URL/jobs/$JOB/$RUN">$JOB #$RUN</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
18
examples/notify-email-text-log.sh
Executable file
18
examples/notify-email-text-log.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# IMPORTANT: change these to appropriate values, or fetch them, for example
|
||||
# from the environment or from $(git show -s --format='%ae' $rev)
|
||||
TO_EMAIL=engineering@example.com
|
||||
FROM_EMAIL=laminar@example.com
|
||||
|
||||
LAMINAR_URL=${LAMINAR_BASE_URL:-http://localhost:8080}
|
||||
|
||||
sendmail -t <<EOF
|
||||
From: $FROM_EMAIL
|
||||
To: $TO_EMAIL
|
||||
Subject: $JOB #$RUN: $RESULT
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
$(curl -s $LAMINAR_URL/log/$JOB/$RUN)
|
||||
EOF
|
||||
Reference in New Issue
Block a user