Repository navigation
84 lines (71 loc) · 3.29 KB
/
Copy pathbuild.yml
File metadata and controls
84 lines (71 loc) · 3.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
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
---
name: build
on:
push: ~
pull_request: ~
jobs:
linux_tests:
name: PHP on ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.flags }}
runs-on: ubuntu-22.04
strategy:
matrix:
php: ['8.1', '8.2', '8.3', '8.4', '8.5', '8.6', '8.7']
stability: [prefer-lowest, prefer-stable]
exclude:
- php: '8.7'
stability: prefer-lowest
include:
- php: '8.7'
stability: prefer-stable
flags: "--ignore-platform-req=php"
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
tools: composer:v2
- name: Check PHP Version
run: php -v
- name: Validate composer files
run: composer validate --strict
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.flags }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.flags }}-
${{ runner.os }}-composer-
# INSTALL logic
# 1. STABLE php + STABLE deps → composer install (NO updates)
- name: Install dependencies (install)
if: ${{ matrix.stability == 'prefer-stable' && matrix.php != '8.7' }}
run: composer install --prefer-dist --no-interaction --no-progress
# 2. prefer-lowest → must use composer update
- name: Install dependencies (prefer-lowest)
if: ${{ matrix.stability == 'prefer-lowest' }}
run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
# 3. PHP 8.6 dev → always update
- name: Install dependencies (nightly)
if: ${{ matrix.php == '8.7' }}
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
- name: Run Unit tests with coverage
if: ${{ matrix.php != '8.7' }}
run: composer phpunit
- name: Run Unit tests without coverage (nightly)
if: ${{ matrix.php == '8.7' }}
run: composer phpunit
continue-on-error: true
- name: Run static analysis
run: composer phpstan
if: ${{ matrix.php == '8.6' && matrix.stability == 'prefer-stable'}}
- name: Run Coding style rules
run: composer phpcs:fix
if: ${{ matrix.php == '8.5' && matrix.stability == 'prefer-stable'}}