1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Try to add CI

This commit is contained in:
Yohann D'ANELLO 2020-09-24 11:44:43 +02:00
parent f0459838d4
commit a68a7b681d
14 changed files with 72 additions and 20 deletions

16
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,16 @@
stages:
- test
- quality-assurance
py38-django31:
stage: test
image: python3:alpine
script: tox -e py38-django31
linters:
stage: quality-assurance
image: python3:alpine
script: tox -e linters
# Be nice to new contributors, but please use `tox`
allow_failure: true

View File

@ -1,5 +1,8 @@
# Plateforme d'inscription des Correspondances des Jeunes Mathématicien·nes
[![pipeline status](https://gitlab.com/animath/si/plateforme-corres2math/badges/django/pipeline.svg)](https://gitlab.com/animath/si/plateforme-corres2math/-/commits/django)
[![coverage report](https://gitlab.com/animath/si/plateforme-corres2math/badges/django/coverage.svg)](https://gitlab.com/animath/si/plateforme-corres2math/-/commits/django)
La plateforme des Correspondances des Jeunes Mathématicien·nes est née pour la seconde édition en 2019 de l'action.
D'abord codée en PHP, elle a subi une refonte totale en Python, à l'aide du framework Web [Django](https://www.djangoproject.com/).

View File

@ -1,6 +1,7 @@
from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""
Serialize a User object into JSON.

View File

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@ -2,7 +2,6 @@ from django.core.validators import RegexValidator
from django.db import models
from django.db.models import Index
from django.utils.crypto import get_random_string
from django.utils.functional import lazy
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
@ -120,7 +119,7 @@ class Video(models.Model):
def __str__(self):
return _("Video of team {name} ({trigram})")\
.format(name=self.participation.team.name, trigram = self.participation.team.trigram)
.format(name=self.participation.team.name, trigram=self.participation.team.trigram)
class Meta:
verbose_name = _("video")

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -5,8 +5,8 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, FormView, DetailView, RedirectView, UpdateView
from participation.forms import TeamForm, JoinTeamForm, ParticipationForm
from participation.models import Team
from .forms import TeamForm, JoinTeamForm, ParticipationForm
from .models import Team
class CreateTeamView(LoginRequiredMixin, CreateView):

View File

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@ -3,7 +3,7 @@ from django.contrib.auth.models import User
from django import forms
from django.utils.translation import gettext_lazy as _
from registration.models import StudentRegistration, CoachRegistration, AdminRegistration
from .models import StudentRegistration, CoachRegistration, AdminRegistration
class SignupForm(UserCreationForm):

View File

@ -5,7 +5,6 @@ from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.utils.translation import gettext_lazy as _
from polymorphic.models import PolymorphicModel
from corres2math.tokens import email_validation_token

View File

@ -1,6 +1,6 @@
from django.contrib.auth.models import User
from registration.models import AdminRegistration, Registration
from .models import AdminRegistration, Registration
def set_username(instance, **_):

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -8,8 +8,8 @@ from django.urls import reverse_lazy
from django.utils.http import urlsafe_base64_decode
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, TemplateView, DetailView
from corres2math.tokens import email_validation_token
from .forms import SignupForm, StudentRegistrationForm, CoachRegistrationForm

46
tox.ini Normal file
View File

@ -0,0 +1,46 @@
[tox]
envlist =
py38-django31
linters
skipsdist = True
[testenv]
sitepackages = True
deps =
-r{toxinidir}/requirements.txt
coverage
commands =
coverage run --omit='*migrations*,apps/scripts*' --source=apps,note_kfet ./manage.py test apps/
coverage report -m
[testenv:linters]
deps =
flake8
flake8-colors
flake8-django
flake8-import-order
flake8-typing-imports
pep8-naming
pyflakes
commands =
flake8 apps/
[flake8]
ignore = W503, I100, I101
exclude =
.tox,
.git,
__pycache__,
build,
dist,
*.pyc,
*.egg-info,
.cache,
.eggs,
*migrations*
max-complexity = 15
max-line-length = 160
import-order-style = google
application-import-names = flake8
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s