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-BUILDNO
whereBUILDNO
. 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-type
option (see below).
- In your main git repo root add this .travis.yml, or if you don't use the
travis-texbuild.sh
you can use this .travis.yml. Docs for the configuration options in your.travis.yml
is found further down in this readme. - Add the
travis-texbuild.sh
to.travis/travis-texbuild.sh
directory 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:
cd
into your git repo and rungem install travis; travis encrypt GH_TOKEN=YOURTOKEN --add
(replacingYOURTOKEN
with 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.tex
is supposed to fail, then you should make a filetests/testmyfeature/wants-fail
. Then a success run of themain.tex
would count as a failed build. - You can put whatever files and directories you want into
tests
. At test time, only the directories containing themain.tex
is executed. - The working directory of a test
main.tex
-file is the directory the currentmain.tex
file is in. - In the docker, by default, the entire repository is loaded to the
/repo
volume. So in yourtests/TestMyFeature/main.tex
you 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/*.tex
is valid).
- Accepted values:
small
orfull
- 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 thepackages
option. (-medium
: Coming later)texliveonfly
: Is thesmall
image, but missing packages will be attempted to be installed usingtexliveonfly
. You can still manually add packages that you wish to installed using thepackages
option.
- 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:
branch
ornone
- 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
scheme
with 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:latest
or 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