Skip to content

gesinn-it-pub/docker-compose-ci

Repository files navigation

docker-compose-ci

"Docker Compose" based CI and testing for MediaWiki extensions, built from mediawiki-ci images.

Usage

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.

Add submodule

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.

Init submodule

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

Update submodule

git submodule update --init --remote

Run tests locally

Ensure, you have Make and Docker installed.

make ci

Run all tests with more detailed output and coverage:

make ci-coverage

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

Currently supported required extensions

Extensions usually required by other extensions are already included and can be used with versions specified by variables.

Table 1. Supported required extensions
Extension Variable

AdminLinks

AL_VERSION

Chameleon

CHAMELEON_VERSION

DisplayTitle

DT_VERSION

Maps

MAPS_VERSION

Mermaid

MM_VERSION

PageForms

PF_VERSION, PF_REPO (alternate repo URL)

PageSchemas

PS_VERSION

SemanticMediaWiki

SMW_VERSION

SemanticResultFormats

SRF_VERSION

Other variables

Variable Description

MW_VERSION

Docker image MediaWiki Version

PHP_VERSION

Docker image PHP Version

DB_TYPE

Database type (mysql, postgres, sqlite)

DB_IMAGE

Database Docker image (mysql and postgres only), for example mysql:5

EXTENSION

The name of the extension being tested/CI’ed

COMPOSER_EXT

true or false. Enables "composer update" inside of extension.

NODE_JS

true or false. Enables node.js related tests and "npm install"

Example Makefile

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

About

Docker compose based CI for mediawiki extensions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •