Travis and Julia 1.0

I noticed that testing of my package on Travis is broken with Julia 1.0/nightly (using the travis.yml that was recommended in the past):

$ julia -e ‘Pkg.clone(pwd()); Pkg.build(“FortranFiles”); Pkg.test(“FortranFiles”; coverage=true)’
ERROR: UndefVarError: Pkg not defined

Of course this is easy to fix, just need to add using Pkg. But then the Travis script will not work on Julia 0.6. I’m not very familiar with Travis, so what’s the best way to run different test scripts for different Julia versions?

1 Like

I can’t help much but it seems to be something else than just a missing using Pkg
because I just get the expected warnings:

Julia for Travis-CI is not officially supported, but is community maintained.
Please file any issues using the following link
Sign in to GitHub · GitHub
and mention @travis-ci/julia-maintainersin the issue
Julia-install
Installing Julia
0.01s$ CURL_USER_AGENT=“Travis-CI (curl --version | head -n 1)" 0.01s mkdir -p ~/julia
6.59s$ curl -A “CURL_USER_AGENT" -s -L --retry 7 'https://julialangnightlies-s3.julialang.org/bin/linux/x64/julia-latest-linux64.tar.gz' | tar -C ~/julia -x -z --strip-components=1 -f - 0.00s export PATH=”{PATH}:{HOME}/julia/bin”
$ julia -e ‘versioninfo()’
WARNING: Base.versioninfo is deprecated: it has been moved to the standard library package InteractiveUtils.
Add using InteractiveUtils to your imports.
in module Main
Julia Version 1.0.0-DEV.14
Commit 1dfc4d1fb0 (2018-08-04 07:20 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)

The command “if [[ -a .git/shallow ]]; then git fetch --unshallow; fi” exited with 0.
27.30s$ julia -e ‘Pkg.clone(pwd()); Pkg.build(“NormalizeQuantiles”); Pkg.test(“NormalizeQuantiles”; coverage=true)’;
WARNING: Base.Pkg is deprecated, run using Pkg instead
in module Main
Warning: Pkg.clone is only kept for legacy CI script reasons, please use add

And test is succeeding.

Thanks. But your log shows Julia version

At that time, Base.Pkg was only deprecated but not removed. In the release Julia 1.0, using Pkg is needed.

Ah, ok, I restart my travis build and report if it is the same issue you have.

Problem confirmed!

Which contradicts what was said, that 1.0 only removes the deprecation warnings.

Thanks for confirming! I think what is removed in 1.0 is not the deprecation warnings, but the deprecated features themselves.

Yes, all the deprecated warning were removed. Hence, consequently, you cannot use those features anymore.

By the way, all my tests in Travis against 1.0 are failing.

So is

if VERSION >= v"0.7.0-"
   using Pkg;
end

the way to go?

1 Like

this is what I just wanted to suggest
VERSION>=v"0.7-"&&using Pkg;

I think Compat is usually the tool to solve such issues. But I have never used it.

Yes, working, my travis.yml:

script:
   - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
   - julia -e 'if VERSION >= v"0.7.0-" using Pkg; end; Pkg.clone(pwd()); Pkg.build("NormalizeQuantiles"); Pkg.test("NormalizeQuantiles"; coverage=true)';
1 Like

Thanks, this seems to be working. I was thinking there may be a way to have Travis run different scripts for different Julia versions, but having the switch inside the Julia script will do for now.

The travis tests are fixed now. Julia is now being called using:

julia --color=yes -e "VERSION >= v\"0.7.0-DEV.5183\" && using Pkg; Pkg.clone(pwd()); Pkg.build(\"${JL_PKG}\")"

I did not alter my .travis.yml.