Continuous Integration (Travis CI)
- Pablo Narvaja

- Apr 19, 2020
- 2 min read
In this post I'll talk about Continuous Integration (CI) and how I implement it into llamatrhust using Travis CI.
Definition
Continuous Integration is a development practice where developers integrate code into a shared repository frequently, preferably several times a day. Each integration can then be verified by an automated build and automated tests. While automated testing is not strictly part of CI it is typically implied.
What are the common CI tools and which do I choose?
The common CI tools I came across searching for one are:
Only TravisCI, Bamboo and AppVeyor offer free hosting and only TravisCI and AppVeyor support multi platform including windows (if I am correct) and I choose TravisCI because it was easy to read the docs and I feel more comfortable with them.
Why use it now?
I decided to use CI now because I want to prepare the dev-env earlier so I can worry only about the engine later on. Another good thing is to have already a linux compiler in a remote VM and keep using windows in my local dev-env.
Setting Up the tool
Travis have two different APIs; one is free and only for opensource projects (like llamathrust) and the other paid for closesource projects.
Choose one from the links before.
Login with your github or bitbucket account.
Accept the Authorization of Travis CI.
Click on your profile picture in the top right of your Travis Dashboard, click Settings and then the Activate button, select the repositories you want to use with Travis CI.
Create a ".travis.yml" file inside your repo (this is the travis config file).
Creating the config file
For the file travis use YAML 1.1 and you can have multiple jobs for multiple languages so you can specify the language that jobs use, it is just for you since the VM doesn care as the script is ok.
language: cppThen we configure how the VM downloads the git repository. For llamathrust since it doesnt have any submodule dependency we set the depth to false (disable submodule clone) and set it quiet so it doesnt show in terminal the cloning process.
language: cpp
git:
quiet: true
depth: falseUntil now we set the properties assuming one job, now we need to define the jobs we want wich at the moment is just one for the windows VM but to have a template for later we do it like this.
language: cpp
git:
quiet: true
depth: false
jobs:
include:
# linux gcc
#- os: linux
# script: make llamathrust
# linux Clang
#- os: linux
# compiler: clang
# script: make llamathrust
- os: windows
# We need to do installs before we build in the VM
install:
# Install VS 2019 community edition
- choco install visualstudio2019community
# Install c++ development package neede to cmake recognize VS2019
- choco install visualstudio2019-workload-nativedesktop
env:
# VisualStudio 2019 msbuild.exe path
- MSBUILD_PATH="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin"
# CMake path
- CMAKE_PATH="/c/Program Files/CMake/bin"
script:
- export PATH=$MSBUILD_PATH:$CMAKE_PATH:$VCTargetsPath:$PATH
- echo $PATH
- mkdir build && cd build
- cmake .. -G "Visual Studio 16 2019" -A x64
- MSBuild.exe "Llamathrust Engine.sln" /property:Platform=x64 /property:Configuration=ReleaseJobs lifecycle
To explain more in depth the file above I need to talk about the job LifeCycle.
Each job is a sequence of phases:
The main phases are:
install - install any dependencies required OPTIONAL
script - run the build script
deploy - deploy to Heroku, Amazon, etc OPTIONAL
Travis CI can run custom commands in the OPTIONAL phases:
before_install - before the install phase
before_script - before the script phase
after_script - after the script phase.
before_deploy - execute before deploy phase
after_deploy - execute after deploy phase
I think that's all you need to know to set up the CI if you have questions email them to llamathrustengine@gmail.com
See ya in the next post!

Comments