-
Notifications
You must be signed in to change notification settings - Fork 6
102 lines (79 loc) · 2.87 KB
/
lint.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: "Lint"
#
# Based on workflows from Composer:
#
# * https://github.com/composer/composer/blob/2.5.4/.github/workflows/lint.yml
# * https://github.com/composer/composer/blob/2.5.4/.github/workflows/phpstan.yml
#
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
pull_request:
tags-ignore:
- '**'
env:
COMPOSER_FLAGS: "--ansi --no-interaction --prefer-dist"
SYMFONY_PHPUNIT_VERSION: ""
permissions:
contents: read
jobs:
validation:
name: "Composer Validation"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
php-version: "latest"
- name: "Install dependencies from composer.lock"
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Validate composer.json"
run: "composer validate --strict"
lint:
name: "Lint"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.2"
- "8.3"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl, zip"
ini-values: "memory_limit=-1, error_reporting=E_ALL, display_errors=On"
php-version: "${{ matrix.php-version }}"
tools: cs2pr, phpstan, phpunit-bridge
- name: Retrieve Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache dependencies installed with Composer"
uses: "actions/cache@v4"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}"
- name: "Update dependencies from composer.json"
if: "matrix.experimental == true"
run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}"
- name: "Install dependencies from composer.lock"
if: "matrix.experimental == false"
run: "composer config platform --unset && composer install ${{ env.COMPOSER_FLAGS }}"
- name: Install PHPUnit
run: "simple-phpunit install"
- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
- name: "Run PHPStan"
run: "phpstan analyse --error-format=checkstyle | cs2pr"