html5validator and Travis CI

Mar 8, 2016 using tags travisci, html5validator, java

Here’s the situation. You would like to build a Jekyll (or other) static website on Travis and validate it using the command-line html5validator tool; all on Travis’ container infrastructure.

There’s a hard requirement for Java 8 here since html5validator is essentially a wrapper around vnu.jar.

This is roughly what your .travis.yml file will look like:

language: 'ruby'
sudo: false
  - '2.3.0'

  - 'oraclejdk8'

  - 'bundle install'
  - 'pip install --user html5validator'

  - 'bundle exec rake test'
  - 'bundle exec rake build'
  - 'html5validator --root public/'

The jdk directive in the .travis.yml file is a wrapper around the jdk_switcher tool, which makes switching between Java’s quite painless!