Skip to content

Commit 1d57aea

Browse files
Add initial implementation
1 parent 1caa17b commit 1d57aea

File tree

6 files changed

+148
-2
lines changed

6 files changed

+148
-2
lines changed

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: test
2+
on: [push]
3+
jobs:
4+
test-example:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: ./ # For real world usage this should be replaced by "antaljanosbenjamin/compile-latex@master"
9+
with:
10+
file: test.tex
11+
args: -pdf
12+
- run: '(test -f test.pdf && echo PDF exists) || (echo PDF does not exist && exit 1)'
13+
test-file-in-subdirectory:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: ./ # For real world usage this should be replaced by "antaljanosbenjamin/compile-latex@master"
18+
with:
19+
file: tests/subdir_test.tex
20+
- run: '(test -f subdir_test.dvi && echo DVI exists) || (echo DVI does not exist && exit 1)'
21+
test-output-directory:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- uses: ./ # For real world usage this should be replaced by "antaljanosbenjamin/compile-latex@master"
26+
with:
27+
file: test.tex
28+
output-directory: tests/output
29+
- run: '(test -f tests/output/test.dvi && echo DVI exists) || (echo DVI does not exist && exit 1)'
30+
test-args:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: ./ # For real world usage this should be replaced by "antaljanosbenjamin/compile-latex@master"
35+
with:
36+
file: test.tex
37+
args: -help
38+
test-full:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: ./ # For real world usage this should be replaced by "antaljanosbenjamin/compile-latex@master"
43+
with:
44+
file: tests/subdir_test.tex
45+
output-directory: tests/outputpdf
46+
args: -pdf
47+
- run: '(test -f tests/outputpdf/subdir_test.pdf && echo PDF exists) || (echo PDF does not exist && exit 1)'

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# compile-latex
2-
GitHub action to compile LaTeX documents.
1+
# Compile latex action
2+
This action can be used to compile latex documents with `latexmk`. The action uses an ubuntu based [docker image](https://github.com/antaljanosbenjamin/latex-extra-docker).
3+
4+
It calls `latexmk` in the working directory on a single tex file.
5+
## Inputs
6+
7+
### `file` (required)
8+
The LaTeX file to be compiled.
9+
10+
### `output-directory`
11+
The directory for output files, relative to the root of the repository. Defaulted to `.`.
12+
### `args`
13+
Additional arguments to pass over to `latexmk`.
14+
15+
## Example usage
16+
17+
18+
```
19+
name: test
20+
on: [push]
21+
jobs:
22+
test-example:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: antaljanosbenjamin/compile-latex@master
27+
with:
28+
file: test.tex
29+
args: -pdf
30+
- run: '(test -f test.pdf && echo PDF exists) || (echo PDF does not exist && exit 1)'
31+
```
32+
33+
For further examples check the [test workflow](.github/workflows/test.yml).

action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Compile LaTeX'
2+
description: 'Calls latexmk to compile a LaTeX document'
3+
author: antaljanosbenjamin
4+
branding:
5+
icon: file-text
6+
color: orange
7+
inputs:
8+
file:
9+
description: 'The LaTeX file to be compiled, relative to the root of the repository.'
10+
required: true
11+
output-directory:
12+
description: 'The directory for output files, relative to the root of the repository.'
13+
required: false
14+
default: .
15+
args:
16+
description: 'Additional arguments to pass over to latexmk.'
17+
required: false
18+
runs:
19+
using: docker
20+
image: docker://antaljanosbenjamin/latex-extra:latest
21+
entrypoint: latexmk
22+
args:
23+
- '-output-directory="/github/workspace/${{ inputs.working-directory }}"'
24+
- ${{ inputs.args }}
25+
- /github/workspace/${{ inputs.file }}

test.tex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
% from https://en.wikibooks.org/wiki/LaTeX/Bibliographies_with_biblatex_and_biber
2+
\documentclass{article}
3+
4+
\begin{document}
5+
6+
Test document as
7+
8+
\end{document}

tests/lauraPhd2016.bib

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@article{wombat2016,
2+
author = {Walther Wombat and Klaus Koala},
3+
title = {The true meaning of 42},
4+
journal = {Journal of modern skepticism},
5+
date = {2016},
6+
keywords = {trusted}
7+
}
8+
@book{lion2010,
9+
author = {Laura Lion and Gabrielle Giraffe and Carl Capybara},
10+
title = {The dangers of asking the wrong question},
11+
publisher = {publishing house},
12+
date = {2010},
13+
keywords = {trusted}
14+
}
15+
@online{wikibook,
16+
title = {Generating Bibliographies with biblatex and biber},
17+
organization = {Wikibooks},
18+
date = {2016},
19+
urldate = {2016-03-07},
20+
url = {https://en.wikibooks.org/wiki/LaTeX/Generating_Bibliographies_with_biblatex_and_biber},
21+
keywords = {untrusted}
22+
}

tests/subdir_test.tex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
% from https://en.wikibooks.org/wiki/LaTeX/Bibliographies_with_biblatex_and_biber
2+
\documentclass{article}
3+
\usepackage[backend=biber]{biblatex}
4+
\addbibresource{lauraPhd2016.bib}
5+
\begin{document}
6+
I doubt that there is any useful information here~\cite{wikibook}.
7+
8+
All we know is limited, apart from knowing the answer we all know. Or do we? Wombat and Koala have discovered some interesting things~\cite{wombat2016}.
9+
10+
Some people are too nosy. What can happen to them is described by Laura Lion~\cite[9]{lion2010}.
11+
12+
\printbibliography
13+
\end{document}

0 commit comments

Comments
 (0)