-
Notifications
You must be signed in to change notification settings - Fork 14
76 lines (61 loc) · 2.19 KB
/
ci.yml
File metadata and controls
76 lines (61 loc) · 2.19 KB
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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
container:
image: php:${{ matrix.php-version }}-cli
name: PHP ${{ matrix.php-version }} Tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update
apt-get install -y git zip unzip libzip-dev \
libpng-dev libjpeg62-turbo-dev libfreetype6-dev
docker-php-ext-install zip
docker-php-ext-configure gd --with-freetype --with-jpeg
docker-php-ext-install gd
- name: Install Composer
run: |
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- name: Install Xdebug (for coverage)
if: matrix.php-version == '8.3'
run: |
pecl install xdebug
docker-php-ext-enable xdebug
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: vendor/bin/phpunit
- name: Generate coverage report
if: matrix.php-version == '8.3'
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Upload coverage to Coveralls
if: matrix.php-version == '8.3' && github.event_name == 'push'
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
export PATH="$HOME/.composer/vendor/bin:$PATH"
php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v || echo "Coverage upload failed, continuing..."