-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from roverdotcom/DEV-103519-add-gha
- Loading branch information
Showing
16 changed files
with
244 additions
and
246 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Run Tests and Linter | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
lint-and-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.8.18, 3.9.18, 3.10.13, 3.11.8] | ||
django-version: [3.2, 4.2] | ||
|
||
name: Lint and Test (Python ${{ matrix.python-version }} - Django ${{ matrix.django-version }}) | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -q Django==${{ matrix.django-version }} | ||
pip install -e .[flake8,tests] | ||
- name: Add current directory to PYTHONPATH | ||
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV | ||
|
||
- name: Lint with flake8 | ||
run: flake8 | ||
|
||
- name: Test with pytest | ||
run: pytest |
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,30 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
args: [--markdown-linebreak-ext=md] | ||
- id: end-of-file-fixer | ||
- id: check-toml | ||
- id: check-added-large-files | ||
- id: debug-statements | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: "7.0.0" | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-bugbear | ||
- flake8-isort | ||
- repo: https://github.com/psf/black | ||
rev: "24.2.0" | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/myint/autoflake | ||
rev: v2.2.1 | ||
hooks: | ||
- id: autoflake |
This file was deleted.
Oops, something went wrong.
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,2 +1,2 @@ | ||
include README.md | ||
recursive-include django_inlinecss *.py | ||
recursive-include django_inlinecss *.py |
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,3 +1,3 @@ | ||
VERSION = (0, 3, 0) | ||
VERSION = (0, 4, 0) | ||
|
||
__version__ = '.'.join(map(str, VERSION)) | ||
__version__ = ".".join(map(str, VERSION)) |
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,32 +1,28 @@ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
|
||
try: | ||
import importlib | ||
except ImportError: | ||
from django.utils import importlib | ||
|
||
DEFAULT_ENGINE = 'django_inlinecss.engines.PynlinerEngine' | ||
DEFAULT_CSS_LOADER = 'django_inlinecss.css_loaders.StaticfilesStorageCSSLoader' | ||
DEFAULT_ENGINE = "django_inlinecss.engines.PynlinerEngine" | ||
DEFAULT_CSS_LOADER = "django_inlinecss.css_loaders.StaticfilesStorageCSSLoader" | ||
|
||
|
||
def load_class_by_path(path): | ||
i = path.rfind('.') | ||
module_path, class_name = path[:i], path[i + 1:] | ||
i = path.rfind(".") | ||
module_path, class_name = path[:i], path[i + 1 :] | ||
module = importlib.import_module(module_path) | ||
return getattr(module, class_name) | ||
|
||
|
||
def get_engine(): | ||
from django.conf import settings | ||
engine_path = getattr(settings, 'INLINECSS_ENGINE', DEFAULT_ENGINE) | ||
|
||
engine_path = getattr(settings, "INLINECSS_ENGINE", DEFAULT_ENGINE) | ||
return load_class_by_path(engine_path) | ||
|
||
|
||
def get_css_loader(): | ||
from django.conf import settings | ||
engine_path = getattr(settings, 'INLINECSS_CSS_LOADER', DEFAULT_CSS_LOADER) | ||
|
||
engine_path = getattr(settings, "INLINECSS_CSS_LOADER", DEFAULT_CSS_LOADER) | ||
return load_class_by_path(engine_path) |
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
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 |
---|---|---|
|
@@ -2,5 +2,5 @@ div.foo { | |
margin: 10px 15px 20px 25px; | ||
} | ||
div.bar { | ||
padding: 10px 15px 20px 25px; | ||
padding: 10px 15px 20px 25px; | ||
} |
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
Oops, something went wrong.