Create README.md
[m6w6/travis-pecl] / README.md
1 # travis-pecl
2
3 These few lines of code support building and testing PHP extensions on Travis-CI.
4
5 ## Usage
6
7 First, we'll add this repo to our extension as submodule:
8
9 git submodule add -n travis-pecl https://github.com/m6w6/travis-pecl.git travis/pecl
10 git submodule update --init
11
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:
14
15 #!/usr/bin/env php
16 # file generated by gen_travis_yml.php, do not edit!
17
18 # use the container infrastructure
19 sudo: false
20
21 # we want to build a C library
22 language: c
23
24 # use the system's PHP to run this script
25 addons:
26 apt:
27 packages:
28 - php5-cli
29 - php-pear
30
31 # now we'll specify the build matrix environment
32 env:
33 <?php
34
35 # instantiate the generator
36 $gen = include "travis/pecl/gen_matrix.php";
37
38 # generate the matrix
39 $env = $gen([
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
43 "enable_debug",
44 # test threadsafe and non-threadsafe builds
45 "enable_maintainer_zts",
46 # test with ext/json enabled an disabled
47 "enable_json",
48 # always build with iconv support
49 "with_iconv" => ["yes"],
50 ]);
51
52 # output the build matrix
53 foreach ($env as $e) {
54 printf(" - %s\n", %e);
55 }
56
57 ?>
58
59 before_script:
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
66
67 script:
68 # run the PHPT test suite
69 - make -f travis/pecl/Makefile test
70
71
72 That's it, more TBD.