Skip to content

Commit ef748f0

Browse files
committed
add Re-Pro badge
1 parent 9cb513d commit ef748f0

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

.github/workflows/reproduce.yml

+18
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ jobs:
3939
run: |
4040
find . -name "${{ env.CODE_FILES }}" -exec sh -c "grep '\- name\:.*' {} | python {}" \;
4141
42+
- name: Obtain commit hash and time
43+
shell: bash
44+
run: |
45+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
46+
echo "build_time=$(date +'%Y-%m-%d at %H:%M:%S UTC')" >> $GITHUB_ENV
47+
48+
- name: Generate Re-Pro badge
49+
run: |
50+
echo "\begin{tikzpicture}" > "re-pro-badge.tex"
51+
echo " \draw[black, line width=3pt] (0.1, 0.95) to (\textwidth, 0.95) (0.1, -0.95) to (0.8\textwidth, -0.95);" >> "re-pro-badge.tex"
52+
echo " \fill[white] (0, 1.1) to (1, 1.1) arc (90:-90:1.1) to (0, -1.1);" >> "re-pro-badge.tex"
53+
echo " \fill[black] (1, 0) circle (1);" >> "re-pro-badge.tex"
54+
echo " \draw[white, line width=1pt] (0.35, 0.55) arc(140:-80:0.45) to (1.1, -0.65) to (0.95, -0.65) (0.45, 0.45) arc(140:-110:0.31) to (0.58, -0.65) (1.35, -0.65) arc(270:20:0.35) to (1.35, -0.35) (1.35, -0.51) arc(270:50:0.21) (1.43, -0.65) rectangle (1.57, -0.51);" >> "re-pro-badge.tex"
55+
echo " \node[anchor=west] at (2.1, 0.45) {This document is provably reproducible.};" >> "re-pro-badge.tex"
56+
echo " \node[anchor=west] at (2.3, -0.1) {\small \texttt{> hosted at \url{${{ github.server_url }}/${{ github.repository }}}}};" >> "re-pro-badge.tex"
57+
echo " \node[anchor=west] at (2.3, -0.5) {\small \texttt{> built on ${{ env.build_time }} from \href{${{ github.server_url }}/${{ github.repository }}/tree/${{ env.sha_short }}}{${{ env.sha_short }}}}};" >> "re-pro-badge.tex"
58+
echo "\end{tikzpicture}" >> "re-pro-badge.tex"
59+
4260
- name: Compile LaTeX document
4361
run: |
4462
pdflatex ${{ env.LATEX_PROJECT }}

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Unless you are using some extraordinary dependencies or features in your project
6464
- Ìf the branch you want to run the reproducibility proof on is not called `main`, you'll need to modify the `branches:` key at the top of the `reproduce.yml` file.
6565
- If your code files or LaTeX project is located in subdirectories, relative imports may not work any longer, hence you'll need to manually specify the working directory by adding `
6666
working-directory: [PATH]` below the commands which run the code.
67+
- Merge if already have other pipelines called `reproduce.yml` [TODO]
6768

6869
## Example
6970

@@ -77,10 +78,19 @@ The `main` branch of this repository (which you are currently viewing) serves as
7778

7879
## The Re-Pro badge
7980

80-
The Re-Pro badge is the seal of reproducibility which can be displayed in a document. It certifies that a document was indeed produced based on the given commit.
81+
The Re-Pro badge is the certificate of reproducibility, which you can display in your document. It certifies that a document was indeed produced based on a given state of a source.
8182

8283
[Image of badge]
8384

85+
The badge is automatically generated. You can display it in your `LaTeX` documents by adding the following lines (if necessary):
86+
87+
```[tex]
88+
\usepackage{tikz}
89+
\usepackage{hyperref}
90+
...
91+
\input{re-pro-badge.tex}
92+
```
93+
8494
## Advanced usage
8595

8696
### Commit and push changes to repository

main.tex

+12-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
% Import pgf plots
44
\usepackage{pgf}
5+
\usepackage{tikz}
6+
\usepackage{hyperref}
57
\def\mathdefault#1{#1}
68

79
\title{Re-Pro example}
@@ -11,12 +13,20 @@
1113

1214
\maketitle
1315

14-
This is a demonstration project which is provably reproducible. \cite{article2021}
16+
This is a demonstration project which is provably reproducible.
17+
It is compatible with BibTeX \cite{article2021}.
18+
The following plot is generated in Python.
1519

1620
\begin{figure}[ht]
1721
\centering
1822
\input{plot.pgf}
19-
\caption{Example plot.}
23+
\caption{This is an example plot.}
24+
\end{figure}
25+
26+
Below you can see the Re-Pro badge generated for this project:
27+
28+
\begin{figure}[ht]
29+
\include{re-pro-badge.tex}
2030
\end{figure}
2131

2232
\bibliographystyle{acm}

plot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ def download_matrix(url, save_path="matrices", save_name=None):
6363
pc = (u.T @ A)
6464

6565
# Visualize principal components
66-
plt.figure(figsize=(3, 3))
66+
plt.figure(figsize=(3, 1.5))
6767
plt.scatter(pc[0], pc[1], color="#2F455C")
6868
plt.savefig("plot.pgf", bbox_inches="tight")

re-pro-badge.tex

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
\begin{tikzpicture}
2+
\draw[black, line width=3pt] (0.1, 0.95) to (\textwidth, 0.95) (0.1, -0.95) to (0.8\textwidth, -0.95);
3+
\fill[white] (0, 1.1) to (1, 1.1) arc (90:-90:1.1) to (0, -1.1);
4+
\fill[black] (1, 0) circle (1);
5+
\draw[white, line width=1pt] (0.35, 0.55) arc(140:-80:0.45) to (1.1, -0.65) to (0.95, -0.65) (0.45, 0.45) arc(140:-110:0.31) to (0.58, -0.65) (1.35, -0.65) arc(270:20:0.35) to (1.35, -0.35) (1.35, -0.51) arc(270:50:0.21) (1.43, -0.65) rectangle (1.57, -0.51);
6+
\node[anchor=west] at (2.3, 0.0) {Re-Pro badge was not generated.};
7+
\end{tikzpicture}

0 commit comments

Comments
 (0)