Jump to content

SQL/XML Dumps/Becoming a dumps co-maintainer/Setup

From mediawiki.org

So you want to become a co-maintainer of the dumps. Awesome! This document will describe the steps you need to take in order to get set up for development, testing, packaging, and deployment of all of the dumps we maintain.

This is a living document; if it has not been updated in a while, please nag the authors.

What you need for development

[edit]

Getting the code

[edit]

Make sure you have git installed for cloning repositories. Make sure you configure it so that your name and email address will be added correctly to any patches you make. Then set yourself up with a Wikitech user and a gerrit SSH key. Once you've done that, you should clone the following, using the command

git clone ssh://shell-username-here@gerrit.wikimedia.org:29418/path-to-repo-here for each repo.

  • puppet: operations/puppet.git
  • xml/sql dumps: operations/dumps.git
  • mwbzutils: operations/dumps/mwbzutils.git
  • MediaWiki: mediawiki/core.git
  • MediaWiki extensions:
    • ActiveAbstract:mediawiki/extensions/ActiveAbstract.git

Development environment

[edit]

For development you may use the IDE of your choice. The current primary dumps maintainer uses emacs + LSP for PHP and emacs + elpy for Python; for more information on that setup, see Emacs as a PHP IDE and the discussion page.

You'll want to make sure you have your configuration for each language set up to handle spaces and tabs according to the relevant style guidelines.

Code and style guidelines

[edit]

Each project has code standards and style guidelines you should follow, some more formal than others.

You will want the following tools to check syntax or style of your repos:

  • puppet: puppet-lint ([1])
  • xml/sql dumps: pylint ([2]) and flake8 ([3])
  • MediaWiki and extensions: phpcs ([4]) and MediaWiki-CodeSniffer ([5]) which you will want to get via composer if you are working with the master branch.

Testing locally

[edit]

It is very convenient to be able to test code locally on a desktop or laptop, and this should be the first step after you make any change to the code. Some users have a local installation of MediaWiki that they test against, while others use a Docker environment or a VM. Each codebase has different requirements for testing:

  • puppet: changes can be run through the puppet compiler ([6]) This can also be done locally, details coming soon.
  • xml/sql dumps: from within the xmldumps-backup directory, you may run bash test/all_test.sh for unit tests of much of the code. You will need the mwbzutils binaries built and installed to run these, and you will need python3.
  • mwbzutils: you will need to build the binaries first, so you should have a c compiler (e.g. gcc) ad the make utility. From within the repo, you can run bash tests/all.sh to run a number of tests on those.
  • MediaWiki: many phpunit tests can be run without a local installation. You can run a single test from the top level of the repo by composer phpunit:entrypoint -- tests/phpunit/rest-of-path-to-test.php, or all the tests in a directory under tests/phpunit by composer phpunit:entrypoint -- name-of-directory-here. Note that some tests in the phpunit directory tree are actually integration tests tests and will require a MediaWiki installation.