The repo for the dockers used can be found here
Check out the quickstart branch to get started with a base setup!
If you're reading this at docker hub, you probably want to head on over to the git repo.
- You push to the git repo containing your code.
- Travis runs the test files you specified (see below).
- Travis gives a build status of "failed" if any of the builds doesn't result as expected.
- (optional) Travis pushes (only) the resulting PDFs to a branch called
travis-BUILDNOwhereBUILDNO. will be replaced by the current travis build number. You can choose to push these to a release instead of a branch by using thepush-typeoption (see below).
- In your main git repo root add this .travis.yml, or if you don't use the
travis-texbuild.shyou can use this .travis.yml. Docs for the configuration options in your.travis.ymlis found further down in this readme. - Add the
travis-texbuild.shto.travis/travis-texbuild.shdirectory you just created (this file is pushing the branch. You can omit it if you don't want to push thetravis-BUILDNO-branch to your repos. - If you want the push-branch or push-release functionality, do the following
- Go to github personal access tokens and generate a new token
- You need to encrypt your github token, via travis, and add it to the
.travis.yml. If have ruby (gem) installed you can do:
cdinto your git repo and rungem install travis; travis encrypt GH_TOKEN=YOURTOKEN --add(replacingYOURTOKENwith the generated token).- If the above doesn't work (or you don' know what ruby gems are), you need to install ruby on your machine first.
- More information about this step is found on travis documentation on encryption keys and travis documentation on environment variables
Things to note:
- If
tests/testmyfeature/main.texis supposed to fail, then you should make a filetests/testmyfeature/wants-fail. Then a success run of themain.texwould count as a failed build. - You can put whatever files and directories you want into
tests. At test time, only the directories containing themain.texis executed. - The working directory of a test
main.tex-file is the directory the currentmain.texfile is in. - In the docker, by default, the entire repository is loaded to the
/repovolume. So in yourtests/TestMyFeature/main.texyou could do e.g.\def\input@path{{/repo/}}to include things directly from the repo.
You can specify configurations in your .travis.yml in the form
tex-config:
- config-name=value- Accepted values: one or more paths
- Default value:
tests/*/main.tex- Paths of the files to build. If you want to specify multiple paths, you can comma separate them.
- The path should be relative to the repo directory.
- The paths can contain wildcard (
*) (e.g.path/to/testfiles/*.texis valid).
- Accepted values:
smallorfull - Default value:
small
Which TeX-scheme to use; this is, basically, how many packages are installed on the docker image by default.
full: Full contains most of the packages in CTAN and has a docker image of 3GB that needs to be downloaded every time.small: contains only the bare necessities, and probably will most of the packages that you wish to used be specified in thepackagesoption. (-medium: Coming later)texliveonfly: Is thesmallimage, but missing packages will be attempted to be installed usingtexliveonfly. You can still manually add packages that you wish to installed using thepackagesoption.
- Accepted values: comma (not space) separated list
- Default value: empty
What packages should also be installed using TeXLives tlmgr before running the TeX-files.
Note that when using the texliveonfly image, it will attempt to install missing packages automatically.
- Specify compile flags to latexmk, for example
-dvi - Multiple flags can be given, separated by spaces
- Accepted values:
branchornone - Default value:
branch
Where to publish the pdfs generated. The option for pushing to release is coming: #3 - Push to releases instead of branches.
Talk about the files, tex profiles and so forth.
- Install docker. Post-installation steps from docs.docker.com:
- Make sure you have a docker group (it may exist already) with
sudo groupadd docker - Add your user to the docker group with
sudo usermod -aG docker $USER - Start docker service, for example with
sudo systemctl start docker
Building the docker image
- You can create a run configuration using the gutter icon in the Docker file, but you need to pass a parameter. Edit the run configuration, add a build arg
schemewith valuesmall. - In the run configuration, you can add an image tag name to find back your image more easily.
- After the build has finished ('deployed' locally) you can find an overview of images on your computer in the Docker tab.
- An instance of an image is called a container.
Running the docker image
- To test in this repo you can use
testrun.sh - To run elsewhere you can use
docker run --mount src="/full/path/to/repo",target=/repo,type=bind mytagname:latestor interactively (so you can play around inside the container) withdocker run -it --mount src="/full/path/to/repo",target=/repo,type=bind mytagname:latest /bin/sh