Building a Julia Project
What This Guide Covers #
Community-Supported Warning #
Travis CI support for Julia is contributed by the community and may be removed or altered at any time. If you run into any problems, please report them in the Travis CI Julia Community Forums and cc @ararslan, @staticfloat, and @StefanKarpinski.
Choosing Julia versions to test against #
Julia workers on Travis CI download and install a binary of Julia. You can specify
the Julia versions to test in the
julia: key in your
.travis.yml file. For example:
language: julia julia: - nightly - 1.1 - 1.0.3
Acceptable formats are:
nightlywill test against the latest nightly build of Julia.
Xwill test against the latest release for that major version. (Applies only to major versions 1 and later.)
X.Ywill test against the latest release for that minor version.
X.Y.Zwill test against that exact version.
The oldest versions for which binaries are available is 0.3.1 for Linux, or 0.2.0 for macOS.
Services such as codecov.io and coveralls.io
provide summaries and analytics of the coverage of the test suite.
After enabling the respective services for the repositories, the
options can be used as follows, placing them at the top level of the YAML document:
codecov: true coveralls: true
This will then upload the coverage statistics upon successful completion of the tests to the specified services.
Default Build and Test Script #
If your repository contains
Project.toml file, and you are
building on Julia v0.7 or later, the default build script will be:
using Pkg Pkg.build() # Pkg.build(; verbose = true) for Julia 1.1 and up Pkg.test(coverage=true)
Otherwise it will use the older form:
if VERSION >= v"0.7.0-DEV.5183" using Pkg end Pkg.clone(pwd()) Pkg.build("$pkgname") # Pkg.build("$pkgname"; verbose = true) for Julia 1.1 and up Pkg.test("$pkgname", coverage=true)
where the package name
$pkgname is the repository name, with any trailing
Note that the
coverage=true argument only tells
Pkg.test to emit coverage information
about the tests it ran; it does not submit this information to any services.
To submit coverage information, see the coverage section above.
Dependency Management #
If your Julia package has a
deps/build.jl file, then
will run that file to install any dependencies of the package. If you need
to manually install any dependencies that are not handled by
it is possible to specify a custom dependency installation command as described
in the general build configuration guide.
In a rare case, you may need to clone a private repo if it is a dependency of the repo you are trying to test. To add a private repo, check out the link here: Private Dependencies. Once you have the repo added, you will need to copy it to your julia folder and then run the default build script. Check out the script below for Linux to see how that is done:
script: #- ls #Optional command. Just here to confirm the Dependency is in the folder you think it is. #- pwd #Optional command. Just here so you can see where you are in the file system to make sure the path is correct below. - julia --project --color=yes --check-bounds=yes -e 'using Pkg; Pkg.develop(PackageSpec(path="/home/travis/build/path_to_private_Dependency")); Pkg.instantiate()' - julia --project --color=yes --check-bounds=yes -e 'using Pkg; Pkg.instantiate(); Pkg.build();'
Note: you will neeed to have the ‘project.toml’ file in your repo for these commands above to work. This can be found in your ‘~/.julia/enviroments/’ folder.
Build Matrix #
For Julia projects,
julia can be given as arrays
to construct a build matrix.
Environment Variable #
The version of Julia a job is using is available as:
JULIA_PROJECT is set to
@., which means Julia will search through parent directories until a
JuliaProject.toml file is found; the containing directory then is used in the home project/environment.
Example Projects #
Here’s a list of open-source Julia projects utilizing Travis CI in different ways: