-
Notifications
You must be signed in to change notification settings - Fork 100
202 lines (177 loc) · 5.53 KB
/
Copy pathci.yml
File metadata and controls
202 lines (177 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: 🔍 CI
on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- "main"
paths-ignore:
- "docs/**"
pull_request:
branches:
- "**"
- "!dependabot/**"
- "!release-please--branches--**"
paths-ignore:
- "docs/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: 🤔 Detect changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php_any_changed }}
script: ${{ steps.filter.outputs.script_any_changed }}
stylesheet: ${{ steps.filter.outputs.stylesheet_any_changed }}
i18n: ${{ steps.filter.outputs.i18n_any_changed }}
steps:
- uses: actions/checkout@v6
- uses: tj-actions/changed-files@v47
id: filter
with:
files_yaml: |
php:
- includes/**/*.php
- tests/**/*.php
- skin.json
- composer.json
- composer.lock
- .github/workflows/ci.yml
script:
- resources/**/*.js
- package.json
- package-lock.json
- .eslintrc.json
stylesheet:
- resources/**/*.css
- resources/**/*.less
- skinStyles/**/*.css
- skinStyles/**/*.less
- package.json
- package-lock.json
i18n:
- i18n/*.json
- package.json
- package-lock.json
lint:
name: 🩹 Lint
needs: changes
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Cache dependencies
uses: actions/cache@v5
with:
path: /home/runner/cache
key: ${{ runner.os }}-${{ hashFiles('**/*.lock') }}
- name: Install PHP dependencies
if: needs.changes.outputs.php == 'true'
run: |
composer validate
composer install --prefer-dist --no-progress
- name: Install Node dependencies
if: needs.changes.outputs.script == 'true' || needs.changes.outputs.stylesheet == 'true' || needs.changes.outputs.i18n == 'true'
run: npm ci
- name: Lint PHP
if: needs.changes.outputs.php == 'true'
run: |
composer test
- name: Lint script
if: needs.changes.outputs.script == 'true'
run: |
npm run lint:js
- name: Lint stylesheet
if: needs.changes.outputs.stylesheet == 'true'
run: |
npm run lint:styles
- name: Lint i18n
if: needs.changes.outputs.i18n == 'true'
run: |
npm run lint:i18n
test-php:
name: "🧪 Test PHP (MW ${{ matrix.mw }}, PHP ${{ matrix.php }})"
needs: changes
if: needs.changes.outputs.php == 'true' || github.event_name == 'schedule'
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 30
strategy:
matrix:
include:
- mw: "REL1_43"
php: 8.2
coverage: xdebug
experimental: false
- mw: "REL1_44"
php: 8.3
coverage: none
experimental: false
- mw: "REL1_45"
php: 8.4
coverage: none
experimental: false
- mw: "master"
php: 8.5
coverage: none
experimental: true
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}
extensions: mbstring, intl
tools: composer
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v5
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/skins/
!mediawiki/vendor/
mediawiki/phpunit.xml.dist
key: mw_${{ matrix.mw }}-php${{ matrix.php }}-v27
- name: Cache Composer cache
uses: actions/cache@v5
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}
- uses: actions/checkout@v6
with:
path: EarlyCopy
- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installWiki.sh ${{ matrix.mw }}
- uses: actions/checkout@v6
with:
path: mediawiki/skins/Citizen
fetch-depth: 0
- name: Install dependencies with Composer
run: composer update --no-ansi --no-interaction --no-progress
- name: Run tests with PHPUnit
if: ${{ matrix.coverage == 'none' }}
run: composer phpunit:entrypoint -- skins/Citizen
- name: Run tests with PHPUnit with coverage
if: ${{ matrix.coverage == 'xdebug' }}
run: |
composer phpunit:coverage-edit -- skins/Citizen
XDEBUG_MODE=coverage composer phpunit -- --testsuite skins --coverage-clover skins/Citizen/coverage/php/coverage.xml skins/Citizen/tests/phpunit --exclude-group Stub
- name: Scan with SonarQube
uses: sonarsource/sonarqube-scan-action@v7
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Only one once
if: ${{ matrix.coverage == 'xdebug' && env.SONAR_TOKEN != '' }}
with:
projectBaseDir: mediawiki/skins/Citizen