Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarx committed Nov 1, 2024
1 parent af64077 commit 45add09
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Build Berufungshandbuch"
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
name: "Build the Minimalstandards PDF"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v9
with:
nix-installer-tag: v0.15.1
- uses: DeterminateSystems/magic-nix-cache-action@v3
- env:
BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }}
run: echo "name=BRANCH_NAME::${BRANCH_NAME_OR_REF#refs/heads/}" >> $GITHUB_ENV
- run: echo "name=PR_NUMBER::$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
- run: nix --print-build-logs build .#minimalstandards -o minimalstandards.pdf
- uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: minimalstandards.pdf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/auto/
/result
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
description = "Handbuch zur studentischen Mitwirkung in Berufungskommissionen";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};

outputs =
inputs@{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };

environment = {
TEXMFHOME = ".cache";
TEXMFVAR = ".cache/texmf-var";
SOURCE_DATE_EPOCH = toString self.lastModified;
};

texlive = pkgs.texlive.combine {
inherit (pkgs.texlive)
babel
collection-fontsrecommended
collection-langgerman
colorprofiles
csquotes
draftwatermark
ec
hyperref
latex-bin
latexmk
mathtools
metafont
microtype
pdfmanagement-testphase
pdfx
scheme-basic
silence
textpos
titlesec
todonotes
version
wasysym
xkeyval
xmpincl
xstring
;
};

mkDocument =
name:
pkgs.stdenvNoCC.mkDerivation rec {
inherit name;
src = self;

allowSubstitutes = false;
buildInputs = [
pkgs.coreutils
pkgs.gawk
texlive
];
phases = [
"unpackPhase"
"buildPhase"
"installPhase"
];
buildPhase = ''
runHook preBuild
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
env TEXMFHOME=${environment.TEXMFHOME} \
TEXMFVAR=${environment.TEXMFVAR} \
SOURCE_DATE_EPOCH=${environment.SOURCE_DATE_EPOCH} \
latexmk -interaction=nonstopmode -pdf \
${name}.tex
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp ${name}.pdf $out
runHook postInstall
'';
};

in
{
packages."${system}" = rec {
default = minimalstandards;
minimalstandards = mkDocument "minimalstandards";
};

devShells."${system}".default = pkgs.mkShell {
inherit (environment) TEXMFHOME TEXMFVAR SOURCE_DATE_EPOCH;
buildInputs = [ texlive ];
};
};
}
21 changes: 12 additions & 9 deletions minimalstandards.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
%%%
\documentclass[10pt,twoside,a5paper,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{amsmath} % Mehr mathematische Befehle...
\usepackage{amssymb} % ... und Symbole
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{fancyhdr} % Leck're headers
\usepackage{version}
\usepackage{fullpagegraphic}
\usepackage{latexsym} % symbole!!
\usepackage{amsmath} % Mehr mathematische Befehle...
\usepackage{amssymb} % ... und Symbole
\usepackage[final,pdftex,colorlinks,urlcolor=blue]{hyperref} % setzt Links und Verweise im PDF-Dokument
\usepackage[draft,pdftex,colorlinks,urlcolor=blue]{hyperref} % setzt Links und Verweise im PDF-Dokument
\usepackage{graphicx} % zum Einf"ugen von eps-Bildern etc.
\usepackage{fullpagegraphic}
\usepackage{wasysym}
\usepackage{color,colortbl,titlesec, array}
\usepackage{csquotes}
\usepackage{version}
% Fot Watermark
% \usepackage{draftwatermark}
% \SetWatermarkScale{2}
% \SetWatermarkText{\sf Nach Bremen}
\usepackage{draftwatermark}
\SetWatermarkScale{2}
\SetWatermarkText{\textsf{Nach Magdeburg}}

\setlength{\hoffset}{-.5in}
\setlength{\voffset}{-1in}
Expand All @@ -47,6 +48,8 @@
%\fancyfoot[EC,OC]{\scshape \footnotesize FH Regensburg}
\fancyfoot[OR]{\scshape \footnotesize Minimalstandards}

% reproducible documents
\pdftrailerid{}

\definecolor{grau}{gray}{.6}

Expand Down

0 comments on commit 45add09

Please sign in to comment.