-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚜 Noxifcation and adds pre-commit support (#192)
* 🚜 Refactors nox and streamlines pipelines * ⚙️ Adds pre-commit and lint just command * ⚙️ Fix ~= handling of the install * ⚙️ Update actions to support cancel-in-progress --------- Co-authored-by: Jeffrey Triplett <[email protected]>
- Loading branch information
1 parent
8ad1fd8
commit 6dee914
Showing
5 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
alias: autoformat | ||
- id: trailing-whitespace | ||
alias: autoformat | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.13.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
- repo: https://github.com/psf/black | ||
rev: 23.9.1 | ||
hooks: | ||
- id: black | ||
args: [ | ||
"." | ||
] | ||
alias: autoformat | ||
additional_dependencies: ['click==8.0.4'] | ||
- repo: https://github.com/asottile/blacken-docs | ||
rev: 1.16.0 | ||
hooks: | ||
- id: blacken-docs | ||
alias: autoformat | ||
additional_dependencies: ['black==22.1.0', 'click==8.0.4'] | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: 'v0.0.291' | ||
hooks: | ||
- id: ruff | ||
# Respect `exclude` and `extend-exclude` settings. | ||
args: | ||
- "--fix" | ||
exclude: /migrations/ | ||
alias: autoformat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,46 @@ | ||
import nox | ||
|
||
# DJANGO_STABLE_VERSION should be set to the latest Django LTS version | ||
# and should *not* appear in DJANGO_VERSIONS | ||
|
||
DJANGO_STABLE_VERSION = ["4.2"] | ||
DJANGO_STABLE_VERSION = "4.2" | ||
DJANGO_VERSIONS = ["3.2", "4.1", "main"] | ||
|
||
PYTHON_STABLE_VERSION = ["3.11"] | ||
# PYTHON_STABLE_VERSION should be set to the latest stable Python version | ||
# and should *not* appear in PYTHON_VERSIONS | ||
|
||
PYTHON_STABLE_VERSION = "3.11" | ||
PYTHON_VERSIONS = ["3.8", "3.9", "3.10"] | ||
|
||
|
||
@nox.session(python=PYTHON_STABLE_VERSION, tags=["django"]) | ||
@nox.session | ||
def lint(session): | ||
session.install(".[lint]") | ||
session.run("python", "-m", "pre_commit", "run", "--all-files") | ||
|
||
|
||
@nox.session(python=[PYTHON_STABLE_VERSION], tags=["django"]) | ||
@nox.parametrize("django", DJANGO_VERSIONS) | ||
def test_django_version(session: nox.Session, django: str) -> None: | ||
if django == DJANGO_STABLE_VERSION: | ||
session.skip() | ||
|
||
session.install(".[test]") | ||
|
||
if django == "main": | ||
session.install("https://github.com/django/django/archive/refs/heads/main.zip") | ||
else: | ||
session.install(f"django~={django}") | ||
session.install(f"django~={django}.0") | ||
|
||
session.run("pytest", *session.posargs) | ||
|
||
|
||
@nox.session(python=PYTHON_VERSIONS, tags=["python"]) | ||
@nox.parametrize("django", DJANGO_STABLE_VERSION) | ||
@nox.parametrize("django", [DJANGO_STABLE_VERSION]) | ||
def test_python_version(session: nox.Session, django: str) -> None: | ||
if session.python == PYTHON_STABLE_VERSION: | ||
session.skip() | ||
|
||
session.install(".[test]") | ||
session.install(f"django~={django}") | ||
session.install(f"django~={django}.0") | ||
session.run("pytest", *session.posargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters