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