Skip to content

Commit

Permalink
Merge pull request #23 from Die-KoMa/add-ci
Browse files Browse the repository at this point in the history
Add CI
  • Loading branch information
mmarx authored Nov 1, 2024
2 parents 56d8fa0 + e1114f0 commit 3a1f25a
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Build Berufungshandbuch"
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
name: "Build the Berufungshandbuch 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 .#bkhandbuch -o bkhandbuch.pdf
3 changes: 3 additions & 0 deletions bkhandbuch.tex
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
%\fancyfoot[EC,OC]{\scshape \footnotesize FH Regensburg}
\fancyfoot[OR]{\scshape \footnotesize Berufungskommissionen}

% reproducible documents
\pdftrailerid{}

%---------------------------------------------------------------
%für Fragebogen
\definecolor{light}{gray}{0.80}
Expand Down
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.

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

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

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
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 = bkhandbuch;
bkhandbuch = mkDocument "bkhandbuch";
};

devShells."${system}".default = pkgs.mkShell {
inherit (environment) TEXMFHOME TEXMFVAR SOURCE_DATE_EPOCH;
buildInputs = [ texlive ];
};
};
}

0 comments on commit 3a1f25a

Please sign in to comment.