Skip to content

Commit 5a4ee90

Browse files
authored
Merge pull request #15 from gesinn-it-pub/master
Modernizing towards MW 1.37
2 parents ffcc192 + 1945b9d commit 5a4ee90

16 files changed

+1137
-153
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
12+
ci:
13+
14+
runs-on: ubuntu-20.04
15+
continue-on-error: ${{ matrix.experimental }}
16+
17+
strategy:
18+
matrix:
19+
include:
20+
- mediawiki_version: '1.35'
21+
experimental: false
22+
- mediawiki_version: '1.36'
23+
experimental: true
24+
- mediawiki_version: '1.37'
25+
experimental: true
26+
27+
env:
28+
MW_VERSION: ${{ matrix.mediawiki_version }}
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
- run: make ci

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor
2+
coverage
3+
.phpunit.result.cache
4+
.vscode

.phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
4+
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
5+
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
6+
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
7+
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
8+
<exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" />
9+
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
10+
<exclude name="MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix" />
11+
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
12+
</rule>
13+
<file>.</file>
14+
<arg name="bootstrap" value="./vendor/mediawiki/mediawiki-codesniffer/utils/bootstrap-ci.php"/>
15+
<arg name="extensions" value="php"/>
16+
<arg name="encoding" value="UTF-8"/>
17+
</ruleset>

AutoCreatePage.i18n.magic.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
/**
44
* Magic words
5-
*
5+
*
66
* @file
77
*/
88

9-
$magicWords = array();
9+
$magicWords = [];
1010

1111
/** English (English) */
12-
$magicWords['en'] = array(
13-
'createPage' => array( 0, 'createpageifnotex' ),
14-
);
12+
$magicWords['en'] = [
13+
'createPage' => [ 0, 'createpageifnotex' ],
14+
];

AutoCreatePage.php

Lines changed: 0 additions & 148 deletions
This file was deleted.

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG MW_VERSION=1.35
2+
FROM gesinn/docker-mediawiki-sqlite:${MW_VERSION}
3+
4+
ENV EXTENSION=AutoCreatePage
5+
COPY composer*.json /var/www/html/extensions/$EXTENSION/
6+
7+
RUN cd extensions/$EXTENSION && \
8+
composer update
9+
10+
COPY . /var/www/html/extensions/$EXTENSION
11+
12+
RUN sed -i s/80/8080/g /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf && \
13+
echo \
14+
"wfLoadExtension( '$EXTENSION' );\n" \
15+
>> LocalSettings.php

Makefile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
EXTENSION := AutoCreatePage
2+
3+
MW_VERSION ?= 1.35
4+
5+
EXTENSION_FOLDER := /var/www/html/extensions/$(EXTENSION)
6+
IMAGE_NAME := $(shell echo $(EXTENSION) | tr A-Z a-z}):test-$(MW_VERSION)
7+
PWD := $(shell bash -c "pwd -W 2>/dev/null || pwd")# this way it works on Windows and Linux
8+
DOCKER_RUN_ARGS := --rm -v $(PWD)/coverage:$(EXTENSION_FOLDER)/coverage -w $(EXTENSION_FOLDER) $(IMAGE_NAME)
9+
docker_run := docker run $(DOCKER_RUN_ARGS)
10+
11+
.PHONY: all
12+
all:
13+
14+
# ======== CI ========
15+
16+
.PHONY: ci
17+
ci: build test
18+
19+
.PHONY: ci-coverage
20+
ci-coverage: build test-coverage
21+
22+
.PHONY: build
23+
build:
24+
docker build --tag $(IMAGE_NAME) \
25+
--build-arg=MW_VERSION=$(MW_VERSION) \
26+
.
27+
28+
.PHONY: test
29+
test: composer-test
30+
31+
.PHONY: test-coverage
32+
test-coverage: composer-test-coverage
33+
34+
.PHONY: composer-test
35+
composer-test:
36+
$(docker_run) composer test
37+
38+
.PHONY: composer-test-coverage
39+
composer-test-coverage:
40+
$(docker_run) composer test-coverage
41+
42+
.PHONY: bash
43+
bash:
44+
docker run -it -v $(PWD):/src $(DOCKER_RUN_ARGS) bash
45+
46+
.PHONY: dev-bash
47+
dev-bash:
48+
docker run -it --rm -p 8080:8080 \
49+
-v $(PWD):$(EXTENSION_FOLDER) \
50+
-v $(EXTENSION_FOLDER)/vendor/ \
51+
-w $(EXTENSION_FOLDER) $(IMAGE_NAME) bash -c 'service apache2 start && bash'

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"require-dev": {
3+
"mediawiki/mediawiki-codesniffer": "39.0.0",
4+
"php-parallel-lint/php-console-highlighter": "1.0.0",
5+
"php-parallel-lint/php-parallel-lint": "1.3.2",
6+
"phpstan/phpstan": "^1.7"
7+
},
8+
"scripts": {
9+
"test": [
10+
"@analyze",
11+
"@phpunit"
12+
],
13+
"test-coverage": [
14+
"@analyze",
15+
"@phpunit-coverage"
16+
],
17+
"analyze": [
18+
"@lint",
19+
"@phpcs",
20+
"@phpstan"
21+
],
22+
"lint": "parallel-lint . --exclude vendor",
23+
"phpcs": "phpcs -p -s .",
24+
"phpcs-fix": "phpcbf .",
25+
"phpstan": "phpstan analyse --configuration=phpstan.neon --memory-limit=2G",
26+
"phpstan-baseline": "phpstan analyse --configuration=phpstan.neon --memory-limit=2G --generate-baseline",
27+
"phpunit": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox",
28+
"phpunit-coverage": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox --coverage-text --coverage-html coverage/php --coverage-clover coverage/php/coverage.xml"
29+
}
30+
}

0 commit comments

Comments
 (0)