Repository navigation
79 lines (69 loc) · 3.27 KB
/
Copy pathphp.yml
File metadata and controls
79 lines (69 loc) · 3.27 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
77
78
79
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']
include:
- php: '8.2'
dependencies: 'illuminate-12'
- php: '8.3'
dependencies: 'illuminate-13'
- php: '8.5'
dependencies: 'illuminate-13'
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 }}" == "illuminate-12" ]]; then
composer require --no-update --no-interaction --no-scripts illuminate/database:^12.0 illuminate/pagination:^12.0 illuminate/events:^12.0
composer update --prefer-dist --no-interaction --no-progress --no-scripts
elif [[ "${{ matrix.dependencies }}" == "illuminate-13" ]]; then
composer require --no-update --no-interaction --no-scripts illuminate/database:^13.0 illuminate/pagination:^13.0 illuminate/events:^13.0
composer update --prefer-dist --no-interaction --no-progress --no-scripts
elif [[ "${{ 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: Verify Illuminate dependency track
if: matrix.dependencies == 'illuminate-12' || matrix.dependencies == 'illuminate-13'
env:
EXPECTED_ILLUMINATE_MAJOR: ${{ matrix.dependencies == 'illuminate-12' && '12' || '13' }}
run: |
composer show illuminate/database --format=json | php -r '$package = json_decode(stream_get_contents(STDIN), true); $version = $package["versions"][0] ?? ""; if (!str_starts_with($version, "v" . $argv[1] . ".")) { fwrite(STDERR, "Unexpected Illuminate Database version: " . $version . "\n"); exit(1); }' "$EXPECTED_ILLUMINATE_MAJOR"
- 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