Skip to content

Commit c1202f2

Browse files
committed
Add CI
1 parent caeaa03 commit c1202f2

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
EXTNAME: CrawlerProtection
11+
MW_INSTALL_PATH: ${{ github.workspace }}
12+
13+
jobs:
14+
style:
15+
name: Code Style
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ ubuntu-latest ]
21+
php: [ '8.2', '8.3', '8.4' ]
22+
mediawiki: [ REL1_43 ]
23+
include:
24+
- php: '7.4'
25+
mediawiki: REL1_35
26+
- php: '7.4'
27+
mediawiki: REL1_39
28+
- php: '8.2'
29+
mediawiki: REL1_39
30+
steps:
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php }}
35+
extensions: mbstring, intl
36+
coverage: none
37+
tools: composer
38+
- name: Setup MediaWiki
39+
uses: actions/checkout@v4
40+
with:
41+
repository: wikimedia/mediawiki
42+
ref: ${{ matrix.mediawiki }}
43+
- name: Setup Extension
44+
uses: actions/checkout@v4
45+
with:
46+
path: extensions/${{ env.EXTNAME }}
47+
- name: Setup Composer
48+
run: |
49+
echo '{"extra":{"merge-plugin":{"include":["extensions/*/composer.json","skins/*/composer.json"]}}}' > composer.local.json
50+
composer update
51+
composer update
52+
- name: Lint
53+
run: ./vendor/bin/parallel-lint --exclude node_modules --exclude vendor extensions/${{ env.EXTNAME }}
54+
- name: PHP Code Sniffer
55+
run: ./vendor/bin/phpcs -sp --standard=vendor/mediawiki/mediawiki-codesniffer/MediaWiki extensions/${{ env.EXTNAME }}
56+
57+
security:
58+
name: Static Analysis
59+
runs-on: ${{ matrix.os }}
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
os: [ ubuntu-latest ]
64+
# 1.43 phan is broken on php 8.4
65+
php: [ '8.2', '8.3' ]
66+
mediawiki: [ REL1_43 ]
67+
include:
68+
- php: '7.4'
69+
mediawiki: REL1_35
70+
- php: '7.4'
71+
mediawiki: REL1_39
72+
- php: '8.2'
73+
mediawiki: REL1_39
74+
steps:
75+
- name: Setup PHP
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: ${{ matrix.php }}
79+
extensions: mbstring, intl, ast
80+
coverage: none
81+
tools: composer
82+
- name: Setup MediaWiki
83+
uses: actions/checkout@v4
84+
with:
85+
repository: wikimedia/mediawiki
86+
ref: ${{ matrix.mediawiki }}
87+
- name: Setup Extension
88+
uses: actions/checkout@v4
89+
with:
90+
path: extensions/${{ env.EXTNAME }}
91+
- name: Setup Composer
92+
run: |
93+
echo '{"extra":{"merge-plugin":{"include":["extensions/*/composer.json","skins/*/composer.json"]}}}' > composer.local.json
94+
composer update
95+
composer update
96+
- name: Phan
97+
run: ./vendor/bin/phan -d extensions/${{ env.EXTNAME }} --minimum-target-php-version=7.4 --long-progress-bar

.phan/config.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
// use phan config shipped with mediawiki core
4+
$cfg = require __DIR__ . '/../../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
5+
6+
// we suppress things for backwards compat reasons, so suppressions may not apply to all phan test runs
7+
// as part of dropping support for old versions, old suppressions will be removed
8+
$cfg['suppress_issue_types'][] = 'UnusedSuppression';
9+
$cfg['suppress_issue_types'][] = 'UnusedPluginSuppression';
10+
11+
return $cfg;

0 commit comments

Comments
 (0)