LaTeX + Drone CI + Minio + CMake

drone docker image

I like LaTeX for content structure separated from style.

Let’s go, Right now, we’re doing inside how I build this CI/CD.

Which and why

latex-builder

What is it?

It’s my Docker image sycured/latex-builder / Buildah script based on archlinux which include all I need to build my LaTeX documents.

I include my pdfcompressor to compress PDF files.

Drone CI

Drone CI is the easiest and powerful CI/CD that I tested and it’s written in Go. In addition, Drone CLI permits you to run your .drone.yml on your computer using Docker without necessitating to push to the repository (command: drone exec).

droneci config

In this .drone.yml, I use a temporary volume (results).

MinIO

It’s good to save artifacts from CI/CD, I use MinIO (S3 compatible).

I created a dedicated bucket and inside I put artifacts from CI/CD inside the right folder.

For my CV, the folder cv is read-only for anonymous access; it’s perfect to always share the latest version.

CMake

My ultimate weapon about compiling LaTeX documents, I use one CMake module: UseLATEX.

You need to write a CMakeLists.txt like:

cmake_minimum_required(VERSION 2.8.4)

project(cv NONE)
include(UseLATEX)

file(GLOB_RECURSE english_files RELATIVE ${CMAKE_SOURCE_DIR} english/*.tex)
file(GLOB_RECURSE english-new_files RELATIVE ${CMAKE_SOURCE_DIR} english-new/*.tex)

add_latex_document(
    english.tex
    INPUTS ${english_files}
    FORCE_PDF
    )

add_latex_document(
    english-new.tex
    INPUTS ${english-new_files}
    FORCE_PDF
    )

How to use it in CI/CD?

I include a shell script: run.sh

#!/bin/bash
BD="/tmp/build_cv"
CD=`pwd`
rm -rf "$BD" ; mkdir "$BD" && cd "$BD" && cmake -G Ninja "$CD" && ninja && \
pdfcompressor -2 -o cv-en.pdf -i english.pdf && \
pdfcompressor -2 -o cv-en-new.pdf -i english-new.pdf

What’s ninja?

Why using this old make with CMake?

No reason, you can use CMake with steroid: Ninja

Ninja is a small build system with a focus on speed - https://ninja-build.org/

I need performance (rewriting pdfcompressor to optimize speed: roadmap)