diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3a50026 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,49 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip tox + - name: Lint with flake8 + run: | + tox -e lint + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ "3.9", "3.10", "3.11"] + django-version: [ "3.2", "4.2"] + env: + PY_VER: ${{ matrix.python-version}} + DJ_VER: ${{ matrix.django-version}} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: python -m pip install --upgrade pip tox + + - name: Test with + run: tox -e py${PY_VER//.}-dj${DJ_VER//.} + + - uses: codecov/codecov-action@v2 + with: + verbose: true \ No newline at end of file diff --git a/example/example/settings.py b/example/example/settings.py index e9f5d61..5a760ca 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -9,12 +9,12 @@ DATABASES = { "default": { - "ENGINE": "django.db.backends.sqlite3", # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - "NAME": "example.db", # Or path to database file if using sqlite3. - "USER": "", # Not used with sqlite3. - "PASSWORD": "", # Not used with sqlite3. - "HOST": "", # Set to empty string for localhost. Not used with sqlite3. - "PORT": "", # Set to empty string for default. Not used with sqlite3. + "ENGINE": "django.db.backends.sqlite3", + "NAME": "example.db", + "USER": "", + "PASSWORD": "", + "HOST": "", + "PORT": "", } } diff --git a/tox.ini b/tox.ini index 6aad9a8..1075a2f 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,13 @@ envlist = py{39,310,311}-dj{32,42} docs +[flake8] +max-line-length = 120 +ignore = + +exclude = + */migrations, + [testenv] deps = coverage>=4.0 @@ -17,3 +24,12 @@ deps = Django commands = {envbindir}/sphinx-build -a -n -b html -d docs/_build/doctrees docs docs/_build/html + + +[testenv:lint] +envdir={toxworkdir}/py39-d41/ +skip_install = true +commands = + pip install flake8 isort + flake8 selectable example + isort -c selectabe example