8

I want to use travis-ci on my project on github, a MWE of which is available here.

I am using the following .travis.yml file, following the steps given in this Minimal CI LaTeX builder site.

before_install:
- sudo apt-get update -qq
- sudo apt-get install texlive-latex-base
script:
- mkdir build
- pdflatex -output-directory build Example.tex
deploy:
  provider: releases
  api_key:
    secure: <mykey>
  file: Example.pdf
  skip_cleanup: true
  on:
    repo: HughParsonage/travis-latex-ci

However, when I push a commit, I get the error scrreprt.cls not found.

I tried changing the installation to sudo apt-get install texlive-latex-extra, but I then get the error adjustbox.sty not found.

I understand these errors – the TeX Live distribution I requested travis use does not have the packages/class files I need, but not how to resolve them through a .travis.yml file. I understand I could put the respective .cls/.sty files in the same directory until I get no build errors. However, is there a way to get all these packages on the travis machine?

Hugh
  • 2,374
  • 17
  • 30
  • scrreport is most likely not included in tex-live-base. I would recommend to do a standard installation of TeX Live that contains everything. – Uwe Ziegenhagen Sep 10 '16 at 04:43
  • OK, I thought that sudo apt-get install texlive-latex-extra achieved that, but I still get additional packages. What should I put after sudo apt-get install? – Hugh Sep 10 '16 at 04:51
  • Does a normal TeX file using the class get compiled? I never heard of adjustbox.sty. What I generally recommend is not tu use the distribution LaTeX but rather to get TeX Live from tug.org. – Uwe Ziegenhagen Sep 10 '16 at 05:04
  • Yes, the class file is fine (at least it compiles without errors on my local machine). I'm using MiKTeX. – Hugh Sep 10 '16 at 05:10
  • 2
    After a long way of testing i found a easy way, using the R-template for travis. This comes with the regular Texlive-distribution and you can install Packets using tlmgr. Have a look at here: https://github.com/circuitikz/circuitikz/blob/master/.travis.yml – sistlind Sep 10 '16 at 06:57
  • The LaTeX3 team also uses Travis, see e.g. http://river-valley.zeeba.tv/why-does-it-always-fail-on-me-automating-testing-using-travis-ci/ They install a minimal distribution using the installer from TUG.org I believe, see https://github.com/latex3/latex3 Edit: Have a look at support/texlive.sh – Torbjørn T. Sep 10 '16 at 10:02
  • Hmm, I tried copying the code (including ./source, but I get the error message "source ./support/texlive.sh". – Hugh Sep 10 '16 at 10:24
  • No such file or directory – Hugh Sep 10 '16 at 10:41
  • @sistlind Thanks, but I tried your .travis.yml file and received the error The command "make manual-git" exited with 2. – Hugh Sep 11 '16 at 05:18
  • 2
    Well, you have to provide your own build script. The hint for this travis-file was just for the installation of packages. Have a look at the Makefile of the repository and the deploy.sh file, respectively. There you can find the build commands. – sistlind Sep 11 '16 at 06:46
  • Ah that was silly of me! Currently building well. Thank you! – Hugh Sep 11 '16 at 08:13

1 Answers1

7

On a local system it's possible to simply install 'all of TeX Live' and avoid these issues. With a remote test system, where you need to minimise installation size, that is more difficult. (Yes, Travis-CI will cache installed packages but asking for all of TeX Live is probably somewhat extreme.)

As discussed in How do I install an individual package on a Linux system?, it is possible to look up which Ubuntu package contains which .sty file (or similar) and thus to debug these issues. However, that is still probably somewhat error prone in running on a 'live' system. I'd therefore recommend setting up a virtual machine which matches the CI system you've chosen: for example, Travis-CI currently use Ubuntu 12.04 LTS. You can then test 'locally' (and with access to logs, etc.) exactly which packages do and do not need to be installed to make things work.

As noted in comments, for LaTeX3 development we have set up Travis-CI, but use a script which installs 'vanilla' TeX Live rather than using the Ubuntu packaged version. The considerations working this way are much the same: selection of TeX packages which are required with omission of others. There is no real difference in this sense between testing programming and testing documents: it is still a question of working out what is needed and installing it.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 1
    Do you have any advice how to drive the installation to test biber as well? I've tried sudo apt-get install texlive-bibtex-extra and sudo apt-get -y install biber. – Hugh Sep 18 '16 at 10:35
  • @Hugh The Ubuntu version used by Travis-CI (TL'09) doesn't include Biber. You'll therefore have to go down the 'install vanilla TL' route to test anything that needs this. – Joseph Wright Sep 18 '16 at 10:42
  • See https://github.com/latex3/latex3/blob/master/articles/tb114wright.ltx for the source of a TUGboat I've written on this – Joseph Wright Sep 18 '16 at 11:06