-
-
Notifications
You must be signed in to change notification settings - Fork 169
212 lines (178 loc) · 6.86 KB
/
phpstan.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Static Code Analysis
on:
push:
paths-ignore:
- "doc/**"
- "mddoc/**"
- "res/**"
- "website/**"
- ".markdownlint.json"
- "README.md"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
swoole-docker: [php8.1-swoole-5.0]
env:
REPOSITORY_OWNER: ${{ github.repository_owner }}
IMAGE_VERSION: ${{ matrix.swoole-docker }}
ENV_SERVICE: swoole-only
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare1
run: |
echo "REPOSITORY_OWNER=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
mkdir -p /tmp/base_cache/composer
mkdir -p /tmp/base_cache/phpstan
- name: Cache dependencies
uses: actions/cache@v4
with:
path: /tmp/base_cache/composer
key: ${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}-
${{ runner.os }}-composer-
- name: Cache phpstan
uses: actions/cache@v4
if: ${{ false }}
with:
path: /tmp/base_cache/phpstan
key: ${{ runner.os }}-phpstan-v2-${{ env.IMAGE_VERSION }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-phpstan-v2-${{ env.IMAGE_VERSION }}-
- name: Recover All composer.lock
run: |
[ -f /tmp/base_cache/phpstan/composer_lock.zip ] && unzip /tmp/base_cache/phpstan/composer_lock.zip -d "${GITHUB_WORKSPACE}" || echo "No composer_lock.zip" || true
- name: Prepare2
run: |
echo "::group::Env prepare"
docker compose -f ./.github/docker-compose.yml up -d ${ENV_SERVICE}
echo "::endgroup::"
echo "::group::Env info"
docker exec ${ENV_SERVICE} php -v
docker exec ${ENV_SERVICE} php -m
docker exec ${ENV_SERVICE} php --ri swoole
docker exec ${ENV_SERVICE} composer -V
echo "::endgroup::"
echo "::group::Composer install"
docker exec ${ENV_SERVICE} composer config --global cache-files-dir /tmp/base_cache/composer
docker exec ${ENV_SERVICE} composer update --no-interaction --prefer-dist --no-progress
docker exec ${ENV_SERVICE} bash -c "cd split-repository && composer install --no-interaction --prefer-dist --no-progress"
echo "::endgroup::"
echo "test_prepared=1" >> $GITHUB_ENV
- name: Analyse core
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh core
- name: Analyse amqp
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh amqp
- name: Analyse apidoc
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh apidoc
- name: Analyse fpm
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh fpm
- name: Analyse grpc
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh grpc
- name: Analyse jwt
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh jwt
- name: Analyse kafka
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh kafka
- name: Analyse mqtt
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh mqtt
- name: Analyse pgsql
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh pgsql
- name: Analyse queue
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh queue
- name: Analyse rate-limit
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh rate-limit
- name: Analyse roadrunner
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh roadrunner
- name: Analyse rpc
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh rpc
- name: Analyse shared-memory
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh shared-memory
- name: Analyse smarty
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh smarty
- name: Analyse snowflake
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh snowflake
- name: Analyse swoole
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh swoole
- name: Analyse swoole-tracker
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh swoole-tracker
- name: Analyse workerman
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh workerman
- name: Analyse workerman-gateway
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh workerman-gateway
- name: Analyse phar
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh phar
- name: Analyse connection-center
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh connection-center
- name: Analyse database
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh database
- name: Analyse model
if: ${{ env.test_prepared && always() }}
run: |
docker exec ${ENV_SERVICE} ./dev/phpstan.sh model
- name: Save All composer.lock And autoloader-suffix
if: ${{ env.test_prepared && always() }}
run: |
cd "${GITHUB_WORKSPACE}"
find . -type f \( -name "composer.lock" -o -wholename "*/vendor/autoload.php" \) -exec zip /tmp/base_cache/phpstan/composer_lock.zip {} +
- name: Upload cache files (debug)
if: ${{ false }}
uses: actions/upload-artifact@v3
with:
name: phpstan-cache
path: |
/tmp/base_cache/phpstan
!/tmp/base_cache/phpstan/cache/PHPStan/