mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #324 from stumpylog/more-ci-checks
Align CI checks with pre-commit (mostly)
This commit is contained in:
		
							
								
								
									
										71
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @@ -44,45 +44,68 @@ jobs: | |||||||
|           name: documentation |           name: documentation | ||||||
|           path: docs/_build/html/ |           path: docs/_build/html/ | ||||||
|  |  | ||||||
|   codestyle: |   backend-code-checks: | ||||||
|  |     name: "Backend Code Checks" | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|       - |       - | ||||||
|         name: Checkout |         name: Checkout | ||||||
|         uses: actions/checkout@v2 |         uses: actions/checkout@v2 | ||||||
|       - |       - | ||||||
|         name: Install pipenv |         name: Install checkers | ||||||
|         run: pipx install pipenv |  | ||||||
|       - |  | ||||||
|         name: Set up Python |  | ||||||
|         uses: actions/setup-python@v2 |  | ||||||
|         with: |  | ||||||
|           python-version: 3.9 |  | ||||||
|           cache: "pipenv" |  | ||||||
|           cache-dependency-path: 'Pipfile.lock' |  | ||||||
|       - |  | ||||||
|         name: Install dependencies |  | ||||||
|         run: | |         run: | | ||||||
|           pipenv sync --dev |           pipx install reorder-python-imports | ||||||
|  |           pipx install yesqa | ||||||
|  |           pipx install add-trailing-comma | ||||||
|  |           pipx install flake8 | ||||||
|       - |       - | ||||||
|         name: Codestyle |         name: Run reorder-python-imports | ||||||
|         run: | |         run: | | ||||||
|           cd src/ |           find src/ -type f -name '*.py' ! -path "*/migrations/*" | xargs reorder-python-imports | ||||||
|           pipenv run pycodestyle --max-line-length=88 --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E203 |  | ||||||
|   codeformatting: |  | ||||||
|     runs-on: ubuntu-20.04 |  | ||||||
|     steps: |  | ||||||
|       - |       - | ||||||
|         name: Checkout |         name: Run yesqa | ||||||
|         uses: actions/checkout@v2 |         run: | | ||||||
|  |           find src/ -type f -name '*.py' ! -path "*/migrations/*" | xargs yesqa | ||||||
|  |       - | ||||||
|  |         name: Run add-trailing-comma | ||||||
|  |         run: | | ||||||
|  |           find src/ -type f -name '*.py' ! -path "*/migrations/*" | xargs add-trailing-comma | ||||||
|  |       # black is placed after add-trailing-comma because it may format differently | ||||||
|  |       # if a trailing comma is added | ||||||
|       - |       - | ||||||
|         name: Run black |         name: Run black | ||||||
|         uses: psf/black@stable |         uses: psf/black@stable | ||||||
|         with: |         with: | ||||||
|           options: "--check --diff" |           options: "--check --diff" | ||||||
|           version: "22.1.0" |           version: "22.1.0" | ||||||
|  |       - | ||||||
|  |         name: Run flake8 checks | ||||||
|  |         run: | | ||||||
|  |           cd src/ | ||||||
|  |           flake8 --max-line-length=88 --ignore=E203,W503 | ||||||
|  |  | ||||||
|   tests: |   frontend-code-checks: | ||||||
|  |     name: "Frontend Code Checks" | ||||||
|  |     runs-on: ubuntu-20.04 | ||||||
|  |     steps: | ||||||
|  |       - | ||||||
|  |         name: Checkout | ||||||
|  |         uses: actions/checkout@v2 | ||||||
|  |       - uses: actions/setup-node@v2 | ||||||
|  |         with: | ||||||
|  |           node-version: '16' | ||||||
|  |       - | ||||||
|  |         name: Install prettier | ||||||
|  |         run: | | ||||||
|  |           npm install prettier | ||||||
|  |       - | ||||||
|  |         name: Run prettier | ||||||
|  |         run: | ||||||
|  |           npx prettier --check --ignore-path Pipfile.lock **/*.js **/*.ts *.md **/*.md | ||||||
|  |  | ||||||
|  |   backend-tests: | ||||||
|  |     needs: [backend-code-checks] | ||||||
|  |     name: "Backend Tests (${{ matrix.python-version }})" | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
| @@ -130,7 +153,7 @@ jobs: | |||||||
|   build-docker-image: |   build-docker-image: | ||||||
|     if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/feature-') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/beta' || startsWith(github.ref, 'refs/tags/ngx-') || startsWith(github.ref, 'refs/tags/beta-')) |     if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/feature-') || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/beta' || startsWith(github.ref, 'refs/tags/ngx-') || startsWith(github.ref, 'refs/tags/beta-')) | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     needs: [tests, codeformatting, codestyle] |     needs: [backend-tests, frontend-code-checks] | ||||||
|     steps: |     steps: | ||||||
|       - |       - | ||||||
|         name: Prepare |         name: Prepare | ||||||
| @@ -195,7 +218,7 @@ jobs: | |||||||
|           path: src/documents/static/frontend/ |           path: src/documents/static/frontend/ | ||||||
|  |  | ||||||
|   build-release: |   build-release: | ||||||
|     needs: [build-docker-image, documentation, tests, codeformatting, codestyle] |     needs: [build-docker-image, documentation, backend-tests, backend-code-checks, frontend-code-checks] | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|       - |       - | ||||||
|   | |||||||
| @@ -30,9 +30,6 @@ repos: | |||||||
|     rev: "v2.5.1" |     rev: "v2.5.1" | ||||||
|     hooks: |     hooks: | ||||||
|       - id: prettier |       - id: prettier | ||||||
|         args: |  | ||||||
|           - "--no-semi" |  | ||||||
|           - "--single-quote" |  | ||||||
|         types_or: |         types_or: | ||||||
|           - javascript |           - javascript | ||||||
|           - ts |           - ts | ||||||
| @@ -59,10 +56,8 @@ repos: | |||||||
|     hooks: |     hooks: | ||||||
|       - id: flake8 |       - id: flake8 | ||||||
|         files: ^src/ |         files: ^src/ | ||||||
|         exclude: "(migrations)|(paperless/settings.py)|(.*\\.tox)|(.*/tests/.*)" |  | ||||||
|         args: |         args: | ||||||
|           - "--max-line-length=88" |           - "--config=./src/setup.cfg" | ||||||
|           - "--ignore=E203,W503" |  | ||||||
|   - repo: https://github.com/psf/black |   - repo: https://github.com/psf/black | ||||||
|     rev: 22.1.0 |     rev: 22.1.0 | ||||||
|     hooks: |     hooks: | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								.prettierrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.prettierrc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | # https://prettier.io/docs/en/options.html#semicolons | ||||||
|  | semi: false | ||||||
|  | # https://prettier.io/docs/en/options.html#quotes | ||||||
|  | singleQuote: true | ||||||
| @@ -1,5 +1,9 @@ | |||||||
| [pycodestyle] | [flake8] | ||||||
| exclude = migrations, paperless/settings.py, .tox, */tests/* | extend-exclude = */migrations/*, paperless/settings.py, */tests/* | ||||||
|  | # E203 - https://www.flake8rules.com/rules/E203.html | ||||||
|  | # W503 - https://www.flake8rules.com/rules/W503.html | ||||||
|  | ignore = E203,W503 | ||||||
|  | max-line-length = 88 | ||||||
|  |  | ||||||
| [tool:pytest] | [tool:pytest] | ||||||
| DJANGO_SETTINGS_MODULE=paperless.settings | DJANGO_SETTINGS_MODULE=paperless.settings | ||||||
| @@ -7,7 +11,6 @@ addopts = --pythonwarnings=all --cov --cov-report=html -n auto | |||||||
| env = | env = | ||||||
|   PAPERLESS_DISABLE_DBHANDLER=true |   PAPERLESS_DISABLE_DBHANDLER=true | ||||||
|  |  | ||||||
|  |  | ||||||
| [coverage:run] | [coverage:run] | ||||||
| source = | source = | ||||||
|   ./ |   ./ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Quinn Casey
					Quinn Casey