Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a custom PHP extension on Travis (OAuth)

I'd like to install the PHP extension OAuth in my build environment on Travis.

I've tried these two configuration in .travis.yml file: COnfiguration 1 (using before_script):

language: php

matrix:
    include:
        - php: 5.3
        - php: 5.4
        - php: 5.5
        - php: 5.6
        - php: 7.0
        - php: hhvm

cache:
    directories:
        - $HOME/.composer/cache

install:
    - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction

script:
    - phpunit --verbose --coverage-clover build/logs/clover.xml
    - phpenv config-rm xdebug.ini || return 0

before_script:
    - pecl install oauth

Configuration 2 (using install):

language: php

matrix:
    include:
        - php: 5.3
        - php: 5.4
        - php: 5.5
        - php: 5.6
        - php: 7.0
        - php: hhvm

cache:
    directories:
        - $HOME/.composer/cache

install:
    - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction
    - pecl install oauth

script:
    - phpunit --verbose --coverage-clover build/logs/clover.xml
    - phpenv config-rm xdebug.ini || return 0

The documentation isn't clear about where to put the commands to install custom PHP extensions (or maybe I've not understood it, it's possible!).

Anyway, can someone help me configure Travis to install OAuth PHP extension? Thankyou!

like image 813
Aerendir Avatar asked Nov 08 '22 20:11

Aerendir


1 Answers

Per Problems with PHP YAML within Travis CI it looks like the pecl install goes in the before_script section.

Per my own testing here https://travis-ci.org/davidjeddy/no-code/jobs/345523220 it appears that does the trick.

like image 77
David J Eddy Avatar answered Nov 14 '22 22:11

David J Eddy