- Install python
- Clone this repository
- Install development environment
pip install --upgrade pip pip install -r requirements-dev.txt
- Install
pre-commit
.- NOTE: if
git
is not on yourPATH
, you need to add it. For me using GitHub Desktop on Windows,git.exe
is located atC:\Users\<username>\AppData\Local\GitHubDesktop\app-<appversion>\resources\app\git\cmd\git.exe
PS: AppData is a hidden folder by default.
pre-commit install
- NOTE: if
- Install docker https://docs.docker.com/get-docker/
- Make sure docker-compose is installed with the command
docker-compose version
- Make sure docker-compose is installed with the command
- Code should go
development
->master
->production
. Sometimesmaster
will have changes thatdevelopment
does not, make sure thatdevelopment
is caught up tomaster
before starting development. - Make a branch from
development
, you'll make your changes on that branch. Thegrubberbot/develop.py
file is used to test things, it should never actually run in production. - After making a change to the branch, make sure your code doesn't break anything:
- Navigate to the
grubberbot
directory - Check that your code style is okay
pre-commit run --all-files
- Before building, keep Docker clean by removing dangling images
docker image prune --force --all
- Simultaneously run unit tests and run
grubberbot/develop.py
through Docker:docker-compose up --build --force-recreate --remove-orphans
- Shut down the application when you are done
docker-compose down
- Navigate to the
- Finally, pull request to
development
. NOTE: If you are using Python through Anaconda (or some other environment) an error may be raised by using git without being in that environment. Bug is documented here conda-forge/pre-commit-feedstock#9 The easiest fix is to use git from the environment. For example, I use python through Anaconda and here are the steps I use:- Open Anaconda prompt
- Activate your environment with some command like
conda activate py38
- Open your git GUI from this environment. I use GitHub Desktop, the command for me is
github
to launch the application. - Do your
git
commands using the GUI that you've opened.
Make a pull request from development
-> master
. Wait for Paul to approve the pull request. When he does he'll push master
-> production
. The master
branch holds the current state of code, and all changes should normally go through master
so Paul can verify them.
If a change is urgent, users with the mods
role can push development
-> production
. This is useful if, for example, a command breaks and needs immediate attention. Since the change has not gone through master
it will be overwritten in the future, so make sure to also create a pull request development
-> master
to address this.
Changes in production
will not go live until the server restarts. Users with access to grubberbot's google cloud engine can go to https://console.cloud.google.com/compute/instances?project=grubberbot and restart the VM grubberbot-server-ubuntu
. The bot will be down for a few minutes and then will automatically pull from production
upon booting up.