-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (88 loc) · 2.9 KB
/
php.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
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: "read"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# composer validation
composer:
name: "composer config validation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Validate composer.json"
run: "composer validate --strict"
# PHP lint and PHPStan for different PHP versions
php:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
name: "PHP ${{ matrix.php-version }}"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "xdebug"
- name: "check PHP version"
run: "php -v"
- name: "lint PHP files"
run: "php -l src/ tests/"
- name: "install composer dependencies"
run: "composer install --prefer-dist --no-progress --ignore-platform-reqs"
# PHPStan
- name: "PHPStan static analysis"
uses: "php-actions/phpstan@v3"
with:
php_version: "${{ matrix.php-version }}"
configuration: "phpstan.neon"
path: "src/ tests/"
# run unit tests
phpunit:
runs-on: "ubuntu-latest"
env:
CC_TEST_REPORTER_ID: "b55ff60ba178ed6d17d568f49e8c6034e54aee0cfaf765c317a8545aeafe1215"
name: "PHPUnit"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
coverage: "xdebug"
- name: "check PHP version"
run: "php -v"
- name: "install composer dependencies"
run: "composer install --prefer-dist --no-progress --ignore-platform-reqs"
- name: "CodeClimate reporter setup"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: "run PHPUnit"
run: |
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
./cc-test-reporter after-build -t clover --exit-code $?
codesniffer:
runs-on: "ubuntu-latest"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "Install PHP_CodeSniffer"
run: "curl -OLf https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar"
- name: "check PHP_CodeSniffer version"
run: "php phpcs.phar --version"
- name: "PHP CodeSniffer"
run: "php phpcs.phar"