From a439b45d2c924843317a99dab8be810d63096297 Mon Sep 17 00:00:00 2001 From: Philippe Zwietering Date: Mon, 22 Apr 2024 16:53:16 +0200 Subject: [PATCH] First try with Jenkinsfile, hope for the best --- Jenkinsfile | 18 ++++++++++++++++++ scripts/build.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Jenkinsfile create mode 100644 scripts/build.sh diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..bd372d7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,18 @@ +pipeline { + agent linux { + stages { + stage('Build') { + steps { + echo 'Starting build step...' + sh './scripts/build.sh' + } + } + + // Testing latex isn't really a thing, but we could do basic sanity checks in the future? + + stage('Deploy') { + echo 'Starting deploy step...' + } + } + } +} \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..aca7924 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Check if necessary packages are installed +necessary_packages=("pdflatex") + +for package in ${necessary_packages}; do + if ! [dpkg -l ${package} > /dev/null]; then + echo "Error: ${package} is not installed." + exit 1 + fi +done + +# Build all directories +subdirectory_file_name=main + +for D in *; do + if [ -d "${D}" ]; then + echo "Building ${D}..." + cd ${D} + pdflatex -interaction=nonstopmode -halt-on-error ${subdirectory_file_name}.tex + cd .. + fi +done + +# Build main PDF +main_file_name=main_text + +echo "Building main PDF..." +pdflatex -interaction=nonstopmode -halt-on-error ${main_file_name}.tex + +# Clean up +rm -rf *.aux *.log *.out *.toc \ No newline at end of file