From 832794b92563970a9a4fb5657edd06fedb78ee9b Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Tue, 15 Aug 2023 16:02:54 -0500
Subject: [PATCH] fix: write a pdf summary report as artifact

---
 .gitlab-ci.yml              |  7 +++++++
 templates/report_footer.tex |  1 +
 templates/report_header.tex | 17 +++++++++++++++++
 3 files changed, 25 insertions(+)
 create mode 100644 templates/report_footer.tex
 create mode 100644 templates/report_header.tex

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 69f0224b..1f68a386 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -124,6 +124,13 @@ summary:
     - "backgrounds:results"
   script:
     - collect_benchmarks.py
+    - |
+      cat templates/report_header.tex > report.tex ;
+      find results -name "*.png" -exec echo "\result{{}}" \; >> report.tex ;
+      cat templates/report_footer.tex >> report.tex ;
+      pdflatex report.tex ;
+      pdflatex report.tex ;
+      mv report.pdf results
   artifacts:
     paths:
       - results/*
diff --git a/templates/report_footer.tex b/templates/report_footer.tex
new file mode 100644
index 00000000..6b47932f
--- /dev/null
+++ b/templates/report_footer.tex
@@ -0,0 +1 @@
+\end{document}
diff --git a/templates/report_header.tex b/templates/report_header.tex
new file mode 100644
index 00000000..23c8bcc5
--- /dev/null
+++ b/templates/report_header.tex
@@ -0,0 +1,17 @@
+\documentclass[11pt]{book}
+
+\usepackage[margin=0.5in]{geometry}
+\usepackage{graphicx}
+
+\title{Physics Benchmarks}
+\author{EICweb}
+\date{\today}
+
+\newcommand{\result}[1] {
+  \includegraphics[width=0.8\textwidth]{#1}
+  \\
+}
+
+\begin{document}
+\maketitle
+\tableofcontents
-- 
GitLab