diff --git a/.editorconfig b/.editorconfig index 03b93fba3..359086253 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,27 +8,22 @@ end_of_line = lf charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true +indent_style = space [**.py] -indent_style = space indent_size = 4 +[**.yaml] +indent_size = 2 + [src/octoprint/static/js/app/**.js] -indent_style = space indent_size = 4 [src/octoprint/static/js/login/**.js] -indent_style = space indent_size = 4 [src/octoprint/static/js/recovery/**.js] -indent_style = space indent_size = 4 [src/octoprint/static/less/octoprint.less] -indent_style = space -indent_size = 2 - -[.travis.yml] -indent_style = space indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc2e7fa71..83b7b530e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,54 @@ jobs: name: dist path: dist + lint-black: + name: ๐Ÿงน black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run black + run: | + pre-commit run --hook-stage manual black --all-files --show-diff-on-failure + + lint-isort: + name: ๐Ÿงน isort + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run isort + run: | + pre-commit run --hook-stage manual isort --all-files --show-diff-on-failure + + lint-flake8: + name: ๐Ÿงน Flake8 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run flake8 + run: | + pre-commit run --hook-stage manual flake8 --all-files + test-unit: name: ๐Ÿงช Unit tests strategy: @@ -50,22 +98,6 @@ jobs: run: | pytest - test-flake8: - name: ๐Ÿงช Flake8 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿ— Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: ๐Ÿ— Set up test dependencies - run: | - pip install -e .[develop] - - name: ๐Ÿš€ Run test suite - run: | - flake8 src/ tests setup.py - test-install: name: ๐Ÿงช Installation tests needs: build @@ -144,6 +176,9 @@ jobs: name: ๐Ÿ“ฆ Publish on TestPyPI if: github.event_name == 'release' needs: + - lint-black + - lint-isort + - lint-flake8 - test-unit - test-install - test-e2e diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f314c8e4..7ef1c8091 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -356,6 +356,9 @@ and branching strategy. in the OctoPrint checkout folder. If you install the pre-commit hooks via `pre-commit install` this will even be taken care of for you prior to committing. + + An [automatic build workflow](https://github.com/OctoPrint/OctoPrint/actions?query=workflow%3ABuild) + is in place that will run these checks - if they fail your PR will be marked accordingly. 9. **Test your changes thoroughly**. That also means testing with usage scenarios you don't normally use, e.g. if you only use access control, test without and vice versa. If you only test with your printer, test with the