Sunday, 9 June 2019

PHP 7.2 on 2x Travis CI instances, one with extension and one without

I'd like to have two instances of a PHP 7.2 machine on Travis CI - one with bcmath installed and one that doesn't have it installed.

My .travis.yml file looks like this:

language: php

matrix:
  fast_finish: true
  allow_failures:
    - php: nightly
  include:
    - php: 5.4
    - php: 5.5
    - php: 5.6
    - php: 7.0
    - php: 7.1
    - php: 7.2
    - php: 7.3
      env:
        - TEST_COVERAGE=true
    - php: nightly
    - php: hhvm

So would I just add another - php: 7.2 line to .travis.yml or what?

Per https://docs.travis-ci.com/user/languages/php/ I can add extensions thusly:

before_install: echo "extension = <extension>.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

Thus it stands to reason that the following would be sufficient to remove them:

before_install: sed -i 's/extension = bcmath.so/#extension = bcmath.so/g' ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

I could probably even target a specific version with that like so (untested):

before_install: if [ '$TRAVIS_PHP_VERSION' = '7.2' ]; then sed -i 's/extension = bcmath.so/#extension = bcmath.so/g' ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi

But none-of that is gets me two PHP 7.2 machines - I can use those lines to have a VM of one type or the other but not both.

Any ideas?



from PHP 7.2 on 2x Travis CI instances, one with extension and one without

No comments:

Post a Comment