Repository navigation
59 lines (50 loc) · 1.86 KB
/
Copy pathphp.yml
File metadata and controls
59 lines (50 loc) · 1.86 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
name: PHP package checks
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
jobs:
verify:
name: PHP ${{ matrix.php }} / dependencies ${{ matrix.dependencies }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.5']
dependencies: ['latest', 'lowest']
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2.40.0
with:
php-version: ${{ matrix.php }}
extensions: curl, intl, mbstring, pdo_sqlite
tools: composer:v2
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage: none
- name: Validate Composer manifest
run: composer validate --strict --no-check-publish --no-interaction
- name: Install dependencies
run: |
if [[ "${{ matrix.dependencies }}" == "lowest" ]]; then
composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction --no-progress --no-scripts
else
composer update --prefer-dist --no-interaction --no-progress --no-scripts
fi
- name: Audit dependencies
run: composer audit --no-interaction
- name: Check PHP syntax
run: find . -path './vendor' -prune -o -path './.git' -prune -o -name '*.php' -type f -print0 | xargs -0 -n1 php -l
- name: Run declared tests
shell: bash
run: |
if php -r '$composer = json_decode(file_get_contents("composer.json"), true); exit(isset($composer["scripts"]["test"]) ? 0 : 1);'; then
composer test --no-interaction
else
echo 'No test script is declared for this package.'
fi