Skip to content

Commit bd3fbe0

Browse files
authored
Merge pull request #171 from pmmp/gh-actions
Setup GitHub Actions
2 parents f1a62a5 + f5e88d7 commit bd3fbe0

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/main.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
9+
jobs:
10+
# This workflow contains a single job called "build"
11+
build:
12+
name: PHP ${{ matrix.php }} ZTS ${{ matrix.zts }} OPcache ${{ matrix.opcache }}
13+
# The type of runner that the job will run on
14+
runs-on: ubuntu-20.04
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php:
19+
- 7.1.33
20+
- 7.2.34
21+
- 7.3.26
22+
- 7.4.14
23+
- 8.0.1
24+
zts: [on, off]
25+
opcache: [on, off]
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Restore PHP build cache
30+
id: php-build-cache
31+
uses: actions/cache@v2
32+
with:
33+
path: ${{ github.workspace }}/php
34+
key: php-build-${{ matrix.php }}-zts-${{ matrix.zts }}
35+
36+
- name: Clone php-build/php-build
37+
uses: actions/checkout@v2
38+
with:
39+
repository: php-build/php-build
40+
path: ${{ github.workspace }}/php-build
41+
42+
- name: Install PHP dependencies
43+
run: ${{ github.workspace }}/php-build/install-dependencies.sh
44+
45+
- name: Compile PHP
46+
if: steps.php-build-cache.outputs.cache-hit != 'true'
47+
run: |
48+
cd ${{ github.workspace }}/php-build
49+
./install-dependencies.sh
50+
PHP_BUILD_ZTS_ENABLE=${{ matrix.zts }} ./bin/php-build ${{ matrix.php }} ${{ github.workspace }}/php
51+
52+
- name: Install extension
53+
run: |
54+
cd ${{ github.workspace }}
55+
${{ github.workspace }}/php/bin/phpize
56+
./configure --with-php-config=${{ github.workspace }}/php/bin/php-config
57+
make -j8 install
58+
echo "extension=ds.so" > ${{ github.workspace }}/php/etc/conf.d/ds.ini
59+
rm ${{ github.workspace }}/php/etc/conf.d/xdebug.ini || true
60+
61+
- name: Prefix PHP to PATH
62+
run: echo "${{ github.workspace }}/php/bin" >> $GITHUB_PATH
63+
64+
- name: Generate OPcache configuration
65+
run: echo "opcache.enable_cli=${{ matrix.opcache }}" > ${{ github.workspace }}/php/etc/conf.d/opcache.ini
66+
67+
- name: Install Composer
68+
run: curl -sS https://getcomposer.org/installer | php
69+
- name: Restore Composer package cache
70+
uses: actions/cache@v2
71+
with:
72+
path: |
73+
~/.cache/composer/files
74+
~/.cache/composer/vcs
75+
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.json') }}"
76+
restore-keys: |
77+
composer-v2-cache-
78+
79+
- name: Install Composer dependencies
80+
run: php composer.phar install --prefer-dist --no-interaction
81+
82+
- name: Run PHPUnit tests
83+
run: php composer.phar test

0 commit comments

Comments
 (0)