Skip to content

Pull request checks

Martin van der Schelling edited this page Jan 16, 2023 · 1 revision

The checks outlined in this document play a crucial role in maintaining the high quality of the project's codebase. By adhering to these checks, the code is kept maintainable, readable, and well-documented, which in turn improves the overall development process. The document provides an overview of the various checks that are performed when a pull request is submitted, as well as information on when and by whom these checks are conducted, and how to perform them yourself before filing a pull request.

Checking the code-style

In order to comply to the code style, you'll need to pass the flake8 style guide enforcement. These rulesets are set in the .flake8 file in the root directory of the f3dasm repository.

When will this be checked?

In the following pull request cases this check will be done:

  • From feature to pr/vX.X
  • from pr/vX.X to main
  • hotfix

How will this be checked

This check is done automatically by GitHub Actions whenever you file a pull request.

Execute this check yourself

  1. Make sure you have flake8 installed (included with requirements_dev.txt):
    pip install -U flake8
  2. Navigate to the root directory of the f3dasm repository
  3. run the following command in terminal: flake8 .

This command will run flake8 following with the directory to check recursively for files

  1. If there are no errors, a error-code '0' will appear:
(f3dasm_env) martin@martin: ~/Github/F3DASM$ flake8 .
0

If you have files that you want to exclude from the style enforcement, you can add these to the he .flake8 file:

  1. Open the .flake8 file in the root directory of the f3dasm repository
  2. Add the file to the extend-exclude configuration

Building the documentation

You will need to make sure that the documentation page can still be build. The documentation is build with sphinx.

When will this be checked?

In the following pull request cases this check will be done:

  • From feature to pr/vX.X
  • from pr/vX.X to main
  • hotfix

How will this be checked

This check is done automatically by GitHub Actions whenever you file a pull request.

Execute this check yourself

  1. Make sure you have the documentation dependencies installed (included with requirements_dev.txt):
    pip install -r docs/requirements.txt
  2. Navigate to the documentation folder of the repository (/docs/)
  3. Build the documentation with the following command: sphinx-build -b html ./docs ./docs/_build/html

You can also run a handy Make command: make html

  1. If the build was succesful, you will see the following message:
build succeeded.
The HTML pages are in _build/html

Building the python package

You will need to make sure the Python package can stil be build.

When will this be checked?

In the following pull request cases this check will be done:

  • From feature to pr/vX.X
  • from pr/vX.X to main
  • hotfix

How will this be checked

This check is done automatically by GitHub Actions whenever you file a pull request.

Execute this check yourself

  1. Make sure you have the build dependencies installed (included with requirements_dev.txt): pip install -U setuptools wheel build
  2. Run the following command to build the package: python -m build
  3. If the build was succesful, you will see the following message (replace X.Y.Z for the current version):
Successfully build f3dasm-X.Y.Z.tar.gz and f3dasm-X.Y.Z.whl

Running the Python-only test cases

You will need to make sure that all available Python-only test pass when you change or implement a feature to the f3dasm framework. We use pytest to configure the tests.

When will this be checked?

In the following pull request cases this check will be done:

  • From feature to pr/vX.X
  • from pr/vX.X to main
  • hotfix

How will this be checked

This check is done automatically by GitHub Actions whenever you file a pull request.

Execute this check yourself

  1. Make sure you have the test dependencies installed (included with requirements_dev.txt): pip install -r tests/requirements.txt
  2. You can run the tests that are not marked by a non-Python dependency by executing
pytnon -m pytest -S all
  1. If the tests are passed , you will see the following message:
Required test coverage of 70.0% reached. Total coverage: XX.XX%
========= X passed, X skipped, X warnings in 91.49s (0:01:31) =========

For the Python-only tests, a minimum of 70% code coverage is required. Click Testing#Code coverage for more information about code coverage.

Running the Third-party package test cases

Apart from the Python-only functionalities, f3dasm will depend on some third-party software that is not supported by GitHub Actions. These test cases have to be run on machine that supports this software.

When will this be checked?

In the following pull request cases this check will be done:

  • from pr/vX.X to main
  • hotfix

How will this be checked

This check is done manually by the reviewer

Execute this check yourself

  1. Make sure you have the test dependencies installed (included with requirements_dev.txt): pip install -r tests/requirements.txt
  2. You can run the tests that are marked by a non-Python dependency by executing
pytnon -m pytest requires_dependency
  1. If the tests are passed , you will see the following message:
Required test coverage of 70.0% reached. Total coverage: XX.XX%
========= X passed, X skipped, X warnings in 91.49s (0:01:31) =========