Want to contribute? Awesome!
- First and foremost: adhere to our Code of Conduct;
- Fork it (https://github.com/instruct-br/grua/fork);
- Create your feature branch (git checkout -b feature/fooBar);
- Commit your changes with an informative message (git commit);
- Push to the branch (git push origin feature/fooBar);
- Create a new Pull Request following the project's pull request template (available on Github interface).
GRUA has a docker-compose.dev.yml
file specifically created to help the development process.
It is responsible to mount volumes on Docker so the changes you made on the code are reflected on the containers.
Build the containers with:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml build
Apply database migrations with:
docker-compose run webapp python manage.py migrate
Create a generic admin user:
docker-compose run webapp python manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'admin')"
Spin up the containers with:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
Frontend static assets are mapped with local files in the development containers. To generate assets locally you need to install JS dependencies: npm 6.4.1 and node v8.12.0. These assets can be created with:
cd webapp/
npm install
npm run build
cd ..
We mostly use PEP8 as our style guide (aside of us allowing bigger line lengths).
You can use Black to format your code (while the containers are up):
docker exec -it grua_webapp_1 black .
And Flake8 to check it (while the containers are up):
docker exec -it grua_webapp_1 pipenv run flake8 --exclude=*/migrations/* --exclude node_modules/ --ignore=E501 .
We also encourage developers to implement tests when contributing to a new feature or a bug fix. It is possible to run tests with:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml run webapp python manage.py test