-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (93 loc) · 3.68 KB
/
Copy pathstatic-analysis.yml
File metadata and controls
104 lines (93 loc) · 3.68 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
name: Static analysis
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
phpstan:
name: Larastan code analysis [PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
#php: [ '8.0', 8.1 ]
php: [8.3]
#dependency-version: [ prefer-lowest, prefer-stable ]
dependency-version: [ prefer-stable ]
services: # Service container Mysql
mysql: # Label used to access the service container
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: hoomdossier_test
ports:
#- 33306:3306
- 3306:3306
options: >- # Set health checks to wait until mysql database has started (it takes some seconds to start)
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Verify hoomdossier_test database exists
run: mysql --host 127.0.0.1 --port 3306 -uroot -e "SHOW DATABASES LIKE 'hoomdossier_test';"
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl
coverage: none
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.actions', '.env.testing'); copy('.env.actions', '.env');" # If .env exist, we use that, if otherwise, copy .env.example to .env and use that instead
- name: Run composer install
run: composer install --prefer-dist
- name: Run larastan (PHPStan) - Static code analysis
run: ./vendor/bin/phpstan analyse --memory-limit=2G
phpcs:
name: PHPcs PSR check [PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
#php: [ '8.0', 8.1 ]
php: [8.3]
#dependency-version: [ prefer-lowest, prefer-stable ]
dependency-version: [ prefer-stable ]
services: # Service container Mysql
mysql: # Label used to access the service container
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: hoomdossier_test
ports:
#- 33306:3306
- 3306:3306
options: >- # Set health checks to wait until mysql database has started (it takes some seconds to start)
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Verify hoomdossier_test database exists
run: mysql --host 127.0.0.1 --port 3306 -uroot -e "SHOW DATABASES LIKE 'hoomdossier_test';"
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl
coverage: none
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.actions', '.env.testing'); copy('.env.actions', '.env');" # If .env exist, we use that, if otherwise, copy .env.example to .env and use that instead
- name: Run composer install
run: composer install --prefer-dist
- name: Run phpcs - PSR2 check
# run: ./vendor/bin/phpcs --standard=phpcs.xml app # Run with warnings > This will still trigger failure
run: ./vendor/bin/phpcs --standard=phpcs.xml app -n # To run errors only
# run: ./vendor/bin/phpcs --standard=PSR2 app