travis -> gh-actions
[m6w6/ext-pq] / scripts / gen_github_workflow_ci.php
1 #!/usr/bin/env php
2 <?php echo "# generated file; do not edit!\n"; ?>
3
4 name: ci
5 on:
6 workflow_dispatch:
7 push:
8 pull_request:
9
10 jobs:
11 <?php
12
13 $gen = include __DIR__ . "/ci/gen-matrix.php";
14 $cur = "8.0";
15 $job = $gen->github([
16 "old-matrix" => [
17 "PHP" => ["7.0", "7.1", "7.2", "7.3", "7.4"],
18 "enable_debug" => "yes",
19 "enable_maintainer_zts" => "yes",
20 "enable_json" => "yes",
21 "enable_spl" => "yes",
22 ],
23 "master" => [
24 "PHP" => ["master"],
25 "enable_debug" => "yes",
26 "enable_zts" => "yes",
27 "enable_spl" => "yes",
28 ],
29 "cur-none" => [
30 "PHP" => $cur,
31 ],
32 "cur-dbg-zts" => [
33 "PHP" => $cur,
34 "enable_debug",
35 "enable_zts",
36 "enable_spl" => "yes",
37 ],
38 "cur-cov" => [
39 "CFLAGS" => "-O0 -g --coverage",
40 "CXXFLAGS" => "-O0 -g --coverage",
41 "PHP" => $cur,
42 "enable_spl" => "yes",
43 ]]);
44 foreach ($job as $id => $env) {
45 printf(" %s:\n", $id);
46 printf(" name: %s\n", $id);
47 if ($env["PHP"] == "master") {
48 printf(" continue-on-error: true\n");
49 }
50 printf(" env:\n");
51 foreach ($env as $key => $val) {
52 printf(" %s: \"%s\"\n", $key, $val);
53 }
54 ?>
55 runs-on: ubuntu-20.04
56 steps:
57 - uses: actions/checkout@v2
58 with:
59 submodules: true
60 - name: Install
61 run: |
62 sudo apt-get install -y \
63 php-cli \
64 php-pear \
65 libpq-dev \
66 re2c
67 - name: Prepare
68 run: |
69 make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php
70 make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master
71 - name: Build
72 run: |
73 make -f scripts/ci/Makefile ext PECL=pq
74 - name: Prepare Test
75 run: |
76 sudo systemctl start postgresql
77 sudo -u postgres createuser --login runner
78 sudo -u postgres createdb -O runner runner
79 - name: Test
80 run: |
81 make -f scripts/ci/Makefile test
82 <?php if (isset($env["CFLAGS"]) && strpos($env["CFLAGS"], "--coverage") != false) : ?>
83 - name: Coverage
84 if: success()
85 run: |
86 cd src/.libs
87 bash <(curl -s https://codecov.io/bash) -X xcode -X coveragepy
88 <?php endif; ?>
89
90 <?php
91 }