Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #1689

Merged
merged 11 commits into from
Aug 26, 2018
Merged

Fix CI #1689

merged 11 commits into from
Aug 26, 2018

Conversation

tkf
Copy link
Contributor

@tkf tkf commented Aug 23, 2018

I just blindly replace old API to the new one. Not sure if all the upstream packages are ready but I think it's handy if we can check Travis to see how much of them are ready.

Pkg.add([
PackageSpec("ImageMagick"),
# PackageSpec("GR"),
PackageSpec(url="https://github.com/tkf/PlotReferenceImages.jl", rev="pkg3"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkf tkf force-pushed the pkg3 branch 2 times, most recently from 0e95c44 to 5eae423 Compare August 24, 2018 04:42
# ENV["PYTHON"] = ""

Pkg.add([
PackageSpec(url="https://github.com/tkf/PlotReferenceImages.jl", rev="pkg3"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for me: Revert 1748063 once JuliaPlots/PlotReferenceImages.jl#30 is merged

@tkf
Copy link
Contributor Author

tkf commented Aug 24, 2018

Oops, I didn't mean to go this deep into tweaking your testing setup. I thought it was just a quick small fix :) I hope I didn't mess up anything.

The biggest change is that non-registered test requirements are now Pkg.added in test/runtests.jl. This is required for adding those packages inside the testing environment instead of the default global environment. I guess this is the easiest choice if you want to use Pkg.test but avoid checking in Manifest.toml. (see also JuliaDiff/ForwardDiff.jl#332 (comment))

Anyway, I think now the CI is reporting meaningful errors and I will not to try fixing them.

@mkborregaard
Copy link
Member

I'm not really sure what the purpose is of this PR - could you explain? I think our existing setup quite closely followed the recommended default travis script for pacakges.

@tkf tkf changed the title Use Pkg3 API in travis_commands.jl Fix CI Aug 24, 2018
@tkf
Copy link
Contributor Author

tkf commented Aug 24, 2018

I fixed the test suite and CI setup so that they work with Julia 1.0 / Pkg3. I don't think the current setup in master branch is compatible with Julia 1.0. I should have edited the title since it does not describe this PR well any more.

@tkf
Copy link
Contributor Author

tkf commented Aug 24, 2018

Some more info: I don't think installing non-registered packages in travis_commands.jl as you were doing is a valid approach if you want to use Pkg.test:

The tests are run by generating a temporary environment with only pkg and its (recursive) dependencies (recursively) in it. If a manifest exist, the versions in that manifest is used, otherwise a feasible set of package are resolved and installed.

--- https://docs.julialang.org/en/latest/stdlib/Pkg/#Pkg.test

I can think of three choices:

  1. Add non-registered packages in runtests.jl as I did here.
  2. Add Project.toml and Manifest.toml (which is already supported by the default script). Manifest.toml can contain repo-url pointing to a non-registered git repository. The downside is that Manifest.toml has to be updated manually to reflect upstream changes.
  3. Skip Pkg.test and directly invoke julia test/runtests.jl. The downside is that you have to install everything in test/REQUIRE manually.

Maybe there are more solutions. But I thought the first choice was reasonable.

@daschw
Copy link
Member

daschw commented Aug 24, 2018

Nice work @tkf! I actually have a local branch starting a quite similar implementation, but you are one step ahead.
We still need to finalize updating VisualRegressionTests.jl, but in the future it will optionally depend on Gtk. If the tests are run interactively (i.e. locally by a user) we want a Gtk dependency, so that the user can compare possible changes in the plot examples in a GUI window.
My first suggestion would be to also add Gtk to the dependencies and add something like

if isinteractive()
    using Gtk
end

This, however, also requires the Gtk dependency for CI runs, where it is not actually used. So if you have a better idea, I'm open to suggestions.
Otherwise, I'd ask you to add something similar to my code snippet above somewhere in e.g. runtests.jl, and we can revisit, once JuliaPlots/VisualRegressionTests.jl@1cba462 is released.

@daschw
Copy link
Member

daschw commented Aug 24, 2018

I can think of three choices:

I prefer 1.

@tkf
Copy link
Contributor Author

tkf commented Aug 25, 2018

Why doesn't @eval Main import Gtk (or maybe @static if isinteractive()?) work?

# PackageSpec(name="Blink", rev="master"),
# PackageSpec(name="Rsvg", rev="master"),
# PackageSpec(name="PlotlyJS", rev="master"),
PackageSpec(name="VisualRegressionTests", rev="master"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Comment out above (revert a8e3ecc)

@@ -2,6 +2,10 @@
using VisualRegressionTests
# using ExamplePlots

if isinteractive()
@eval Main import Gtk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems this part was ignored in Travis as intended https://travis-ci.org/JuliaPlots/Plots.jl/builds/420347392?utm_source=github_status&utm_medium=notification

Is it enough? Does it cover the use-case you have in mind?

@tkf
Copy link
Contributor Author

tkf commented Aug 25, 2018

So one of the problem with if isinteractive() is that it's not true in the subprocess launched by Pkg.test. It means that the user have to manually run("test/runtests.jl") if s/he wants to test Gtk related components (which may not be so bad?). Another option would be to check (say) ENV["PLOTS_TEST_GUI"] and install Gtk in test/add_packages.jl.

@@ -1,5 +1,6 @@
module PlotsTests

include("add_packages.jl")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel bad about unconditionally installing packages via runtests.jl which could ruin users' environments. Something like

if isinteractive()
    @info """
    Skip installing unregistered packages.  To run Plots.jl test suite
    in interactive session, you need to install them manually by, e.g.,
    `include("test/add_packages.jl")`.  Alternatively, you can run the test
    with `Pkg.test("Plots")`.
    """
else
    include("add_packages.jl")
end

would be nice. However, this still is not enough when the test is invoked from shell like julia test/runtests.jl. Checking Base.HOME_PROJECT and Base.ACTIVE_PROJECT may solve this problem but I guess we need to be careful not to exclude their values when invoked via Pkg.test.

@mkborregaard
Copy link
Member

It means that the user have to manually run("test/runtests.jl") if s/he wants to test Gtk related components (which may not be so bad?).

Yes, that's the idea. Advanced users and people making PRs can run the tests manually to overwrite images with new versions, people just running test to know if this works on julia-someversion will just get an exception (the GTK window is only launched upon test errors)

@@ -116,7 +116,7 @@ ignorenan_minimum(x) = Base.minimum(x)
ignorenan_maximum(x::AbstractArray{F}) where {F<:AbstractFloat} = NaNMath.maximum(x)
ignorenan_maximum(x) = Base.maximum(x)
ignorenan_mean(x::AbstractArray{F}) where {F<:AbstractFloat} = NaNMath.mean(x)
ignorenan_mean(x) = Base.mean(x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Statistics.mean to be explicit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Applied in 6d0d8ea

test/imgcomp.jl Outdated
@@ -15,6 +19,8 @@ using VisualRegressionTests

using Plots
# using StatPlots
using PlotReferenceImages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just import PlotReferenceImages? You're just using it for pathof, right?

@mkborregaard
Copy link
Member

You're on fire @tkf , great with all the contribs lately!

@tkf
Copy link
Contributor Author

tkf commented Aug 25, 2018

It was just a little hack in the beginning :)

If @daschw is OK with #1689 (comment) then I think it's good to go.

@daschw But If you want to do the fix in #1693 please feel free to close this issue and cherry pick some patches if some of them are useful.

@daschw
Copy link
Member

daschw commented Aug 26, 2018

No, I think I will go with this implementation. Seems to work better than my attempt in #1693. I will add my VisualRegressionTests related fixes in a separate PR.
Thanks so much for this @tkf!

@daschw daschw merged commit 25190d9 into JuliaPlots:master Aug 26, 2018
@daschw daschw mentioned this pull request Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants