GitLab CI/CD for LaTex repository

If you have ever used LaTeX you know how powerfull it can be !
If you have never use it maybe this is not for you…

The real beauty of LaTex is its text source files, it is a complete different mindset to that of most commons text editor that relies on binary file formats. This means we can keep track of the code addition and deletion with a code versioning tool. Git is THE versionning tool that software engineer use to colaborate and keep track of their source files. And nowadays it is even possible to automate the compilation of new software revision with Git continuous integrations (CI) tools.

Should we do that for our LaTeX files ? Why bother ?

  • It allows to do the versionning on the source only, not on the .pdf output
  • It keeps the latest .pdf files available online without having to recompile
  • It makes everyone’s work available as .pdf online without the need for local compiling
  • It forces all members of the repo to use up-to-date classes and styles
  • It is neat and organised

In order for all of this to work we need to adopt a file architecture that allows the repository to act as a library of source files. Thus creating a library of output .pdf files (called artifacts) online. But only the source files will be tracked.

So this is how the file structure could look like:

commons
   |-- tex
   |   |-- latex
   |   |   |-- benou
   |   |   |   |-- benou-invoice.sty
   |   |   |   |-- benou-letter.sty
   |   |   |   |-- benou-offer.sty
   |   |   |   |-- benou-simple.sty
   |   |   |   |-- benou.cls
src
   |-- BENOU-220001DOC_opensrc_pcb_prj
   |   |-- BENOU-220001DOC_opensrc_pcb_prj.tex
   |   |-- img
   |   |   |-- install
   |   |   |   |-- clone_project.PNG
   |   |   |   |-- home_new-project.PNG
   |   |   |   |-- new_project.PNG
   |   |   |   |-- plugins_dir.PNG
   |   |   |   |-- website.PNG
   |   |   |-- order
   |   |   |   |-- gerber_output.PNG
   |   |   |   |-- order_review_process.PNG
   |   |   |   |-- pcbway_quotation.png
   |   |   |   |-- upload_gerber_pcbway.PNG
   |   |   |-- pcb
   |   |   |   |-- gnd_pour_top.PNG
   |   |   |   |-- ouline_def.PNG
   |   |   |   |-- pref_for_routing.PNG
   |   |   |   |-- route_done_3d.PNG
   |   |   |   |-- update_pcb_from_sch.PNG
   |   |   |-- schematic
   |   |   |   |-- 32U4PinMapping.png
   |   |   |   |-- add_net_label.PNG
   |   |   |   |-- annotate_schematic.PNG
   |   |   |   |-- symbol_properties.PNG
   |   |   |   |-- title_block.PNG
   |-- template
   |   |-- DOC_template.tex
   |   |-- DS_template.tex
   |   |-- INV_template_item.tex
   |   |-- INV_template_proj.tex
   |   |-- LTR_template.tex
   |   |-- OFR_template.tex