summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: b842c53fcb6752311dd75378a270de634e72f792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
  pull_request:
  push:
    branches:
      - 'master'

name: CI

jobs:
  tests:
    name: Tests

    runs-on: ${{ matrix.os }}

    env:
      PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
      PHP_INI_VALUES: assert.exception=1, zend.assertions=1

    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - windows-latest

        php-version:
          - "7.2"
          - "7.3"
          - "7.4"
          - "8.0"
          - "8.1"
          - "8.2"
          - "8.3"
          - "8.4"

        compiler:
          - default

        include:
          - os: ubuntu-latest
            php-version: "8.0"
            compiler: jit
          - os: ubuntu-latest
            php-version: "8.1"
            compiler: jit
          - os: ubuntu-latest
            php-version: "8.2"
            compiler: jit
          - os: ubuntu-latest
            php-version: "8.3"
            compiler: jit
          - os: ubuntu-latest
            php-version: "8.4"
            compiler: jit

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Override PHP ini values for JIT compiler
      if: matrix.compiler == 'jit'
      run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV

    - name: Install PHP with extensions
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php-version }}
        coverage: pcov
        extensions: ${{ env.PHP_EXTENSIONS }}
        ini-values: ${{ env.PHP_INI_VALUES }}

    - name: Cache Composer packages
      id: composer-cache
      uses: actions/cache@v4
      with:
        path: vendor
        key: v5r2-${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
        restore-keys: |
          v5r1-${{ runner.os }}-php-${{ matrix.php-version }}-

    - name: Install dependencies
      run: composer install

    - name: Run make
      run: make -B

    - name: Run tests with phpunit
      run: php ./vendor/phpunit/phpunit/phpunit