-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (105 loc) · 3.19 KB
/
Copy pathworkflow-v2.yml
File metadata and controls
113 lines (105 loc) · 3.19 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Workflow for Joomla Framework v2
on:
workflow_call:
jobs:
composer:
name: Install PHP dependencies
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-php
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Install PHP dependencies
if: steps.cache-php.outputs.cache-hit != 'true'
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
composer config --global home
composer install --no-progress --ignore-platform-reqs --prefer-stable
composer require phpmd/phpmd phpstan/phpstan
code-style-php:
name: Check PHP code style
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
needs: [composer]
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Check PHP code style
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: ./vendor/bin/phpcs --standard=ruleset.xml src/
phpstan:
name: Run PHPstan
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.4
needs: [code-style-php]
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Run PHPstan
run: |
./vendor/bin/phpstan --error-format=github || :
phploc:
name: Run PHPloc
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
needs: [code-style-php]
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Run PHPloc
run: |
./vendor/bin/phploc src
phpcpd:
name: Run phpcpd
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php8.1
needs: [code-style-php]
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
- name: Run phpcpd
run: |
./vendor/bin/phpcpd src
tests-unit-lowest:
name: Run Unit tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php7.2
needs: [code-style-php]
steps:
- uses: actions/checkout@v4
- name: Run Unit tests
run: |
composer install --prefer-stable --prefer-lowest
./vendor/bin/phpunit
tests-unit:
name: Run Unit tests
runs-on: ubuntu-latest
container: joomlaprojects/docker-images:php${{ matrix.php_version }}
needs: [code-style-php]
strategy:
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
steps:
- uses: actions/checkout@v4
- name: Run Unit tests
run: |
composer install
./vendor/bin/phpunit