Merge branch 'kerl/ci' into 'master'
Intégration continue See merge request klub-dev-ens/authens!17
This commit is contained in:
commit
b93e56db4d
14 changed files with 84 additions and 15 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -10,4 +10,7 @@ __pycache__
|
|||
|
||||
# Vim
|
||||
*.swp
|
||||
*.swo
|
||||
*.swo
|
||||
|
||||
# Tests
|
||||
.tox
|
||||
|
|
54
.gitlab-ci.yml
Normal file
54
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
image: python
|
||||
|
||||
stages:
|
||||
- linters
|
||||
- tests
|
||||
|
||||
variables:
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/vendor/pip"
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- vendor
|
||||
|
||||
linters:
|
||||
stage: linters
|
||||
before_script:
|
||||
- mkdir -p vendor/pip
|
||||
- pip install --upgrade black isort flake8
|
||||
script:
|
||||
- black --check .
|
||||
- isort --check --diff .
|
||||
- flake8 --exit-zero authens
|
||||
|
||||
before_script:
|
||||
- mkdir -p vendor/{apt,pip}
|
||||
- apt-get update -q && apt-get -o dir::cache::archives="vendor/apt" install -yqq python3-dev libldap2-dev libsasl2-dev
|
||||
- pip install tox
|
||||
|
||||
python35:
|
||||
image: python:3.5
|
||||
stage: tests
|
||||
script:
|
||||
- tox -e py35-django22
|
||||
|
||||
python36:
|
||||
image: python:3.6
|
||||
stage: tests
|
||||
script:
|
||||
- tox -e py36-django22
|
||||
- tox -e py36-django30
|
||||
|
||||
python37:
|
||||
image: python:3.7
|
||||
stage: tests
|
||||
script:
|
||||
- tox -e py37-django22
|
||||
- tox -e py37-django30
|
||||
|
||||
python38:
|
||||
image: python:3.8
|
||||
stage: tests
|
||||
script:
|
||||
- tox -e py38-django22
|
||||
- tox -e py38-django30
|
|
@ -1,7 +1,7 @@
|
|||
from django import forms
|
||||
from django.contrib.auth import forms as auth_forms, authenticate
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.contrib.auth import authenticate, forms as auth_forms
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
def promo_choices():
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Generated by Django 3.0.6 on 2020-05-17 11:58
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Generated by Django 3.0.6 on 2020-06-12 17:26
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
# TODO: make the python-ldap dependency optional
|
||||
import ldap
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Internal utility functions used by authens."""
|
||||
from urllib.parse import urlunparse
|
||||
|
||||
from cas import CASClient
|
||||
from urllib.parse import urlunparse
|
||||
|
||||
|
||||
def get_cas_client(request):
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.contrib.auth import views as auth_views
|
|||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import TemplateView, View
|
||||
|
||||
from authens.forms import OldCASAuthForm
|
||||
|
|
|
@ -15,7 +15,6 @@ Including another URLconf
|
|||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
from example import views
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
python-cas==1.5.*
|
||||
python-ldap
|
||||
|
|
|
@ -8,8 +8,8 @@ import django
|
|||
from django.conf import settings
|
||||
from django.test.utils import get_runner
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
|
||||
if __name__ == "__main__":
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
|
||||
django.setup()
|
||||
TestRunner = get_runner(settings)
|
||||
test_runner = TestRunner()
|
||||
|
|
|
@ -19,5 +19,4 @@ known_django = django
|
|||
known_first_party = authens,tests
|
||||
line_length = 88
|
||||
multi_line_output = 3
|
||||
not_skip = __init__.py
|
||||
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
||||
|
|
|
@ -2,11 +2,11 @@ from django.contrib.auth.decorators import login_required
|
|||
from django.http import HttpResponse
|
||||
from django.urls import include, path
|
||||
|
||||
|
||||
# ---
|
||||
# Two tiny views to easily test user authentication.
|
||||
# ---
|
||||
|
||||
|
||||
def public_view(request):
|
||||
return HttpResponse("OK")
|
||||
|
||||
|
|
16
tox.ini
Normal file
16
tox.ini
Normal file
|
@ -0,0 +1,16 @@
|
|||
[tox]
|
||||
# Temporaire en attendant de créer setup.py
|
||||
skipsdist = True
|
||||
envlist =
|
||||
py{35,36,37,38}-django22,
|
||||
py{36,37,38}-django30
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
django22: Django==2.2.*
|
||||
django30: Django==3.0.*
|
||||
python-cas
|
||||
python-ldap
|
||||
commands =
|
||||
python --version
|
||||
python runtests.py
|
Loading…
Reference in a new issue