Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:

test:

runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.experimental }}

strategy:
matrix:
include:
- mediawiki_version: '1.39'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:10"
coverage: false
experimental: false
- mediawiki_version: '1.40'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:11.2"
coverage: true
experimental: false
- mediawiki_version: '1.41'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:11.2"
coverage: false
experimental: false
- mediawiki_version: '1.42'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:11.2"
coverage: false
experimental: false
- mediawiki_version: '1.43'
smw_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:11.2"
coverage: false
experimental: false

env:
MW_VERSION: ${{ matrix.mediawiki_version }}
SMW_VERSION: ${{ matrix.smw_version }}
PHP_VERSION: ${{ matrix.php_version }}
DB_TYPE: ${{ matrix.database_type }}
DB_IMAGE: ${{ matrix.database_image }}


steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Update submodules
run: git submodule update --init --remote

- name: Run tests
run: make ci
if: matrix.coverage == false

- name: Run tests with coverage
run: make ci-coverage
if: matrix.coverage == true

- name: Upload code coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/php/coverage.xml
if: matrix.coverage == true
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/gesinn-it-pub/docker-compose-ci.git
44 changes: 44 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.Commenting.FunctionComment.NoParamType" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
<exclude name="MediaWiki.PHPUnit.AssertEmpty.AssertEmptyUsed" />
<exclude name="Squiz.Operators.ValidLogicalOperators.NotAllowed" />
<exclude name="Generic.ControlStructures.DisallowYodaConditions.Found" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.WrongStyle" />
<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
<exclude name="MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
</rule>
<rule ref="MediaWiki.NamingConventions.ValidGlobalName">
<properties>
<property name="allowedPrefixes" type="array" value="eg,wg" />
</properties>
</rule>
<rule ref="MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn">
<severity>0</severity>
</rule>
<file>.</file>
<exclude-pattern>/(vendor|conf)/</exclude-pattern>
<exclude-pattern type="relative">extensions/*</exclude-pattern>
<arg name="extensions" value="php"/>
<arg name="encoding" value="UTF-8"/>
</ruleset>
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-include .env
export

# setup for docker-compose-ci build directory
# delete "build" directory to update docker-compose-ci

ifeq (,$(wildcard ./build/))
$(shell git submodule update --init --remote)
endif

EXTENSION=SemanticExternalQueryLookup

# docker images
MW_VERSION?=1.39
PHP_VERSION?=8.1
DB_TYPE?=mysql
DB_IMAGE?="mariadb:10"

# extensions
SMW_VERSION?=dev-master

# composer
# Enables "composer update" inside of extension
COMPOSER_EXT?=true

# nodejs
# Enables node.js related tests and "npm install"
# NODE_JS?=true

# check for build dir and git submodule init if it does not exist
include build/Makefile

5 changes: 2 additions & 3 deletions SemanticExternalQueryLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ class SemanticExternalQueryLookup {
* @since 1.0
*/
public static function onExtensionFunction() {

define( 'SEQL_VERSION', '1.0.0-alpha' );
class_alias( 'SEQL\ByHttpRequestQueryLookup', 'SMWExternalQueryLookup' ); // deprecated
class_alias( 'SEQL\ByHttpRequestQueryLookup', 'SMWExternalAskQueryLookup' );

$options = array(
$options = [
'externalRepositoryEndpoints' => $GLOBALS['seqlgExternalRepositoryEndpoints']
);
];

$hookRegistry = new HookRegistry(
$options
Expand Down
1 change: 1 addition & 0 deletions build
Submodule build added at 13d00b
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixes:
- "/var/www/html/extensions/SemanticExternalQueryLookup/::"
54 changes: 38 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,55 @@
"source": "https://github.com/SemanticMediaWiki/SemanticExternalQueryLookup"
},
"require": {
"php": ">=5.3.0",
"composer/installers": "1.*,>=1.0.1",
"mediawiki/semantic-media-wiki": "~3.0",
"onoi/http-request": "~1.3"
"php": ">=8.1.0",
"composer/installers": ">=1.0.1",
"mediawiki/http-request": "~2.0|~1.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.1",
"phpmd/phpmd": "~2.1"
"mediawiki/mediawiki-codesniffer": "43.0.0",
"mediawiki/minus-x": "1.1.3",
"php-parallel-lint/php-console-highlighter": "1.0.0",
"php-parallel-lint/php-parallel-lint": "1.4.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"config": {
"process-timeout": 0
"process-timeout": 0,
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts":{
"phpunit": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist",
"cs": [
"vendor/bin/phpcs src/* tests/* --standard=phpcs.xml --extensions=php -sp",
"vendor/bin/phpmd src/,tests/ text phpmd.xml"
"test": [
"@analyze",
"@phpunit"
],
"test-coverage": [
"@analyze",
"@phpunit-coverage"
],
"analyze": [
"@lint",
"@phpcs",
"@minus-x"
],
"fix": [
"@phpcs-fix"
],
"phpunit": "php ${MW_INSTALL_PATH:-../..}/tests/phpunit/phpunit.php -c phpunit.xml.dist",
"phpunit-coverage": "php ${MW_INSTALL_PATH:-../..}/tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox --coverage-text --coverage-html coverage/php --coverage-clover coverage/php/coverage.xml",
"post-test-coverage": [
"sed -i 's|/var/www/html/extensions/SemanticResultFormats/||g' coverage/php/coverage.xml",
"find coverage/php -type f -name '*.html' -exec sed -i 's|/var/www/html/extensions/||g' {} +"
],
"ci": [
"composer validate --no-interaction",
"composer phpunit",
"composer cs"
]
"integration": "composer phpunit -- --testsuite=semantic-result-formats-integration",
"phpcs": "phpcs -ps -d memory_limit=2G",
"phpcs-fix": "phpcbf -p",
"lint": "parallel-lint . --exclude vendor --exclude node_modules --exclude extensions",
"minus-x": "minus-x check ."
}
}
10 changes: 6 additions & 4 deletions extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SemanticExternalQueryLookup",
"version": "1.0.0-alpha",
"version": "1.1.0-alpha",
"author": [
"James Hong Kong"
],
Expand All @@ -9,9 +9,9 @@
"license-name": "GPL-2.0-or-later",
"type": "semantic",
"requires": {
"MediaWiki": ">= 1.28",
"MediaWiki": ">= 1.39",
"extensions": {
"SemanticMediaWiki": ">= 3.0"
"SemanticMediaWiki": ">= 4.2"
}
},
"MessagesDirs": {
Expand All @@ -25,7 +25,9 @@
"AutoloadClasses": {
"SemanticExternalQueryLookup": "SemanticExternalQueryLookup.php"
},
"callback": "SemanticExternalQueryLookup::onExtensionFunction",
"ExtensionFunctions": [
"SemanticExternalQueryLookup::onExtensionFunction"
],
"config_prefix": "seqlg",
"config": {
"HttpResponseCacheLifetime": {
Expand Down
93 changes: 0 additions & 93 deletions phpcs.xml

This file was deleted.

Loading