-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (69 loc) · 2.4 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
name: "PHP Workflow"
on:
workflow_dispatch:
pull_request:
paths: [ "**.php" ]
branches: ["main"]
push:
paths: ["**.php"]
branches: ["main"]
env:
PHP_CS_FIXER_IGNORE_ENV: 1
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --ignore-platform-req=php"
jobs:
php-code-checks:
name: "PHP Code Quality Checks"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
dependencies:
- "locked"
- "highest"
- "lowest"
php-version:
- "8.1"
- "8.2"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout Code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: "Cache Dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
# Our code should work with the highest possible dependencies
- name: "Install Highest Dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update ${{ env.COMPOSER_FLAGS }}"
# Our code should work with the lowest possible dependencies
- name: "Install Lowest Dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest ${{ env.COMPOSER_FLAGS }}"
# Our code should work with the locked dependencies
- name: "Install Locked Dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install ${{ env.COMPOSER_FLAGS }}"
# We only run code style checker on locked
- name: "Run Code Style Checker"
run: "vendor/bin/php-cs-fixer fix --dry-run -v"
if: ${{ matrix.dependencies == 'locked' }}
# We only run static analysis on locked
- name: "Run Static Analysis"
if: ${{ matrix.dependencies == 'locked' }}
run: "vendor/bin/psalm --shepherd --stats"
# We always run the test suite
- name: "Run Test Suite"
run: "vendor/bin/phpunit"
continue-on-error: ${{ matrix.dependencies == 'lowest' }}