-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.29 KB
/
php.yml
File metadata and controls
49 lines (41 loc) · 1.29 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
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, curl
coverage: none
- name: Validate composer.json
run: composer validate --strict --no-check-lock
- name: Install runtime dependencies
run: composer update --no-dev --prefer-dist --no-progress --no-interaction
- name: Lint PHP source
run: find src -name '*.php' -print0 | xargs -0 -n1 -P4 php -l
- name: Run tests
run: |
if [ -n "$(find tests -name '*Test.php' 2>/dev/null)" ]; then
composer update --prefer-dist --no-progress --no-interaction
config=phpunit.xml
[ -f phpunit.xml.dist ] && config=phpunit.xml.dist
[ -f tests/phpunit.xml ] && config=tests/phpunit.xml
echo "Running PHPUnit with $config"
vendor/bin/phpunit -c "$config"
else
echo "No test files under tests/, skipping PHPUnit"
fi