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

Update Travis CI build to try building docs #7753

Closed
wants to merge 2 commits into from
Closed

Conversation

jiahao
Copy link
Member

@jiahao jiahao commented Jul 28, 2014

This PR adds automatic doctest builds to Travis. By including the doctests as part of the Travis test suite, the hope is to prevent the documentation examples from becoming so far out of sync with reality as to require serious manual updating, as in #7693.

This is the brute force solution to #7691.

Four documentation tests are included here:

  • HTML documentation build test
  • PDF documentation build test (which can catch some embedded HTMLisms)
  • Doctest build test (runs example blocks and compares them with the embedded output)
  • Link test (checks that links are still current)

- cd julia && make -C doc html SPHINXOPT="-W"
- make -C doc latexpdf SPHINXOPT="-W"
- make -C doc doctest
- make -C doc linkcheck
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to test documentation both in GCC and CLANG?

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, the binaries built by gcc and clang could produce different output (e.g. memory addresses in printouts). If build-dependent information exists in the documentation, that should certainly be checked for.

@JeffBezanson
Copy link
Member

What can we do about all the random numbers?

@ivarne
Copy link
Member

ivarne commented Jul 28, 2014

Hidden srand(0)?

Or just have them in a code block instead of a doctest block.

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

If you meant tests using rand/randn, the docs are set up with .. testsetup:: blocks that fix the random seeds. (At least one test had to be emended in #7693 to be reproducible.)

If you meant things like line numbers and method counts, I don't have any good ideas.

@JeffBezanson
Copy link
Member

Of course we want to err on the side of testing more things automatically, but we'll have to see how annoying the changing line numbers are in practice. I'm afraid it might be very annoying.

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

Actually I have an idea about the line numbers. Since we use our own Python classes anyway to run the tests in JuliaDoc, it is possible to intercept the test check here with a custom SphinxDocTestRunner._checker that will mod out differences in line numbers, memory addresses, etc.

@jiahao
Copy link
Member Author

jiahao commented Jul 28, 2014

On an unrelated note, it also occurs to me that JuliaDoc itself could be a good candidate for using pyjulia.

@jakebolewski
Copy link
Member

That would be conditional on pyjulia actually working :-(. I haven't looked at it in months and it is probably broken, although one intrepid windows user has gotten it to work for him.

@jiahao jiahao changed the title WIP: Update Travis CI build to try building docs Update Travis CI build to try building docs Sep 21, 2014
@jiahao jiahao force-pushed the master branch 3 times, most recently from 6c7c7e3 to 1a4c02f Compare October 11, 2014 22:06
@jiahao jiahao force-pushed the cjh/travisdoctest branch 2 times, most recently from 03983e0 to aa7a437 Compare February 2, 2015 20:59
@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

I've rebased and updated this PR so that only the basic HTML and PDF docbuilds are run.

I realize that these tests add more time to the Travis build, but it takes only about a minute or two to run and will catch syntax errors in changes to the documentation, which are unfortunately quite frequent since not many people are familiar with the nuances of ReStructuredText.

As for the doctests, I think running them as part of the release-candidate target is the best we can hope for at this point without an extensive rewrite of JuliaDoc.

cc @tkelman @staticfloat

@tkelman
Copy link
Contributor

tkelman commented Feb 2, 2015

Related: #9553 #9554
We shouldn't need to touch apt-get, pip, or brew upgrade gcc here, I think.

@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

I'll remove the gcc line, it must have been left over from the rebase.

The pip lines are necessary to install sphinx and the doc theme correctly.

@jiahao jiahao force-pushed the cjh/travisdoctest branch from aa7a437 to 778960f Compare February 2, 2015 21:17
@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

Oh, the new virtualenv setup means that it's no longer necessary to install sphinx manually. Let me try that.

@jiahao jiahao force-pushed the cjh/travisdoctest branch from 778960f to 1eaae76 Compare February 2, 2015 21:22
@jiahao jiahao force-pushed the cjh/travisdoctest branch from 1eaae76 to 6887e04 Compare February 2, 2015 21:52
@staticfloat
Copy link
Member

Alternative idea; We could add an entry to the build environment matrix that is a "no-arch" run, that just builds the docs and not Julia. It can then run in parallel to the other jobs, and won't run multiple times.

@tkelman
Copy link
Contributor

tkelman commented Feb 2, 2015

That's exactly the approach I took in #9553, which I am increasingly convinced no one other than me has ever looked at.

@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

Sounds good. I think @tkelman proposed something similar in one of the other issues.

This afternoon I played around with trying to make Travis short-circuit the build if only doc files were changed. (see the cjh/probe-travis branch)

I've figured out what to do as a git pre-push hook here, but Travis appears to choke on the ;; in the case statement and I haven't figured out how to fix it. Perhaps you'll have some idea.

@tkelman
Copy link
Contributor

tkelman commented Feb 2, 2015

I don't know where you're getting the inputs from, but note that $remote_sha from Travis is generally not accurate. Travis typically sets it to the sha of a merge commit at time of build queuing, not the actual merge commit that gets fetched.

Travis appears to choke on the ;; in the case statement and I haven't figured out how to fix it

If you try to write too much bash in yaml you will only end up tearing your hair out. Write a script under contrib or contrib/ci and just call it.

@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

The pre-push hook is for my local use with git; it will have to be adapted to the Travis environment.

note that $remote_sha from Travis is generally not accurate

I did notice this and tried to substitute as proxy the nearest branch point. I tried the magic incantation from this SO thread

PARENT_BRANCH=`git show-branch | grep '*' | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'`

Knowing the parent branch allows you to retrieve the commit at the branch point with

git rev-list -n 1 $PARENT_BRANCH

This works locally for me, in that branches off master gave PARENT_BRANCH=master and similarly for release-0.3, but not on Travis

https://travis-ci.org/JuliaLang/julia/builds/49214143#L136

I think owing to the clone being shallow.

@tkelman
Copy link
Contributor

tkelman commented Feb 2, 2015

There's also something a little strange about the way remotes work on Travis that can make version_git.sh behave oddly.

@jiahao
Copy link
Member Author

jiahao commented Feb 2, 2015

I'll leave my git experiments here for now. It's time to ford the 3' snowdrifts in search of suds and vittles.

@kshyatt kshyatt added docsystem The documentation building system test This change adds or pertains to unit tests labels Sep 6, 2015
@tkelman
Copy link
Contributor

tkelman commented Sep 6, 2015

No longer relevant, we've been building the docs in make install for some time.

@tkelman tkelman closed this Sep 6, 2015
@jiahao
Copy link
Member Author

jiahao commented Sep 10, 2015

But not the manual or on Travis still.

@tkelman
Copy link
Contributor

tkelman commented Sep 10, 2015

Good point, guess we could reopen and/or try again.

@jiahao jiahao deleted the cjh/travisdoctest branch October 22, 2015 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants