3 These few lines of code support building and testing PHP extensions on Travis-CI.
7 First, we'll add this repo to our extension as submodule:
9 git submodule add -n travis-pecl https://github.com/m6w6/travis-pecl.git travis/pecl
10 git submodule update --init
12 Let's build a `.travis.yml`by example. We'll use a simple PHP script, e.g. `gen_travis_yml.php`,
13 which will generate the configuration for us:
16 # file generated by gen_travis_yml.php, do not edit!
18 # use the container infrastructure
21 # we want to build a C library
24 # use the system's PHP to run this script
31 # now we'll specify the build matrix environment
35 # instantiate the generator
36 $gen = include "travis/pecl/gen-matrix.php";
40 # the latest releases of minor versions we want to build against
41 "PHP" => ["5.4", "5.5", "5.6"],
42 # test debug and non-debug builds
44 # test threadsafe and non-threadsafe builds
45 "enable_maintainer_zts",
46 # test with ext/json enabled an disabled
48 # always build with iconv support
49 "with_iconv" => ["yes"],
52 # output the build matrix
53 foreach ($env as $e) {
54 printf(" - %s\n", $e);
60 # build the matrix' PHP version
61 - make -f travis/pecl/Makefile php
62 # build the extension, the PECL variable expects the extension name
63 # and optionally the soname and a specific version of the extension
64 # separeated by double colon, e.g. PECL=myext:ext:1.7.5
65 - make -f travis/pecl/Makefile ext PECL=myext
68 # run the PHPT test suite
69 - make -f travis/pecl/Makefile test