diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe6de5f..cbf069d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,24 @@ on: [push, pull_request] jobs: + check-formatting: + runs-on: ubuntu-latest + + name: Consult black on python formatting + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - uses: dschep/install-pipenv-action@v1 + - name: Install dependencies + run: | + pipenv install --dev --python ${pythonLocation}/python + - name: Run black + run: | + pipenv run black . --check --diff --exclude tests/output_ + run-tests: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 53a7cdd..aeb44df 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,18 @@ $ pipenv shell $ pip install -e . ``` +### Code style + +This project enforces [black](https://github.com/psf/black) python code formatting. + +Before commiting changes run: + +```bash +pipenv run black . +``` + +To avoid merge conflicts later, non-black formatted python code will fail in CI. + ### Tests There are two types of tests: @@ -324,7 +336,7 @@ Adding a standard test case is easy. It will be picked up automatically when you run the tests. -- See also: [Standard Tests Development Guide](betterproto/tests/README.md) +- See also: [Standard Tests Development Guide](betterproto/tests/README.md) #### Custom tests