wp-dev-lib icon indicating copy to clipboard operation
wp-dev-lib copied to clipboard

Travis doesn't support xmllint on new Trusty environment

Open MattGeri opened this issue 8 years ago • 7 comments

Travis now defaults to it's new Ubuntu Trusty environment (unless specified not to in the config file). However in this environment, xmllint or probably the libxml2-utils package is not installed.

So when the build tries to check the XML, an error is thrown:

xargs: xmllint: No such file or directory

Switching back to Ubuntu Precise is a short term fix for this. Add the following to .travis.yml

dist: - precise

MattGeri avatar Jul 25 '17 12:07 MattGeri

Seems like then the best permanent fix would be to update the install_tools function to install xmllint if [ -s "$TEMP_DIRECTORY/paths-scope-xml" ], yeah?

See https://github.com/xwp/wp-dev-lib/blob/bb1ae0b61663d022ec1ed78aa623720de39c9049/check-diff.sh#L402-L403

westonruter avatar Jul 26 '17 01:07 westonruter

@MattGeri see also #249 where precise is now the default. Still, we should support trusty.

westonruter avatar Aug 02 '17 05:08 westonruter

I started with that in https://github.com/ocean90/wp-dev-lib/commit/e7d384919b66f19cfa8bc8ae94ce834cb98f900e until I realized that having sudo apt-get there isn't the best idea for local environments. Should this be part of travis.install.sh?

ocean90 avatar Oct 03 '17 12:10 ocean90

Yes, that makes sense to me. However, sudo is going to fail on Travis too when running on a containerized environment. So the xmllint installation should be done without sudo, assuming that is possible.

westonruter avatar Oct 03 '17 22:10 westonruter

Travis can install it for you, by adding this to .travis.yml:

addons:
  apt:
    packages:
      # Needed for `xmllint`.
      - libxml2-utils

Then sudo isn't required.

JDGrimes avatar Oct 04 '17 11:10 JDGrimes

Correct, I tried that yesterday and it's working, see https://travis-ci.org/GlotPress/GlotPress-WP/jobs/282788413#L428 and https://travis-ci.org/GlotPress/GlotPress-WP/jobs/282788413#L700.

The only disadvantage is that there's no apt caching, see https://github.com/travis-ci/travis-ci/issues/5876.

ocean90 avatar Oct 04 '17 11:10 ocean90

I did it like this:

install:
    - sudo apt-get install -y libxml2-utils

But the addons method seems a little more elegant.

valendesigns avatar Oct 04 '17 19:10 valendesigns