Update sync_site.yml
[m6w6/m6w6.github.io] / _posts / 2015-08-11-testing-php-extensions-on-travis-ci.md
1 ---
2 title: Testing PHP extensions on Travis-CI
3 author: m6w6
4 tags:
5 - PHP
6 ---
7
8 Testing PECL extensions on Travis-CI has always been
9 cumbersome for me; build PHP in different versions and debug/threadsafe
10 flavors, install PECL dependencies and so on, which usually results in a mess
11 of command line scripts, repeated for every extension.
12
13 Enter [travis-pecl](https://github.com/m6w6/travis-pecl).
14
15 This tiny support bin comes with a Makefile and small PHP scripts to generate
16 the build matrix and check your package.xml file. It supports building PHP in
17 a wide variety of flavors, installing PECL dependencies from the PECL website
18 or from bundled [pharext](https://github.com/m6w6/pharext) packages and
19 running the testsuite with a comprehensive set of commands.
20
21 Let's look at a few commands with a properly set up environment from the test
22 matrix:
23
24 ```yaml
25 env:
26 - PHP=5.6 enable_debug=yes with_iconv=yes enable_json=yes
27 ```
28
29 ### Build PHP:
30 ```sh
31 make -f travis/pecl/Makefile php
32 ```
33 ### Install a PECL dependency:
34 ```sh
35 make -f travis/pecl/Makefile pecl PECL=propro
36 ```
37 ### Install a PECL dependency from a [pharext](https://github.com/m6w6/pharext) package, located in travis/:
38 ```sh
39 make -f travis/pecl/Makefile pharext/raphf-phpng
40 ```
41 ### Build the currently checked out extension:
42 ```sh
43 make -f travis/pecl/Makefile ext PECL=http
44 ```
45 ### Run the testsuite:
46 ```sh
47 make -f travis/pecl/Makefile test
48 ```
49
50 Finally, check out the [README](https://github.com/m6w6/travis-pecl/blob/master/README.md)
51 and have a look at a couple of complete examples here:
52
53 * [ext-apfd/gen_travis_yml.php](https://github.com/m6w6/ext-apfd/blob/master/gen_travis_yml.php)
54 * [ext-http/scripts/gen_travis_yml.php](https://github.com/m6w6/ext-http/blob/master/scripts/gen_travis_yml.php)