Semantic MediaWiki/contributing

From Freephile Wiki
Revision as of 08:38, 30 October 2025 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is a parallel to Developer cheat sheet for contributing to MediaWiki, for SMW.

Refer to the project's own Contributing to Semantic MediaWiki for the big picture perspective.

Developer Cheat sheet[edit]

Semantic MediaWiki extensions have all largely adopted the Gesinn IT Docker-based continuous integration approach to development. There are many good reasons for this, chief among them is that it allows you to setup a complete (integrated) environment along with all the code, dependencies, tooling and conventions for developing, debugging, testing and contributing enhancements. Case in point: dependencies. There are JavaScript dependencies defined in package.json, PHP (and development) dependencies defined in composer.json, and Extension dependencies defined in extension.json.

Once you've cloned a particular extension (e.g. SemanticResultFormats), then you want to execute a submodule update to pull in the build environment.

# change to the src directory
cd ~/src
# clone a SMW extension that you want to work on
git clone https://github.com/SemanticMediaWiki/SemanticResultFormats
# make sure you've got the latest code
git pull
# and create a branch to work on
git checkout -b 940-gallery-overlay-and-redirect-fix
# now we initialize the build system
git submodule update --init --remote

Then, also create a .env file in the project root to override the environment variables used by the build system

# .env file example
MW_VERSION=1.43
PHP_VERSION=8.1
DB_TYPE=mysql
SMW_VERSION=6.0.1
PF_VERSION=5.7 # compatible with MW 1.43
NODE_JS=true  # Enable Node.js for JavaScript tests

You can also create a docker-compose.override.yml file in the 'build' directory. This example exposes a port on the host so we can view the web container at http://localhost:8080

services:
  wiki:
    ports:
      - 8080:8080  # Use port 8080 for MediaWiki

Error about docker not running?

# note that if you've been working with docker-desktop, you may need to reset your docker context to 'default' from 'desktop-linux'
docker context ls
docker context use default


Finally install the build system[edit]

# Install the build system
make install
# and check docker process status
docker ps
# run the Continuous Integration target of the makefile
make ci


More is covered at PHPUnit/using_PHPUnit