Source code for the modding-openmw.com website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CONTRIBUTING.md 3.9KB

Contributing Guide

This document shows you how to get the project and run various local dev tasks.

Dependencies

To make sure that the following instructions work, please install the following dependencies on your machine:

  • Git
  • chromedriver (for tests)
  • geckodriver (for tests)
  • GNU make
  • PostgreSQL
  • Python3 (the latest 3.X release is desireable)
  • python3-pip

Installation

The below steps should work for any unix-based system (Linux, macOS). For windows, I need a volunteer to come up with those steps.

To get the source, clone the git repository via:

$ git clone http://git.modding-openmw.com/Modding-OpenMW.com/momw.git

This will clone the complete source to your local machine. Navigate to the project folder and install all needed dependencies via pip3:

$ pip3 install --user --upgrade -r requirements.txt

If desired, the --user flag may be omitted but this is not advised.

Create a psql database, role, and user called momwdb with login and createdb privileges.

Next, a database user (and related unix account) are created:

$ sudo useradd momwdb
$ sudo -u postgres psql -c 'create user momwdb with encrypted password \'postgresqlpassword\';'

Create the required databases:

$ sudo -u postgres createdb momwdb
$ sudo -u postgres createdb test_momwdb

Add privileges to the app’s database user:

$ sudo -u postgres psql -c 'alter user momwdb createdb;'
$ sudo -u postgres psql -c 'alter user momwdb login;'

And finally, set the owner on the databases that were created:

$ sudo -u postgres psql -c 'alter database momwdb owner to momwdb;'
$ sudo -u postgres psql -c 'alter database test_momwdb owner to momwdb;'

If you want to not require a password to do things like psql as the app’s database user, add the following to your sudoers config:

<your username> ALL=(momwdb) NOPASSWD: /bin/psql,/bin/createdb,/bin/dropdb

Adjust the paths to the binaries as needed.

With that, you should now me able to run the app and related tasks:

make reset
make server

If you just want to run a local version of the site, you should now be set.

Testing

Tests depend on a working install of both the chrome and gecko webdrivers for selenium. Their installation and setup is (for now) outside the scope of this document, but all that’s necessary is to have chromedriver and geckodriver binaries for your OS in your $PATH.

To run tests:

make test

After a short time, a chrome or chromium instance will pop up with a note about it being controlled by software. After a bit more time it will close and then firefox will open and do the same. This is normal and part of the test suite.

Source formatting/linting

Source is automatically formatted as part of the make test target, using python black. Please ensure it’s installed for your system.

Linting also happens as part of the test target, be sure the following rules are set at minimum:

[flake8]
ignore = E501, E402, W503
max-line-length = 160

Buildbot

Any commit to any branch on the primary Modding-OpenMW.com/momw repository will kick off a buildbot build.

Contributing/Submitting changes

  • Check out a new branch based on dev and name it to what you intend to do:

    $ git checkout -b my-cool-feature origin/dev
    
  • Use one branch per fix/feature

  • Make your changes

    • Run your tests with make test.
    • When all tests pass, everything’s fine.
  • Commit your changes

    • Please provide a git message that explains what you’ve done.
    • Commit to a forked repository on our Gitea instance.
  • Make a pull request

    • Make sure you send the PR to the dev branch.
    • A passing Buildbot build is required before any changes are merged.

Tests are expected for any submitted changes. If it’s specific to a particular page, or adds a new page, related selenium tests should be written.