CI for Soviet Russia
authorAlex Dehnert <adehnert@mit.edu>
Sun, 10 Feb 2019 06:52:14 +0000 (01:52 -0500)
committerAlex Dehnert <adehnert@mit.edu>
Sun, 10 Feb 2019 06:52:14 +0000 (01:52 -0500)
.gitlab-ci.yml [new file with mode: 0644]
Makefile [new file with mode: 0644]
index.html [new file with mode: 0644]

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..a049c5a
--- /dev/null
@@ -0,0 +1,35 @@
+stages:
+  - build
+  - publish
+
+image: registry.gitlab.com/adehnert/gametex-deps-docker:latest
+
+build game:
+  stage: build
+  script:
+    - apt-get update && apt-get install -y texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-pstricks python3 make
+    - make install
+    - mkdir artifacts
+    - cp faq.pdf style-guide.pdf artifacts/ && cp tea/rating.pdf artifacts/tea-rating.pdf
+
+  artifacts:
+    paths:
+      - artifacts/
+    expire_in: 1 week
+
+pages:
+  # "pages" job name is special, and triggers creation of GitLab pages:
+  # https://gitlab.com/help/user/project/pages/getting_started_part_four.md
+  stage: publish
+  script:
+    - mkdir -p public
+    - cp artifacts/*.pdf index.html public/
+
+  artifacts:
+    paths:
+      - public
+    expire_in: 1 month
+
+  only:
+    - master
+    - pages-test
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..00059cf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+SOURCES=$(wildcard *.tex) tea/rating.tex
+OUTPUTS=$(SOURCES:.tex=.pdf)
+
+all : $(OUTPUTS)
+
+clean :
+       rm $(OUTPUTS) *.aux *.log tea/*.aux tea/*.log
+
+%.pdf : %.tex
+       cd $(@D) && pdflatex -halt-on-error $(<F) && pdflatex -halt-on-error $(<F)
+
+install : $(OUTPUTS)
+       mkdir -p artifacts/
+       cp $(filter-out tea/rating.pdf,$^) artifacts/
+       cp tea/rating.pdf artifacts/tea-rating.pdf
+
+# Delete PDF's when they fail to compile
+# See https://www.gnu.org/software/make/manual/html_node/Errors.html#Errors
+.DELETE_ON_ERROR:
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..80f4a8f
--- /dev/null
@@ -0,0 +1,13 @@
+<html>
+    <head>
+        <title>Soviet Russia</title>
+    </head>
+    <body>
+        <h1>Soviet Russia</h1>
+        <ul>
+            <li><a href='faq.pdf'>FAQ</a></li>
+            <li><a href='style-guide.pdf'>Style guide</a></li>
+            <li><a href='tea-rating.pdf'>Tea ratings form</a></li>
+        </ul>
+    </body>
+</html>