Repository navigation
81 lines (65 loc) · 2.97 KB
/
Copy pathci.yml
File metadata and controls
81 lines (65 loc) · 2.97 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
quality:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, ctype, curl, dom, gd, iconv, intl, json, mbstring, openssl, pdo_mysql, simplexml, soap, sockets, sodium, xsl, zip
coverage: none
tools: composer:v2
- name: Validate composer.json
run: composer validate --strict --no-check-version
# magento/* packages are not on Packagist. The Mage-OS mirror serves
# them publicly with the same version numbers. canonical=false lets
# Composer still take newer versions of other packages from Packagist.
- name: Add Magento package mirror
run: composer config repositories.mage-os '{"type":"composer","url":"https://mirror.mage-os.org/","canonical":false}'
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-interaction
# phpcodesniffer-composer-installer registers Magento2 automatically.
# This step only makes the registration visible in the log.
- name: Show installed coding standards
run: vendor/bin/phpcs -i
- name: Lint PHP
run: find . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n1 -P4 php -l
- name: Magento coding standard
run: vendor/bin/phpcs -n --standard=Magento2 --extensions=php,phtml --ignore='vendor/*' .
- name: Unit tests
run: vendor/bin/phpunit --configuration phpunit.xml
# PHPStan runs once, on one PHP version, as in the Mage-OS modules
# (mage-os-lab/module-blog). bitexpert/phpstan-magento generates the Magento
# factory classes during analysis, so no stub files are needed.
# PHP 8.2 on purpose: on PHP 8.3+ PHPStan loads its "turbo" extension, whose
# shared cache breaks the factory generator in bitexpert/phpstan-magento
# 0.43 ("Failed opening required '<?php ..."). The fix is merged upstream
# (0.44.0) but not tagged yet; move this job to 8.3 once it is released.
static:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: bcmath, ctype, curl, dom, gd, iconv, intl, json, mbstring, openssl, pdo_mysql, simplexml, soap, sockets, sodium, xsl, zip
coverage: none
tools: composer:v2
- name: Add Magento package mirror
run: composer config repositories.mage-os '{"type":"composer","url":"https://mirror.mage-os.org/","canonical":false}'
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-interaction
- name: PHPStan
run: vendor/bin/phpstan analyse --memory-limit=1G --no-progress