Semantic MediaWiki/contributing: Difference between revisions
Created page with "Semantic MediaWiki extensions have all largely adopted the Gesinn IT Docker-based approach to development. Once you've cloned a particular extension (e.g. SemanticResultFormats), then you want to execute a submodule update to pull in the build environment. <syntaxhighlight lang="bash"> # 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 la..." |
No edit summary |
||
| Line 1: | Line 1: | ||
Semantic MediaWiki extensions have all largely adopted the Gesinn IT Docker-based approach to development. | Semantic MediaWiki extensions have all largely adopted the [https://github.com/gesinn-it-pub/docker-compose-ci 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 [[Extensions|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. | Once you've cloned a particular extension (e.g. SemanticResultFormats), then you want to execute a submodule update to pull in the build environment. | ||
| Line 14: | Line 14: | ||
# now we initialize the build system | # now we initialize the build system | ||
git submodule update --init --remote | git submodule update --init --remote | ||
</syntaxhighlight> | |||
Then, also create a <code>.env</code> file in the project root to override the environment variables used by the build system | |||
<syntaxhighlight lang="bash"> | |||
# .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 | |||
</syntaxhighlight> | |||
You can also create a <code>docker-compose.override.yml</code> file in the 'build' directory. | |||
Error about docker not running? | |||
<syntaxhighlight lang="bash"> | |||
# note that if you've been working with docker-desktop, you may need to reset your docker context to 'default' from 'desktop-linux' | # 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 ls | ||
docker context use default | docker context use default | ||
</syntaxhighlight> | |||
== Finally install the build system == | |||
<syntaxhighlight lang="bash"> | |||
# Install the build system | # Install the build system | ||
make install | make install | ||
# and check docker process status | |||
docker ps | docker ps | ||
# run | # run the Continuous Integration target of the makefile | ||
make ci | make ci | ||
</syntaxhighlight> | </syntaxhighlight> | ||
More is covered at [[PHPUnit/using_PHPUnit]] | |||
[[Category:SMW]] | |||
[[Category:Semantic MediaWiki]] | |||
[[Category:PHP]] | |||
Revision as of 15:04, 28 October 2025
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 --remoteThen, 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 testsYou can also create a docker-compose.override.yml file in the 'build' directory.
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