-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
135 lines (132 loc) · 7.35 KB
/
tests.yml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Run tests
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
jobs:
test-php:
name: Test on php ${{ matrix.php-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php-version: ["5.3", "5.4", "5.5", "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
os: [macos-latest, windows-latest]
experimental: [false]
php-extensions: ["bcmath, imagick, gd"]
coverage-extension: ["none"]
exclude:
# For now, we do not know how to run workflow on Windows
# with imagick PHP extension for PHP 5.3 - 5.6
- { php-version: '5.3', os: windows-latest }
- { php-version: '5.4', os: windows-latest }
- { php-version: '5.5', os: windows-latest }
- { php-version: '5.6', os: windows-latest }
# Somehow some tests fail under Windows and PHP 7.0,
# so we disable that run for now
- { php-version: '7.0', os: windows-latest }
include:
- { php-version: '5.3', os: windows-latest, experimental: false, php-extensions: 'bcmath, gd', coverage-extension: 'none' }
- { php-version: '5.4', os: windows-latest, experimental: false, php-extensions: 'bcmath, gd', coverage-extension: 'none' }
- { php-version: '5.5', os: windows-latest, experimental: false, php-extensions: 'bcmath, gd', coverage-extension: 'none' }
- { php-version: '5.6', os: windows-latest, experimental: false, php-extensions: 'bcmath, gd', coverage-extension: 'none' }
# Specify coverage extension for Ubuntu runs
- { php-version: '5.3', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'xdebug' }
- { php-version: '5.4', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'xdebug' }
- { php-version: '5.5', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'xdebug' }
- { php-version: '5.6', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'xdebug' }
- { php-version: '7.0', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'xdebug' }
# pcov is available from PHP 7.1
- { php-version: '7.1', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '7.2', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '7.3', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '7.4', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '8.0', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '8.1', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: '8.2', os: ubuntu-latest, experimental: false, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
- { php-version: 'nightly', os: ubuntu-latest, experimental: true, php-extensions: 'bcmath, imagick, gd', coverage-extension: 'pcov' }
env:
PDFINFO_BINARY: ${{ (matrix.os == 'ubuntu-latest') && '/usr/bin/pdfinfo' || ((matrix.os == 'macos-latest') && '/usr/local/bin/pdfinfo' || 'C:\ProgramData\Chocolatey\bin\pdfinfo.exe') }}
steps:
- uses: actions/checkout@v3
- name: Install pdfinfo, pdftopng or pdftoppm
uses: ConorMacBride/install-package@v1
with:
apt: poppler-utils
brew: poppler
choco: xpdf-utils
- name: Install magick
if: runner.os == 'Linux'
uses: mfinelli/setup-imagemagick@v2
- name: Install magick
uses: ConorMacBride/install-package@v1
with:
brew: imagemagick@6
choco: imagemagick
- name: Use php ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage-extension }}
extensions: ${{ matrix.php-extensions }}
ini-values: display_errors=on, display_startup_errors=on, error_reporting=-1
- name: List php modules
run: php -m
- name: List php modules using "no php ini" mode
run: php -m -n
- name: Cache module
uses: actions/cache@v3
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install --no-interaction
- name: Install test dependencies
run: cd ./tests && composer install --no-interaction && cd ../
- name: Run shell-based test suite
if: runner.os == 'Linux'
run: ./tests/launch.sh
- name: Send coverage
if: matrix.coverage-extension != 'none'
uses: codecov/codecov-action@v3
with:
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}
- name: Create output folder
run: mkdir ./tests/output
- name: Run PHP-based test suite
run: php ./tests/launch.php --output-dir ./tests/output
# The PHP_BINARY environment variable is only available since PHP 5.4
env:
PHP_BINARY: ${{ (matrix.os == 'ubuntu-latest') && '/usr/bin/php' || ((matrix.os == 'macos-latest') && '/usr/local/bin/php' || 'C:\tools\php\php.exe') }}
# For debugging issues
- name: Archive test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-run-output-${{ matrix.php-version }}-${{ matrix.os }}
retention-days: 1
path: ./tests/output
analyse-php:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use php 8.0
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer:v2
- name: Cache module
uses: actions/cache@v3
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install phpstan
run: composer require --dev phpstan/phpstan
- name: Analyse files
run: ./vendor/bin/phpstan --memory-limit=2G