-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (163 loc) · 5.53 KB
/
php-codestyle.yml
File metadata and controls
181 lines (163 loc) · 5.53 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
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
on:
workflow_call:
inputs:
app-name:
description: 'Name of the app'
required: true
type: string
php-versions:
description: JSON array of PHP versions
required: true
type: string
core-ref:
description: 'git reference to checkout for core'
required: false
type: string
default: ''
core-ref-php74:
description: 'git reference to checkout for core if PHP 7.4 is used'
required: false
type: string
default: ''
app-repository:
description: 'Repository of the app (optional, defaults to the current repository)'
required: false
type: string
default: ''
disable-phpstan:
description: 'Whether to disable PHPStan checks'
required: false
type: boolean
default: false
disable-phan:
description: 'Whether to disable Phan checks'
required: false
type: boolean
default: false
additional-app:
description: 'Additional app to enable for testing'
required: false
type: string
default: ''
additional-app-github-token:
description: 'GitHub PAT to access the additional app repo - required if private'
required: false
type: string
default: ''
additional-packages:
description: Additional Linux packages to be installed - space separated
required: false
type: string
default: ''
permissions:
contents: read
jobs:
php-codestyle:
name: PHP Code Style
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: true
matrix:
php: ${{ fromJSON(inputs.php-versions) }}
steps:
- name: Validate app-repository
if: ${{ inputs.app-repository != '' }}
env:
APP_REPO: ${{ inputs.app-repository }}
run: |
if ! echo "$APP_REPO" | grep -qE '^owncloud/[a-zA-Z0-9._-]+$'; then
echo "Error: app-repository must be within the owncloud/ namespace, got: $APP_REPO"
exit 1
fi
- name: Clone owncloud/core
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: owncloud/core
ref: ${{ case(matrix.php == '7.4', inputs.core-ref-php74, inputs.core-ref) }}
- name: Checkout apps/${{ inputs.app-name }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: apps/${{ inputs.app-name }}
repository: ${{ inputs.app-repository }}
- name: Checkout apps/${{ inputs.additional-app }}
if: ${{ inputs.additional-app != '' }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: apps/${{ inputs.additional-app }}
repository: owncloud/${{ inputs.additional-app }}
token: ${{ inputs.additional-app-github-token || github.token }}
- name: Install Linux packages
if: ${{ inputs.additional-packages }}
env:
ADDITIONAL_PACKAGES: ${{ inputs.additional-packages }}
run: |
sudo apt-get install $ADDITIONAL_PACKAGES
- name: Setup PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2.37.1
with:
php-version: ${{ matrix.php }}
extensions: apcu, ctype, curl, exif, fileinfo, gd, iconv, imagick, intl, json, mbstring, memcached, pdo, posix, simplexml, xml, zip, smbclient, ldap, krb5
ini-values: "memory_limit=1024M"
env:
fail-fast: true
KRB5_LINUX_LIBS: libkrb5-dev
- name: Install Core Dependencies
run: |
make
- name: Install Server
env:
DATA_DIRECTORY: ${{ github.workspace }}/data
DB_TYPE: "sqlite"
DB_NAME: owncloud
ADMIN_LOGIN: admin
ADMIN_PASSWORD: admin
run: |
install_cmd="maintenance:install -vvv \
--database=${DB_TYPE} \
--database-name=${DB_NAME} \
--admin-user=${ADMIN_LOGIN} \
--admin-pass=${ADMIN_PASSWORD} \
--data-dir=${DATA_DIRECTORY} "
php occ ${install_cmd}
echo "enabling apps"
php occ app:enable files_sharing
php occ app:enable files_trashbin
php occ app:enable files_versions
php occ app:enable provisioning_api
php occ app:enable federation
php occ app:enable federatedfilesharing
- name: Setup additional app
if: ${{ inputs.additional-app != '' }}
env:
ADDITIONAL_APP: ${{ inputs.additional-app }}
run: |
( cd "apps/${ADDITIONAL_APP}" && make vendor || true)
php occ a:e "${ADDITIONAL_APP}"
- name: Setup app
env:
APP_NAME: ${{ inputs.app-name }}
run: |
( cd "apps/${APP_NAME}" && make vendor || true)
php occ a:e "${APP_NAME}"
- name: Run PHP Code Style Checks
env:
APP_NAME: ${{ inputs.app-name }}
run: |
cd "apps/${APP_NAME}"
make test-php-style
- name: Run PHP Stan
if: ${{ !inputs.disable-phpstan }}
env:
APP_NAME: ${{ inputs.app-name }}
run: |
cd "apps/${APP_NAME}"
make test-php-phpstan
- name: Run PHP Phan
if: ${{ !inputs.disable-phan }}
env:
APP_NAME: ${{ inputs.app-name }}
run: |
cd "apps/${APP_NAME}"
make test-php-phan