"Docker Compose" based CI and testing for MediaWiki extensions, built from mediawiki-ci images.
The docker-compose-ci repository is to be integrated into other repositories as a Git submodule. It uses "Make" as main entry point and command line interface. The Makefile
contained in this repository must be called up from a Makefile in the other repository.
Before docker-compose-ci can be used, the repository must be added as a git submodule to an existing repository:
git submodule add https://github.com/gesinn-it-pub/docker-compose-ci.git build
This is only necessary if it has not already been done.
After adding the submodule, cloning the repository with the --recursive
option is required from now on.
git clone --recursive <REPO>
If not done when cloning, it can be done by
git submodule init git submodule update
Ensure, you have Make
and Docker
installed.
make ci
Run all tests with more detailed output and coverage:
make ci-coverage
Run tests with parameters passed to composer commands, e.g. to run only certain testsuites or single tests
make ci COMPOSER_PARAMS="-- --testsuite=semantic-mediawiki-unit"
make ci COMPOSER_PARAMS="-- --filter SMWQueryProcessorTest"
After the tests have been executed, the containers continue to run in order to carry out analyses in the containers if necessary:
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8c8606f87631 semanticresultformats:test-1.35-4.1.3 "docker-php-entrypoi…" 25 minutes ago Up 25 minutes 80/tcp semanticresultformats-sqlite-wiki-1
Stop the containers:
make down
If you want to run specific targets, bash into the running container and run command runner targets as required:
make bash > composer phpcs > composer phpunit -- --filter='header-footer.json'
All you need to access the wiki is a docker-compose.override.yml
in the build
directory. docker-compose-ci configures the wiki for http://localhost:8080, so the override needs to look like this:
services: wiki: ports: - 8080:8080
Extensions usually required by other extensions are already included and can be used with versions specified by variables.
Extension | Variable |
---|---|
AdminLinks |
|
Chameleon |
|
DisplayTitle |
|
Maps |
|
Mermaid |
|
PageForms |
|
PageSchemas |
|
Lingo |
|
SemanticMediaWiki |
|
SemanticResultFormats |
|
Variable | Description |
---|---|
MW_VERSION |
|
PHP_EXTENSIONS |
List of PHP extensions to be installed |
OS_PACKAGES |
List of apt packages to be installed (needed for gd extension) |
PHP_VERSION |
|
DB_TYPE |
Database type (mysql, postgres, sqlite) |
DB_IMAGE |
Database Docker image (mysql and postgres only), for example |
EXTENSION |
The name of the extension being tested/CI’ed |
COMPOSER_EXT |
|
NODE_JS |
|
This is an example Makefile (taken from SemanticResultFormats):
-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=SemanticResultFormats
# docker images
MW_VERSION?=1.35
PHP_VERSION?=7.4
DB_TYPE?=sqlite
DB_IMAGE?=""
# extensions
SMW_VERSION?=4.1.3
PF_VERSION ?= 5.5.1
SFS_VERSION ?= 4.0.0-beta
MM_VERSION ?= 3.1.0
# 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